digitalmars.D - dip: __HERE__ special token
- monkyyy (14/14) Apr 10 2022 ```
- Alexandru Ermicioi (5/19) Apr 10 2022 Tuples in D right now autoexpand, making the expectation in
- monkyyy (6/7) Apr 11 2022 Mostly I want a cleaner way to get symbols for when I revisit
- Alexandru Ermicioi (6/13) Apr 11 2022 You could group your fields in a struct, and use with expression,
- =?UTF-8?Q?Ali_=c3=87ehreli?= (4/6) Apr 11 2022 Not me! I know it means heredoc: :)
- monkyyy (22/24) Apr 12 2022 Suppose your debugging a block of code with debug printer from
``` int ignored; int referenced; void main(){ alias foo=referenced; struct bar{} alias faz=sometemplate!int; alias firstcopy=__HERE__;//foo,bar,faz int baz; alias secondcopy=__HERE__;//foo,bar,faz,firstcopy,baz } ``` https://github.com/crazymonkyyy/DIPs/blob/master/DIPs/1NNN-MKY.md A special token for convenience while meta programming
Apr 10 2022
On Sunday, 10 April 2022 at 19:10:31 UTC, monkyyy wrote:``` int ignored; int referenced; void main(){ alias foo=referenced; struct bar{} alias faz=sometemplate!int; alias firstcopy=__HERE__;//foo,bar,faz int baz; alias secondcopy=__HERE__;//foo,bar,faz,firstcopy,baz } ``` https://github.com/crazymonkyyy/DIPs/blob/master/DIPs/1NNN-MKY.md A special token for convenience while meta programmingTuples in D right now autoexpand, making the expectation in secondcopy wrong. The result would be just, foo,bar,faz,foo,bar,faz,baz. Still, whats the use case of this functionality?
Apr 10 2022
On Sunday, 10 April 2022 at 21:50:59 UTC, Alexandru Ermicioi wrote:Still, whats the use case of this functionality?Mostly I want a cleaner way to get symbols for when I revisit https://github.com/crazymonkyyy/comfysettings and I do think defining a list of things to then turn around and do something repetitive with them is common
Apr 11 2022
On Monday, 11 April 2022 at 16:36:02 UTC, monkyyy wrote:On Sunday, 10 April 2022 at 21:50:59 UTC, Alexandru Ermicioi wrote:You could group your fields in a struct, and use with expression, btw.Still, whats the use case of this functionality?Mostly I want a cleaner way to get symbols for when I revisit https://github.com/crazymonkyyy/comfysettingsand I do think defining a list of things to then turn around and do something repetitive with them is commonRegarding the dip. You might better change __here__ to something more meaningful. People not knowing what __here__ does will inadvertently ask: here what? while reading this token.
Apr 11 2022
On 4/11/22 15:48, Alexandru Ermicioi wrote:People not knowing what __here__ does will inadvertently ask: here what?Not me! I know it means heredoc: :) https://dlang.org/spec/lex.html#delimited_strings Ali
Apr 11 2022
On Monday, 11 April 2022 at 22:48:31 UTC, Alexandru Ermicioi wrote:You could group your fields in a struct, and use with expression, btw.Suppose your debugging a block of code with debug printer from the dip examples ```d int foo; float bar; bool faz; alias dp=debugprinter!(); foreach(...){...} ``` to disable faz from being printed you would edit this code to ```d int foo; float bar; alias dp=debugprinter!(); bool faz; foreach(...){...} ``` if your organizing your variables in a struct you'd have to hunt down your usage of faz. The explicit purpose is to NOT require such structure
Apr 12 2022