www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - UDA and static struct fields

reply Andrea Fontana <nospam example.com> writes:
Is this a bug or am I missing something?

https://run.dlang.io/is/OGHJYX


Andrea
May 24 2018
parent reply Simen =?UTF-8?B?S2rDpnLDpXM=?= <simen.kjaras gmail.com> writes:
On Thursday, 24 May 2018 at 07:47:54 UTC, Andrea Fontana wrote:
 Is this a bug or am I missing something?

 https://run.dlang.io/is/OGHJYX


 Andrea
This line: mixin("alias tmp = " ~ s ~ ";"); There's no mention of Symbol in there. If you change it to this: mixin("alias tmp = Symbol" ~ s ~ ";"); then suddenly things work. -- Simen
May 24 2018
parent reply Andrea Fontana <nospam example.com> writes:
On Thursday, 24 May 2018 at 07:59:08 UTC, Simen Kjærås wrote:
 On Thursday, 24 May 2018 at 07:47:54 UTC, Andrea Fontana wrote:
 Is this a bug or am I missing something?

 https://run.dlang.io/is/OGHJYX


 Andrea
This line: mixin("alias tmp = " ~ s ~ ";"); There's no mention of Symbol in there. If you change it to this: mixin("alias tmp = Symbol" ~ s ~ ";"); then suddenly things work. -- Simen
What?
May 24 2018
parent reply Alex <sascha.orlov gmail.com> writes:
On Thursday, 24 May 2018 at 08:48:30 UTC, Andrea Fontana wrote:
 This line:

       mixin("alias tmp = " ~ s ~ ";");

 There's no mention of Symbol in there. If you change it to 
 this:

       mixin("alias tmp = Symbol" ~ s ~ ";");

 then suddenly things work.

 --
   Simen
What?
a dot is missing, but essentially, Simen found it :) Line 20 in https://run.dlang.io/is/OGHJYX should be: mixin("alias tmp = Symbol." ~ s ~ ";");
May 24 2018
parent reply Andrea Fontana <nospam example.com> writes:
On Thursday, 24 May 2018 at 09:17:10 UTC, Alex wrote:
 On Thursday, 24 May 2018 at 08:48:30 UTC, Andrea Fontana wrote:
 This line:

       mixin("alias tmp = " ~ s ~ ";");

 There's no mention of Symbol in there. If you change it to 
 this:

       mixin("alias tmp = Symbol" ~ s ~ ";");

 then suddenly things work.

 --
   Simen
What?
a dot is missing, but essentially, Simen found it :) Line 20 in https://run.dlang.io/is/OGHJYX should be: mixin("alias tmp = Symbol." ~ s ~ ";");
Whoops I didn't get it. Thank you both. Andrea
May 24 2018
parent reply Andrea Fontana <nospam example.com> writes:
On Thursday, 24 May 2018 at 10:23:41 UTC, Andrea Fontana wrote:
 On Thursday, 24 May 2018 at 09:17:10 UTC, Alex wrote:
 On Thursday, 24 May 2018 at 08:48:30 UTC, Andrea Fontana wrote:
 This line:

       mixin("alias tmp = " ~ s ~ ";");

 There's no mention of Symbol in there. If you change it to 
 this:

       mixin("alias tmp = Symbol" ~ s ~ ";");

 then suddenly things work.

 --
   Simen
What?
a dot is missing, but essentially, Simen found it :) Line 20 in https://run.dlang.io/is/OGHJYX should be: mixin("alias tmp = Symbol." ~ s ~ ";");
Whoops I didn't get it. Thank you both. Andrea
Why didn't that return any error, anyway?
May 24 2018
parent bauss <jj_1337 live.dk> writes:
On Thursday, 24 May 2018 at 10:42:26 UTC, Andrea Fontana wrote:
 On Thursday, 24 May 2018 at 10:23:41 UTC, Andrea Fontana wrote:
 On Thursday, 24 May 2018 at 09:17:10 UTC, Alex wrote:
 On Thursday, 24 May 2018 at 08:48:30 UTC, Andrea Fontana 
 wrote:
 This line:

       mixin("alias tmp = " ~ s ~ ";");

 There's no mention of Symbol in there. If you change it to 
 this:

       mixin("alias tmp = Symbol" ~ s ~ ";");

 then suddenly things work.

 --
   Simen
What?
a dot is missing, but essentially, Simen found it :) Line 20 in https://run.dlang.io/is/OGHJYX should be: mixin("alias tmp = Symbol." ~ s ~ ";");
Whoops I didn't get it. Thank you both. Andrea
Why didn't that return any error, anyway?
Because: mixin("alias tmp = " ~ s ~ ";"); Translates to: alias tmp = i; And i will be the global i.
May 24 2018