Re: The worst Phobos template (in binderoo)

2016-10-01 Thread Stefan Koch via Digitalmars-d
On Saturday, 1 October 2016 at 19:54:13 UTC, Dicebot wrote: On Saturday, 1 October 2016 at 15:06:44 UTC, Stefan Koch wrote: The problem is the default template parameter Flag!"unsafe", because fqn makes it into "cast(Flag)". Getting this right is a bit tricky. Isn't it a problem with library

Re: The worst Phobos template (in binderoo)

2016-10-01 Thread Dicebot via Digitalmars-d
On Saturday, 1 October 2016 at 15:06:44 UTC, Stefan Koch wrote: On Saturday, 1 October 2016 at 10:19:21 UTC, Dicebot wrote: On 09/29/2016 07:02 PM, David Nadlinger wrote: [...] What are the issues with fullyQualifiedName in that context? I mean other than Voldemort types of course. I'd

Re: The worst Phobos template (in binderoo)

2016-10-01 Thread Stefan Koch via Digitalmars-d
On Saturday, 1 October 2016 at 10:19:21 UTC, Dicebot wrote: On 09/29/2016 07:02 PM, David Nadlinger wrote: [...] What are the issues with fullyQualifiedName in that context? I mean other than Voldemort types of course. I'd expect `static import` + `fullyQualifiedName` combo to be reasonably

Re: The worst Phobos template (in binderoo)

2016-10-01 Thread Dicebot via Digitalmars-d
On 09/29/2016 07:02 PM, David Nadlinger wrote: > On Thursday, 29 September 2016 at 13:58:44 UTC, Eugene Wissner wrote: >> Any chance to get this one working: >> >> import std.typecons; >> >> enum Stuff >> { >> asdf, >> } >> >> void main() >> { >> BitFlags!Stuff a; >>

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Andrei Alexandrescu via Digitalmars-d
On 09/29/2016 03:27 PM, Timon Gehr wrote: On 16.09.2016 01:10, Andrei Alexandrescu wrote: On 9/15/16 7:08 PM, Andrei Alexandrescu wrote: Yes, that DIP. It would need some more formal work before defining an implementation. Stefan, would you want to lead that effort? -- Andrei Actually I see

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Timon Gehr via Digitalmars-d
On 16.09.2016 01:25, Stefan Koch wrote: On Thursday, 15 September 2016 at 23:08:54 UTC, Andrei Alexandrescu wrote: Yes, that DIP. It would need some more formal work before defining an implementation. Stefan, would you want to lead that effort? -- Andrei I am not good at defining semantics,

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Timon Gehr via Digitalmars-d
On 16.09.2016 01:10, Andrei Alexandrescu wrote: On 9/15/16 7:08 PM, Andrei Alexandrescu wrote: Yes, that DIP. It would need some more formal work before defining an implementation. Stefan, would you want to lead that effort? -- Andrei Actually I see Timon authored that (I thought it's an

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Stefan Koch via Digitalmars-d
On Thursday, 29 September 2016 at 16:30:56 UTC, Eugene Wissner wrote: The problem is you can never know all the use cases of some feature. It is just pointless to try to predict where a user will need a feature. I had a use case where I could be sure that everything needed is imported and

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Eugene Wissner via Digitalmars-d
On Thursday, 29 September 2016 at 16:02:53 UTC, David Nadlinger wrote: This wouldn't be a correct use of the feature anyway, since it runs into all sorts of fundamental issues with imports/scoping, aliases and templates. Using .stringof/fullyQualifiedName to generate a reference to a type or

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Eugene Wissner via Digitalmars-d
On Thursday, 29 September 2016 at 14:49:03 UTC, Stefan Koch wrote: The reason why this fails is because of the cast(Flag) which should be cast(Flag!"unsafe"). I can probably make it work tough, that means more special casing :) Yes, I know. See this topic for the first discussion:

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread David Nadlinger via Digitalmars-d
On Thursday, 29 September 2016 at 13:58:44 UTC, Eugene Wissner wrote: Any chance to get this one working: import std.typecons; enum Stuff { asdf, } void main() { BitFlags!Stuff a; mixin(__traits(fullyQualifiedName, typeof(a)) ~ " c;"); } This wouldn't be a correct

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Stefan Koch via Digitalmars-d
On Thursday, 29 September 2016 at 13:58:44 UTC, Eugene Wissner wrote: On Wednesday, 14 September 2016 at 20:28:13 UTC, Stefan Koch wrote: On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I would like to see users of fullyQualifiedName because apart from binderoo code which

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Eugene Wissner via Digitalmars-d
On Wednesday, 14 September 2016 at 20:28:13 UTC, Stefan Koch wrote: On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I would like to see users of fullyQualifiedName because apart from binderoo code which seems to work, I have none. That was supposed to say : I would like

Re: The worst Phobos template (in binderoo)

2016-09-16 Thread Stefan Koch via Digitalmars-d
On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I am going to submit a PR soon. https://github.com/dlang/dmd/pull/6134 Here it is.

Re: The worst Phobos template (in binderoo)

2016-09-16 Thread jmh530 via Digitalmars-d
On Friday, 16 September 2016 at 00:57:13 UTC, Stefan Koch wrote: When polished CTFE can totally be used as a serious workhorse for cases that would have fallen intro the static foreach category. When you get your polished CTFE finished, you might consider a blog post on it (including an

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 23:25:34 UTC, Stefan Koch wrote: On Thursday, 15 September 2016 at 23:08:54 UTC, Andrei Alexandrescu wrote: Yes, that DIP.[http://wiki.dlang.org/DIP57] It would need some more formal work before defining an implementation. Stefan, would you want to lead that

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 23:08:54 UTC, Andrei Alexandrescu wrote: Yes, that DIP. It would need some more formal work before defining an implementation. Stefan, would you want to lead that effort? -- Andrei I am not good at defining semantics, yet I would participate in a joint

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 22:58:12 UTC, Stefan Koch wrote: The Performance-Penalty will be less then on templates. Let me add a disclaimer, I _think_ the performance penalty _can_ be less then the penalty on templates. Also static if can sometimes lead to counter-intuitive situations,

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Andrei Alexandrescu via Digitalmars-d
On 9/15/16 7:08 PM, Andrei Alexandrescu wrote: Yes, that DIP. It would need some more formal work before defining an implementation. Stefan, would you want to lead that effort? -- Andrei Actually I see Timon authored that (I thought it's an older DIP by Walter). Timon, would you want to

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Andrei Alexandrescu via Digitalmars-d
On 9/15/16 6:58 PM, Stefan Koch wrote: On Thursday, 15 September 2016 at 14:43:16 UTC, Stefan Koch wrote: On Thursday, 15 September 2016 at 14:38:41 UTC, Andrei Alexandrescu wrote: On 09/15/2016 10:08 AM, Stefan Koch wrote: static foreach on the other hand is a whole new can of worms. As

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 14:43:16 UTC, Stefan Koch wrote: On Thursday, 15 September 2016 at 14:38:41 UTC, Andrei Alexandrescu wrote: On 09/15/2016 10:08 AM, Stefan Koch wrote: static foreach on the other hand is a whole new can of worms. As walter will be able to tell you. It's time

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 14:38:41 UTC, Andrei Alexandrescu wrote: On 09/15/2016 10:08 AM, Stefan Koch wrote: static foreach on the other hand is a whole new can of worms. As walter will be able to tell you. It's time to open it. -- Andrei Please give me an example on how it should

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Andrei Alexandrescu via Digitalmars-d
On 09/15/2016 10:08 AM, Stefan Koch wrote: static foreach on the other hand is a whole new can of worms. As walter will be able to tell you. It's time to open it. -- Andrei

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 13:49:46 UTC, Andrei Alexandrescu wrote: On 09/15/2016 09:27 AM, Stefan Koch wrote: On Thursday, 15 September 2016 at 13:20:16 UTC, Andrei Alexandrescu wrote: On 09/15/2016 08:35 AM, Stefan Koch wrote: On Thursday, 15 September 2016 at 12:26:08 UTC, Andrei

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Andrei Alexandrescu via Digitalmars-d
On 09/15/2016 09:27 AM, Stefan Koch wrote: On Thursday, 15 September 2016 at 13:20:16 UTC, Andrei Alexandrescu wrote: On 09/15/2016 08:35 AM, Stefan Koch wrote: On Thursday, 15 September 2016 at 12:26:08 UTC, Andrei Alexandrescu wrote: Apparently we need that static foreach iteration. --

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 13:20:16 UTC, Andrei Alexandrescu wrote: On 09/15/2016 08:35 AM, Stefan Koch wrote: On Thursday, 15 September 2016 at 12:26:08 UTC, Andrei Alexandrescu wrote: Apparently we need that static foreach iteration. -- Andrei What exactly do you mean ? As long as

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Andrei Alexandrescu via Digitalmars-d
On 09/15/2016 08:35 AM, Stefan Koch wrote: On Thursday, 15 September 2016 at 12:26:08 UTC, Andrei Alexandrescu wrote: Apparently we need that static foreach iteration. -- Andrei What exactly do you mean ? As long as we instanciate n templates for a member nested n levels the overhead is

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 12:26:08 UTC, Andrei Alexandrescu wrote: Apparently we need that static foreach iteration. -- Andrei What exactly do you mean ? As long as we instanciate n templates for a member nested n levels the overhead is massive! How would static foreach help ?

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Andrei Alexandrescu via Digitalmars-d
On 09/14/2016 05:50 PM, Stefan Koch wrote: On Wednesday, 14 September 2016 at 21:06:10 UTC, Andrei Alexandrescu wrote: On 09/14/2016 04:52 PM, Stefan Koch wrote: [...] (Disclaimer: I didn't run any speed tests.) By looking at the definition of fullyQualifiedName it seems to me we can go a

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 September 2016 at 06:08:33 UTC, Dicebot wrote: mixin("alias T2 = " ~ fqn!T); static assert(is(T2 == T)); In that sense builtin trait could be a better option. Yes a builtin trait is the better option. I made a youtube video about that. Showing you how bad FullyQualifiedName

Re: The worst Phobos template (in binderoo)

2016-09-15 Thread Dicebot via Digitalmars-d
On Wednesday, 14 September 2016 at 20:28:13 UTC, Stefan Koch wrote: On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I would like to see users of fullyQualifiedName because apart from binderoo code which seems to work, I have none. That was supposed to say : I would like

Re: The worst Phobos template (in binderoo)

2016-09-14 Thread Atila Neves via Digitalmars-d
On Wednesday, 14 September 2016 at 20:28:13 UTC, Stefan Koch wrote: On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I would like to see users of fullyQualifiedName because apart from binderoo code which seems to work, I have none. That was supposed to say : I would like

Re: The worst Phobos template (in binderoo)

2016-09-14 Thread David Nadlinger via Digitalmars-d
On Wednesday, 14 September 2016 at 22:48:29 UTC, Pierre Krafft wrote: I've had to use fullyQualifiedName in some string mixins. Unless there is more to the example than what meets the eye, "had to" isn't quite true, and even with the `import moduleName!…` hack, your code is still

Re: The worst Phobos template (in binderoo)

2016-09-14 Thread Pierre Krafft via Digitalmars-d
On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I would like to see users of fullyQualifiedName because apart from binderoo code which seems to work, I have none. I've had to use fullyQualifiedName in some string mixins. Take a look at

Re: The worst Phobos template (in binderoo)

2016-09-14 Thread Stefan Koch via Digitalmars-d
On Wednesday, 14 September 2016 at 21:06:10 UTC, Andrei Alexandrescu wrote: On 09/14/2016 04:52 PM, Stefan Koch wrote: [...] (Disclaimer: I didn't run any speed tests.) By looking at the definition of fullyQualifiedName it seems to me we can go a long way with traditional optimization

Re: The worst Phobos template (in binderoo)

2016-09-14 Thread Andrei Alexandrescu via Digitalmars-d
On 09/14/2016 04:52 PM, Stefan Koch wrote: On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: It takes a whooping 500 milliseconds Ahm... I misread my performance graph it's 138ms for the first instanciation. and around 5ms for every following one. the total time spent on it

Re: The worst Phobos template (in binderoo)

2016-09-14 Thread Stefan Koch via Digitalmars-d
On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: It takes a whooping 500 milliseconds Ahm... I misread my performance graph it's 138ms for the first instanciation. and around 5ms for every following one. the total time spent on it was 500ms

Re: The worst Phobos template (in binderoo)

2016-09-14 Thread Stefan Koch via Digitalmars-d
On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I would like to see users of fullyQualifiedName because apart from binderoo code which seems to work, I have none. That was supposed to say : I would like to see [test cases from] users of fullyQulifiedName.

The worst Phobos template (in binderoo)

2016-09-14 Thread Stefan Koch via Digitalmars-d
Hi Guys, I recently had a closer look at the templates that cost the most time to instantiate in the frontend. and there is one clear winner. FullyQualified name from std.traits. It takes a whooping 500 milliseconds(on my test-case) for it's semantic phase. this is because this template is