You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are currently a few stylized ways to indicate a type is not copyable or assignable (using where false on the init= or a compilerError in the init=). However we might prefer to have alternative ways to do this. This issue discusses other alternatives.
while the new syntax might not come up often for users, it will be reasonably clear to read and won't contain things like superfluous method bodies
Cons:
it requires new syntax
perhaps pure virtual methods and opt-in to compiler-generated default initializer are different enough problems that they should have different solutions
attributes
use attributes on the type, with a generalized attribute syntax (see #14141), to indicate it; e.g. @attribute(no copy init) record R { }
Pros:
attribute can be reasonably clear to read and apply to type
able to also indicate things like opting in to default initializer or init=
Cons:
what functions compiler generates might be too fundamental for attributes
The text was updated successfully, but these errors were encountered:
Spin-off from #8065.
There are currently a few stylized ways to indicate a type is not copyable or assignable (using
where false
on theinit=
or acompilerError
in theinit=
). However we might prefer to have alternative ways to do this. This issue discusses other alternatives.new syntax
e.g.
proc init=(other) = none
(or something)Pros:
Cons:
attributes
use attributes on the type, with a generalized attribute syntax (see #14141), to indicate it; e.g.
@attribute(no copy init) record R { }
Pros:
Cons:
The text was updated successfully, but these errors were encountered: