Re: Name That Technique!

2017-02-13 Thread Ali Çehreli via Digitalmars-d

On 02/07/2017 04:28 PM, deadalnix wrote:

On Saturday, 4 February 2017 at 23:54:12 UTC, David Gileadi wrote:

That's obviously a self important lookup.


This. So much this.


I'm afraid you are the only one who appreciate my humor :)


"self-important" is official now:

  https://dlang.org/blog/2017/02/13/a-new-import-idiom/

Ali



Re: Name That Technique!

2017-02-07 Thread deadalnix via Digitalmars-d

On Saturday, 4 February 2017 at 23:54:12 UTC, David Gileadi wrote:

That's obviously a self important lookup.


This. So much this.


I'm afraid you are the only one who appreciate my humor :)


Re: Name That Technique!

2017-02-06 Thread TheGag96 via Digitalmars-d

On Monday, 6 February 2017 at 11:03:32 UTC, Walter Bright wrote:

On 2/6/2017 12:45 AM, Dominikus Dittes Scherkl wrote:

But is this really worth an article?


It's ideally suited for an article. It's easy to grasp, and 
enables a very interesting idiom.


I personally think the idiom is neato and think it'd be a neat 
article! It could potentially inspire wonder in some non-D-users 
about the limitless possibilities of the language... Or scare 
some away. :V The idiom would pretty bizarre for newcomers lol.


Re: Name That Technique!

2017-02-06 Thread Mike Parker via Digitalmars-d
On Monday, 6 February 2017 at 09:39:25 UTC, Dominikus Dittes 
Scherkl wrote:

On Monday, 6 February 2017 at 09:00:43 UTC, Mike Parker wrote:
On Monday, 6 February 2017 at 08:45:45 UTC, Dominikus Dittes 
Scherkl wrote:



But is this really worth an article?


IMO, as something targeted at non-D users, yes.
Oh yeah? For bragging about how D uses modules and doesn't need 
global imports at all?


No, that's not quite my intent. There's an interesting story here 
beyond the feature itself that I believe makes for a good blog 
post. The majority of visitors to the blog are not D users and 
aren't going to be familiar with the details (like the different 
ways a module can be imported), so such an article needs to keep 
them in mind.


Re: Name That Technique!

2017-02-06 Thread Walter Bright via Digitalmars-d

On 2/6/2017 12:45 AM, Dominikus Dittes Scherkl wrote:

But is this really worth an article?


It's ideally suited for an article. It's easy to grasp, and enables a very 
interesting idiom.




Re: Name That Technique!

2017-02-06 Thread Dominikus Dittes Scherkl via Digitalmars-d

On Monday, 6 February 2017 at 09:00:43 UTC, Mike Parker wrote:
On Monday, 6 February 2017 at 08:45:45 UTC, Dominikus Dittes 
Scherkl wrote:



But is this really worth an article?


IMO, as something targeted at non-D users, yes.
Oh yeah? For bragging about how D uses modules and doesn't need 
global imports at all?
This is not my style and I didn't feel that not needing global 
imports is something to brag about - they are useful as an 
overview.
But with this new idiom .di-files are even more useless now - or 
really need to declare all the local imports to replace the lost 
overview.



A brief overview of D's module system, a description of the
problem & how the DIP was brought up to address it,
But I'm not an expert for this. Especially I was not aware of any 
problem and even didn't liked the DIP.



how the DIP was made irrelevant by the usage of features
every D programmer knows but so many failed to realize could
be used in this way...
Ok, this is the most interesting part. This is what having an 
idea is all about. Find new ways to put the things already there 
together. But hard to describe.

Maybe I'll give it a try.



Re: Name That Technique!

2017-02-06 Thread Mike Parker via Digitalmars-d
On Monday, 6 February 2017 at 08:45:45 UTC, Dominikus Dittes 
Scherkl wrote:



But is this really worth an article?


IMO, as something targeted at non-D users, yes. A brief overview 
of D's module system, a description of the problem & how the DIP 
was brought up to address it, how the DIP was made irrelevant by 
the usage of features every D programmer knows by so many failed 
to realize could be used in this way... lots of meat for a post 
there.


I'd be happy to publish something like that on the D Blog.


Re: Name That Technique!

2017-02-06 Thread Dominikus Dittes Scherkl via Digitalmars-d

On Friday, 3 February 2017 at 23:33:58 UTC, Walter Bright wrote:

On 2/3/2017 11:14 AM, Andrei Alexandrescu wrote:

On 2/3/17 10:41 AM, Daniel N wrote:
On Friday, 3 February 2017 at 14:43:01 UTC, Dominikus Dittes 
Scherkl wrote:
DIP 1005 provides new syntax to make it possible to avoid 
global imports.

Any thoughts?


I like it!
Wow. This is... brilliant. Thanks for the great idea. I ran a 
few tests and it
seems to be doing out of the box most of what we want with 
DIP1005 with no

language change at all.

Congratulations!


I agree, it's pretty dazz! We need to give this technique a 
memorable name (not an acronym). I thought "Voldemort Types" 
turned out rather well, whereas CTFE is klunky, UFCS is even 
worse. The absolute worst is C++ SFINAE.


Any ideas?

  Scherkl-Nielsen Lookup?

The perfect bikeshedding moment!

Daniel, Dominikus: please consider writing an article about 
this.

Thank you all that you like the idea.
I found myself using this idiom quite some time now in my 
libraries but only recently realized, that it is the reason why I 
didn't found DIP1005 too compelling - I just didn't need it 
because of my workaround.
So I thought I should share the idea - and Daniels extension 
makes it much easier to use. Have to update my libs with that :-)


But is this really worth an article?



Re: Name That Technique!

2017-02-05 Thread Daniel Nielsen via Digitalmars-d
On Saturday, 4 February 2017 at 14:57:59 UTC, Andrei Alexandrescu 
wrote:

On 2/3/17 6:33 PM, Walter Bright wrote:
Daniel, Dominikus: please consider writing an article about 
this.


That would be indeed very very useful. -- Andrei


Okay, I will. However I currently have some obligations which 
demand my full attention, I estimate having a first draft ready 
by next weekend.


Daniel



Re: Name That Technique!

2017-02-04 Thread David Gileadi via Digitalmars-d

On 2/3/17 5:00 PM, deadalnix wrote:

On Friday, 3 February 2017 at 23:33:58 UTC, Walter Bright wrote:

I agree, it's pretty dazz! We need to give this technique a memorable
name (not an acronym). I thought "Voldemort Types" turned out rather
well, whereas CTFE is klunky, UFCS is even worse. The absolute worst
is C++ SFINAE.

Any ideas?

  Scherkl-Nielsen Lookup?

The perfect bikeshedding moment!

Daniel, Dominikus: please consider writing an article about this.


That's obviously a self important lookup.


This. So much this.


Re: Name That Technique!

2017-02-04 Thread Andrei Alexandrescu via Digitalmars-d

On 2/3/17 6:33 PM, Walter Bright wrote:

Daniel, Dominikus: please consider writing an article about this.


That would be indeed very very useful. -- Andrei



Re: Name That Technique!

2017-02-04 Thread Andrei Alexandrescu via Digitalmars-d

On 2/3/17 6:50 PM, Ali Çehreli wrote:

On 02/03/2017 03:33 PM, Walter Bright wrote:


On 2/3/17 10:41 AM, Daniel N wrote:



auto fun_time(imp!"std.datetime".SysTime tm)



We need to give this technique a memorable name (not an acronym).


If it's going to stay "imp" (which I initially found confusing; How
about "Import"?), "the imp idiom" might do but imps have a very
insignificant appearance in Harry Potter. (There are "Pepper Imps sold
at Honeydukes in Hogsmeade".)

Ali


https://github.com/dlang/druntime/pull/1756 -- Andrei



Re: Name That Technique!

2017-02-03 Thread Nick Sabalausky via Digitalmars-d

On 02/03/2017 06:50 PM, Ali Çehreli wrote:

"the imp idiom" might do but imps have a very
insignificant appearance in Harry Potter.


But they have much significance in Doom :)

...part of which takes place on Phobos ;)


Re: Name That Technique!

2017-02-03 Thread deadalnix via Digitalmars-d

On Friday, 3 February 2017 at 23:33:58 UTC, Walter Bright wrote:
I agree, it's pretty dazz! We need to give this technique a 
memorable name (not an acronym). I thought "Voldemort Types" 
turned out rather well, whereas CTFE is klunky, UFCS is even 
worse. The absolute worst is C++ SFINAE.


Any ideas?

  Scherkl-Nielsen Lookup?

The perfect bikeshedding moment!

Daniel, Dominikus: please consider writing an article about 
this.


That's obviously a self important lookup.


Re: Name That Technique!

2017-02-03 Thread Ali Çehreli via Digitalmars-d

On 02/03/2017 03:33 PM, Walter Bright wrote:

>> On 2/3/17 10:41 AM, Daniel N wrote:

>>> auto fun_time(imp!"std.datetime".SysTime tm)

> We need to give this technique a memorable name (not an acronym).

If it's going to stay "imp" (which I initially found confusing; How 
about "Import"?), "the imp idiom" might do but imps have a very 
insignificant appearance in Harry Potter. (There are "Pepper Imps sold 
at Honeydukes in Hogsmeade".)


Ali



Name That Technique!

2017-02-03 Thread Walter Bright via Digitalmars-d

On 2/3/2017 11:14 AM, Andrei Alexandrescu wrote:

On 2/3/17 10:41 AM, Daniel N wrote:

On Friday, 3 February 2017 at 14:43:01 UTC, Dominikus Dittes Scherkl wrote:

DIP 1005 provides new syntax to make it possible to avoid global imports.
Any thoughts?


I like it!

template imp(string mod)
{
  mixin("import imp = " ~ mod ~ ";");
}

auto fun_time(imp!"std.datetime".SysTime tm)
{
  return tm;
}

void main()
{
  import std.stdio;
  import std.datetime;

  fun_time(Clock.currTime()).writeln;
}


Wow. This is... brilliant. Thanks for the great idea. I ran a few tests and it
seems to be doing out of the box most of what we want with DIP1005 with no
language change at all.

Congratulations!


I agree, it's pretty dazz! We need to give this technique a memorable name (not 
an acronym). I thought "Voldemort Types" turned out rather well, whereas CTFE is 
klunky, UFCS is even worse. The absolute worst is C++ SFINAE.


Any ideas?

  Scherkl-Nielsen Lookup?

The perfect bikeshedding moment!

Daniel, Dominikus: please consider writing an article about this.