Re: Source expression passed to a lazy parameter

2018-04-09 Thread Seb via Digitalmars-d-learn
On Monday, 9 April 2018 at 13:03:38 UTC, Simen Kjærås wrote: On Monday, 9 April 2018 at 11:33:56 UTC, Alex wrote: On Monday, 9 April 2018 at 09:20:42 UTC, Simen Kjærås wrote: Nope. Something along the lines of __traits(getSource, arg) has been discussed occasionally. Is this available

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 9 April 2018 at 08:27:50 UTC, Per Nordlöw wrote: Is it possible to get the source expression sent to a lazy function? So that I can implement something like show(Arg)(lazy Arg arg) { writeln(arg.sourceof, arg); } used as show(1+2+3); will print 1+2+3:6 Because of

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 9 April 2018 at 11:33:56 UTC, Alex wrote: On Monday, 9 April 2018 at 09:20:42 UTC, Simen Kjærås wrote: Nope. Something along the lines of __traits(getSource, arg) has been discussed occasionally. Is this available somehow? And/or do you have a link to the discussion, maybe?

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Alex via Digitalmars-d-learn
On Monday, 9 April 2018 at 09:20:42 UTC, Simen Kjærås wrote: Nope. Something along the lines of __traits(getSource, arg) has been discussed occasionally. Is this available somehow? And/or do you have a link to the discussion, maybe?

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 9 April 2018 at 08:27:50 UTC, Per Nordlöw wrote: Is it possible to get the source expression sent to a lazy function? Nope. Something along the lines of __traits(getSource, arg) has been discussed occasionally. For lazy what you're asking is impossible, since the compiler

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 09, 2018 08:27:50 Per Nordlöw via Digitalmars-d-learn wrote: > Is it possible to get the source expression sent to a lazy > function? > > So that I can implement something like > > show(Arg)(lazy Arg arg) > { > writeln(arg.sourceof, arg); > } > > used as > >

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Basile B. via Digitalmars-d-learn
On Monday, 9 April 2018 at 08:27:50 UTC, Per Nordlöw wrote: Is it possible to get the source expression sent to a lazy function? So that I can implement something like show(Arg)(lazy Arg arg) { writeln(arg.sourceof, arg); } used as show(1+2+3); will print 1+2+3:6 No (afaik),

Source expression passed to a lazy parameter

2018-04-09 Thread Per Nordlöw via Digitalmars-d-learn
Is it possible to get the source expression sent to a lazy function? So that I can implement something like show(Arg)(lazy Arg arg) { writeln(arg.sourceof, arg); } used as show(1+2+3); will print 1+2+3:6