This needs to be fixed - ref

Nick Treleaven nick at geany.org
Sat Aug 31 09:31:16 UTC 2024


On Thursday, 29 August 2024 at 02:29:21 UTC, Manu wrote:
> Did you miss my point? The language can't *express *these 
> things... we need backdoor information to hold the concept in 
> any sort of expression.

Being able to compose attributes would be useful, yes. I'm not 
sure how important having that is though.

>> BTW that was just how I understand `.tupleof`. I see it as (a 
>> superset of) a sequence of implicit ref declarations.
>>
>
> Okay, so you might be wrong?

Yes, sorry. See Timon's reply to me.

>> If you mean synthesize `tupleof`, I already showed how 
>> (without introspection support), the first example here: 
>> https://forum.dlang.org/post/fctetiyhbiyhadlmcyzr@forum.dlang.org
>>
>> That example literally works with dmd recent git.
>>
>
> I'm very keen to play with ref locals when it lands; it's been 
> such a long
> time coming.
> That's not quite the same thing though; you've declared 2 local 
> variables;
> does that infer they allocate stack space? Do I rely on the 
> optimiser now
> to remove them? It looks like yet-another-workaround/hack to me.

Well if .tupleof didn't exist and I didn't have write access to 
the source aggregate type (or I wanted it on a static array), 
then I could model it with a mixin that expands to my local ref 
declaration sequence alias. But yes that might well be less 
efficient.


More information about the Digitalmars-d mailing list