Skip to content

Commit e0f9fec

Browse files
ibuclawdlang-bot
authored andcommitted
spec: Remove mentions of custom allocators and deallocators
1 parent 1cddc88 commit e0f9fec

File tree

4 files changed

+9
-91
lines changed

4 files changed

+9
-91
lines changed

deprecate.dd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $(SPEC_S Deprecated Features,
1212
$(THEAD Feature, Spec, Dep, Error, Gone)
1313
$(TROW $(DEPLINK body keyword), 2.075,  ,  ,  )
1414
$(TROW $(DEPLINK Hexstring literals), 2.079, 2.079, 2.086,  )
15-
$(TROW $(DEPLINK Class allocators and deallocators),  , 2.080, 2.087,  )
15+
$(TROW $(DEPLINK Class allocators and deallocators),  , 2.080, 2.087, 2.100 )
1616
$(TROW $(DEPLINK Implicit comparison of different enums), 2.075, 2.075, 2.081,  )
1717
$(TROW $(DEPLINK Implicit string concatenation), 2.072, 2.072, 2.081,  )
1818
$(TROW $(DEPLINK Using the result of a comma expression), 2.072, 2.072, 2.079,  )

spec/class.dd

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ $(UL
6868
$(LI $(GLINK SharedStaticDestructor)s)
6969
$(LI $(RELATIVE_LINK2 invariants, Class Invariants))
7070
$(LI $(DDSUBLINK spec/unittest, unittest, Unit Tests))
71-
$(LI $(RELATIVE_LINK2 allocators, Class Allocators))
7271
$(LI $(RELATIVE_LINK2 alias-this, Alias This))
7372
)
7473
)
@@ -1006,74 +1005,6 @@ $(GNAME Invariant):
10061005
)
10071006

10081007

1009-
$(H2 $(LNAME2 allocators, Class Allocators))
1010-
$(B Note): Class allocators are deprecated in D2.
1011-
$(GRAMMAR
1012-
$(GNAME Allocator):
1013-
$(D new) $(GLINK2 function, Parameters) $(GLINK2 function, FunctionBody)
1014-
)
1015-
1016-
$(P A class member function of the form:)
1017-
1018-
------
1019-
new(size_t size)
1020-
{
1021-
...
1022-
}
1023-
------
1024-
1025-
is called a class allocator.
1026-
The class allocator can have any number of parameters, provided
1027-
the first one is of type `size_t`.
1028-
Any number can be defined for a class, the correct one is
1029-
determined by the usual function overloading rules.
1030-
When a new expression:
1031-
1032-
------
1033-
new Foo;
1034-
------
1035-
1036-
is executed, and Foo is a class that has
1037-
an allocator, the allocator is called with the first argument
1038-
set to the size in bytes of the memory to be allocated for the
1039-
instance.
1040-
The allocator must allocate the memory and return it as a
1041-
$(D void*).
1042-
If the allocator fails, it must not return a $(D null), but
1043-
must throw an exception.
1044-
If there is more than one parameter to the allocator, the
1045-
additional arguments are specified within parentheses after
1046-
the $(D new) in the $(I NewExpression):
1047-
1048-
------
1049-
class Foo
1050-
{
1051-
this(string a) { ... }
1052-
1053-
new(size_t size, int x, int y)
1054-
{
1055-
...
1056-
}
1057-
}
1058-
1059-
...
1060-
1061-
new(1,2) Foo(a); // calls new(Foo.sizeof,1,2)
1062-
------
1063-
1064-
$(P Derived classes inherit any allocator from their base class,
1065-
if one is not specified.
1066-
)
1067-
1068-
$(P The class allocator is not called if the instance is created
1069-
on the stack.
1070-
)
1071-
1072-
$(P See also
1073-
$(LINK2 https://wiki.dlang.org/Memory_Management#Explicit_Class_Instance_Allocation,
1074-
Explicit Class Instance Allocation).
1075-
)
1076-
10771008
$(H2 $(LEGACY_LNAME2 AliasThis, alias-this, Alias This))
10781009

10791010
$(GRAMMAR
@@ -1479,7 +1410,7 @@ $(H3 $(LNAME2 anonymous, Anonymous Nested Classes))
14791410

14801411
$(GRAMMAR
14811412
$(GNAME NewAnonClassExpression):
1482-
$(D new) $(GLINK2 expression, AllocatorArguments)$(OPT) $(D class) $(GLINK ConstructorArgs)$(OPT) $(GLINK SuperClassOrInterface)$(OPT) $(GLINK Interfaces)$(OPT) $(GLINK2 struct, AggregateBody)
1413+
$(D new) $(D class) $(GLINK ConstructorArgs)$(OPT) $(GLINK SuperClassOrInterface)$(OPT) $(GLINK Interfaces)$(OPT) $(GLINK2 struct, AggregateBody)
14831414

14841415
$(GNAME ConstructorArgs):
14851416
$(D $(LPAREN)) $(GLINK2 expression, ArgumentList)$(OPT) $(D $(RPAREN))
@@ -1490,7 +1421,7 @@ which is equivalent to:
14901421
$(GRAMMAR_INFORMATIVE
14911422
$(D class) $(GLINK_LEX Identifier) $(D :) $(I SuperClassOrInterface) $(I Interfaces) $(I AggregateBody)
14921423
// ...
1493-
$(D new) $(I AllocatorArguments) $(I Identifier) $(I ConstructorArgs)
1424+
$(D new) $(I Identifier) $(I ConstructorArgs)
14941425
)
14951426

14961427
where $(I Identifier) is the name generated for the anonymous nested class.

spec/expression.dd

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -973,34 +973,24 @@ $(H3 $(LNAME2 new_expressions, New Expressions))
973973

974974
$(GRAMMAR
975975
$(GNAME NewExpression):
976-
$(D new) $(GLINK AllocatorArguments)$(OPT) $(GLINK2 type, Type)
977-
$(D new) $(GLINK AllocatorArguments)$(OPT) $(GLINK2 type, Type) $(D [) $(GLINK AssignExpression) $(D ])
978-
$(D new) $(GLINK AllocatorArguments)$(OPT) $(GLINK2 type, Type) $(D $(LPAREN)) $(GLINK ArgumentList)$(OPT) $(D $(RPAREN))
976+
$(D new) $(GLINK2 type, Type)
977+
$(D new) $(GLINK2 type, Type) $(D [) $(GLINK AssignExpression) $(D ])
978+
$(D new) $(GLINK2 type, Type) $(D $(LPAREN)) $(GLINK ArgumentList)$(OPT) $(D $(RPAREN))
979979
$(GLINK2 class, NewAnonClassExpression)
980980

981-
$(GNAME AllocatorArguments):
982-
$(D $(LPAREN)) $(GLINK ArgumentList)$(OPT) $(D $(RPAREN))
983-
984981
$(GNAME ArgumentList):
985982
$(GLINK AssignExpression)
986983
$(GLINK AssignExpression) $(D ,)
987984
$(GLINK AssignExpression) $(D ,) $(GSELF ArgumentList)
988985
)
989986

990987
$(P $(I NewExpression)s are used to allocate memory on the garbage
991-
collected heap (default) or using a class or struct specific allocator.
992-
)
993-
994-
$(DDOC_DEPRECATED If $(I AllocatorArguments) is provided, then
995-
the $(I ArgumentList) is passed to the class or struct specific
996-
$(DDSUBLINK spec/class, allocators, allocator function) after the size argument.
988+
collected heap.
997989
)
998990

999991
$(P If a $(I NewExpression) is used as an initializer for
1000992
a function local variable with $(D scope) storage class,
1001-
and the $(I ArgumentList) to $(D new) is empty, then
1002-
the instance is allocated on the stack rather than the heap
1003-
or using the class specific allocator.
993+
then the instance is allocated on the stack.
1004994
)
1005995

1006996
$(H3 $(LNAME2 new_multidimensional, Multidimensional Arrays))
@@ -1079,8 +1069,7 @@ $(GNAME DeleteExpression):
10791069

10801070
$(P If $(I UnaryExpression) is a variable allocated
10811071
on the stack, the class destructor (if any) is called for that
1082-
instance. Neither the garbage collector nor any class deallocator
1083-
is called.
1072+
instance. The garbage collector is not called.
10841073
)
10851074

10861075
$(UNDEFINED_BEHAVIOR

spec/module.dd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ $(GNAME DeclDef):
2020
$(GLINK2 class, Constructor)
2121
$(GLINK2 class, Destructor)
2222
$(GLINK2 struct, Postblit)
23-
$(GLINK2 class, Allocator)
24-
$(GLINK2 class, Deallocator)
2523
$(GLINK2 class, Invariant)
2624
$(GLINK2 unittest, UnitTest)
2725
$(GLINK2 class, AliasThis)

0 commit comments

Comments
 (0)