On Thursday, 15 May 2025 at 16:22:43 UTC, Nick Treleaven wrote:
> On Wednesday, 14 May 2025 at 18:06:26 UTC, monkyyy wrote:
> auto (a,b)=...
enum (a,b)=...
alias (a,b)=...
immutable @someuda @nogc auto (a,b)=...
Unpacking into alias
es is not included in the DIP, but it might be a nice future enhancement. The other 3 lines would work except UDAs (@someuda
) is not currently supported by the implementation. (I'll add an error for that as I currently get a segfault).
I mean this as a major difference then yours
((x,y), z){ ... } is lowered to (__arg0, z){ auto (x,y) = __arg0; ...}. In general, it preserves and copies storage classes from the parameter to the unpack declaration in the function body.
ref storage class is copied outwards, e.g. if you do ((ref a,b), c){ ... } that gets lowered to (ref __arg0, c){ (ref a,auto b) = __arg0; ... }.
The lowering im suggesting is lazier but I think would naturally allow aliases and enums
Idk about udas cause... compiler dev stuff I now nothing about, but if it was mixin(assimentstart~" "~id[I]~"="~assignfrom.opSeperate!(I,Total))
I think those udas could be copy and pasted depending on how close to the raw strings the code was. If not, I dont actually care(I hate the labling), auto, alias, enum would be good.