www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Draft proposal for mixin template intermediary storage

reply Hipreme <msnmancini hotmail.com> writes:
https://github.com/dlang/DIPs/pull/237/files?short_path=8527ec5#diff-8527ec51661ec30739a45e52edbb0f5299a3aad7b8eafbeb21d3b09d7c42ad82


I have been using `mixin template` for quite some time as I was a 
bit bothered with its usability and how dependent of other 
features it actually is. I'm proposing a more readable, self 
contained and faster mixin template. I want to know some of your 
thoughts
Dec 20 2022
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
I think you have caught on to something that I played a little bit 
during BeerConf.

We need to make the compiler 'forget' certain template instantiations 
and with that, to not directly expose them outside of a mixin template 
body would be a good semantic to it.

I refer to them as a type function, because its a meta-function that 
operates on types. Its not quite types as first-class, but more of a 
reference to something in the AST that is a type.

It could be a possible solution to deadalnix's data structure problem 
with storage classes like const if it has the right hook.
Dec 20 2022
parent reply Max Samukha <maxsamukha gmail.com> writes:
On Tuesday, 20 December 2022 at 17:08:47 UTC, rikki cattermole 
wrote:
 I think you have caught on to something that I played a little 
 bit during BeerConf.

 We need to make the compiler 'forget' certain template 
 instantiations and with that, to not directly expose them 
 outside of a mixin template body would be a good semantic to it.

 I refer to them as a type function, because its a meta-function 
 that operates on types. Its not quite types as first-class, but 
 more of a reference to something in the AST that is a type.

 It could be a possible solution to deadalnix's data structure 
 problem with storage classes like const if it has the right 
 hook.
What happened to __local from https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1010.md?
Dec 20 2022
next sibling parent cc <cc nevernet.com> writes:
On Tuesday, 20 December 2022 at 17:26:24 UTC, Max Samukha wrote:
 What happened to __local from 
 https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1010.md?
That's a good question. I like the OP proposal and have run into places where I have wanted something similar, but I'd also love something that could be extended to all `static foreach` situations. Of course, still waiting on `static break` and `static continue`...
Dec 25 2022
prev sibling parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 12/20/22 18:26, Max Samukha wrote:
 On Tuesday, 20 December 2022 at 17:08:47 UTC, rikki cattermole wrote:
 I think you have caught on to something that I played a little bit 
 during BeerConf.

 We need to make the compiler 'forget' certain template instantiations 
 and with that, to not directly expose them outside of a mixin template 
 body would be a good semantic to it.

 I refer to them as a type function, because its a meta-function that 
 operates on types. Its not quite types as first-class, but more of a 
 reference to something in the AST that is a type.

 It could be a possible solution to deadalnix's data structure problem 
 with storage classes like const if it has the right hook.
What happened to __local from https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1010.md?
This is what happened to it: https://github.com/dlang/dmd/commit/bac3426f9881e4a591df229423475efc6c3e0918 In context: https://github.com/tgehr/dmd/commits/static-foreach
Dec 25 2022
parent reply bauss <jacobbauss gmail.com> writes:
On Sunday, 25 December 2022 at 21:52:29 UTC, Timon Gehr wrote:
 On 12/20/22 18:26, Max Samukha wrote:
 On Tuesday, 20 December 2022 at 17:08:47 UTC, rikki cattermole 
 wrote:
 I think you have caught on to something that I played a 
 little bit during BeerConf.

 We need to make the compiler 'forget' certain template 
 instantiations and with that, to not directly expose them 
 outside of a mixin template body would be a good semantic to 
 it.

 I refer to them as a type function, because its a 
 meta-function that operates on types. Its not quite types as 
 first-class, but more of a reference to something in the AST 
 that is a type.

 It could be a possible solution to deadalnix's data structure 
 problem with storage classes like const if it has the right 
 hook.
What happened to __local from https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1010.md?
This is what happened to it: https://github.com/dlang/dmd/commit/bac3426f9881e4a591df229423475efc6c3e0918 In context: https://github.com/tgehr/dmd/commits/static-foreach
But why was it removed?
Dec 26 2022
parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 12/26/22 20:19, bauss wrote:
 On Sunday, 25 December 2022 at 21:52:29 UTC, Timon Gehr wrote:
 On 12/20/22 18:26, Max Samukha wrote:
 On Tuesday, 20 December 2022 at 17:08:47 UTC, rikki cattermole wrote:
 I think you have caught on to something that I played a little bit 
 during BeerConf.

 We need to make the compiler 'forget' certain template 
 instantiations and with that, to not directly expose them outside of 
 a mixin template body would be a good semantic to it.

 I refer to them as a type function, because its a meta-function that 
 operates on types. Its not quite types as first-class, but more of a 
 reference to something in the AST that is a type.

 It could be a possible solution to deadalnix's data structure 
 problem with storage classes like const if it has the right hook.
What happened to __local from https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1010.md?
This is what happened to it: https://github.com/dlang/dmd/commit/bac3426f9881e4a591df229423475efc6c3e0918 In context: https://github.com/tgehr/dmd/commits/static-foreach
But why was it removed?
Because it was just an experiment and not part of the scope of the DIP. (I just proposed everything that was obvious to not give any attack surface.) I am in particular not sure about the syntax `__local`. We can add such a feature back easily, it's around 10 lines of code that need to be restored, but I don't know how exactly it should look.
Dec 27 2022
parent reply Hipreme <msnmancini hotmail.com> writes:
On Tuesday, 27 December 2022 at 23:02:39 UTC, Timon Gehr wrote:
 [...]
static private?
Dec 27 2022
parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 12/28/22 00:55, Hipreme wrote:
 On Tuesday, 27 December 2022 at 23:02:39 UTC, Timon Gehr wrote:
 [...]
static private?
Perhaps, but `private` is usually module level.
Dec 27 2022
next sibling parent areYouSureAboutThat <areYouSureAboutThat gmail.com> writes:
On Wednesday, 28 December 2022 at 00:44:45 UTC, Timon Gehr wrote:
 On 12/28/22 00:55, Hipreme wrote:
 On Tuesday, 27 December 2022 at 23:02:39 UTC, Timon Gehr wrote:
 [...]
static private?
Perhaps, but `private` is usually module level.
I feel a 'gripe' coming on... https://dictionary.cambridge.org/dictionary/english/gripe 'to complain continuously about something in a way that is annoying'.
Dec 27 2022
prev sibling parent David Gileadi <gileadisNOSPM gmail.com> writes:
On Wednesday, 28 December 2022 at 00:44:45 UTC, Timon Gehr wrote:
 On 12/28/22 00:55, Hipreme wrote:
 On Tuesday, 27 December 2022 at 23:02:39 UTC, Timon Gehr wrote:
 [...]
static private?
Perhaps, but `private` is usually module level.
`scope private` is my bike shed color, although I can't help loving `super private` too :)
Dec 28 2022
prev sibling parent thebluepandabear <therealbluepandabear protonmail.com> writes:
On Tuesday, 20 December 2022 at 16:10:42 UTC, Hipreme wrote:
 https://github.com/dlang/DIPs/pull/237/files?short_path=8527ec5#diff-8527ec51661ec30739a45e52edbb0f5299a3aad7b8eafbeb21d3b09d7c42ad82


 I have been using `mixin template` for quite some time as I was 
 a bit bothered with its usability and how dependent of other 
 features it actually is. I'm proposing a more readable, self 
 contained and faster mixin template. I want to know some of 
 your thoughts
I'm too dumb to understand what this means yet, but good luck with it. If it will help improve the quality of the language then hopefully it'll get accepted.
Dec 27 2022