Skip to content

Commit e02ea34

Browse files
authored
Fix Bugzilla 24543 - The @future attribute is (almost) undocumented (#3827)
1 parent d6bbb19 commit e02ea34

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

spec/attribute.dd

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ $(GNAME FunctionAttributeKwd):
3939

4040
$(GNAME AtAttribute):
4141
$(D @) $(RELATIVE_LINK2 disable, $(D disable))
42+
$(D @) $(RELATIVE_LINK2 future, $(D __future))
4243
$(D @) $(RELATIVE_LINK2 nogc, $(D nogc))
4344
$(D @) $(DDLINK spec/ob, Live Functions, `live`)
4445
$(GLINK Property)
@@ -402,6 +403,34 @@ $(GNAME DeprecatedAttribute):
402403
)
403404

404405

406+
$(H2 $(LNAME2 future, `@__future` attribute))
407+
408+
$(P The `@__future` attribute is used to mark a new symbol which could
409+
cause a name clash in another module. The other module using a symbol with the
410+
same name will continue to compile as before but will show a deprecation message.
411+
The message indicates that the new symbol will break the existing code in future,
412+
and the other module should be updated.
413+
)
414+
415+
$(NOTE Currently only methods that implicitly override a `@__future` base class
416+
method show a deprecation message.)
417+
418+
$(P See $(LINK2 https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1007.md,
419+
DIP1007) for details.)
420+
421+
$(COMMENT
422+
---
423+
module a;
424+
@__future int i;
425+
426+
module b;
427+
import a;
428+
import c : i;
429+
enum e = i; // Deprecation: `c.i` will conflict with `@__future` symbol `a.i`
430+
---
431+
)
432+
433+
405434
$(H2 $(LNAME2 visibility_attributes, Visibility Attributes))
406435

407436
$(GRAMMAR

spec/traits.dd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,8 +1185,9 @@ $(H3 $(GNAME isNested))
11851185
$(H3 $(GNAME isFuture))
11861186

11871187
$(P Takes one argument. It returns `true` if the argument is a symbol
1188-
marked with the `@future` keyword, otherwise `false`. Currently, only
1189-
functions and variable declarations have support for the `@future` keyword.)
1188+
marked with the $(DDSUBLINK spec/attribute, future, `@__future` attribute),
1189+
otherwise `false`. Currently, only
1190+
functions and variable declarations have support for the `@__future` keyword.)
11901191

11911192
$(H3 $(GNAME isDeprecated))
11921193

0 commit comments

Comments
 (0)