February 13, 2017
On Monday, 13 February 2017 at 21:04:05 UTC, Johan Engelen wrote:
> On Monday, 13 February 2017 at 20:09:45 UTC, Daniel Nielsen wrote:
>> 
>> I still suspect there will be a difference in real-world applications even with LDC.
>
> Why would you expect there to be a difference?
> Module ctors/dtors are still pulled in, regardless of the import being selective or not.
> What am I missing?
>
> Thanks,
>   Johan

Sorry, I misread your post. In Jack Stouffer test, main() was empty!

February 13, 2017
On 02/13/2017 06:28 AM, Mike Parker wrote:

> https://www.reddit.com/r/programming/comments/5tt33y/a_new_import_idiom_for_d/

I claimed there is a performance improvement in compilation. Can someone answer kibwen's question on this subthread please:


https://www.reddit.com/r/programming/comments/5tt33y/a_new_import_idiom_for_d/ddp6a4p/

Ali

February 14, 2017
On Monday, 13 February 2017 at 22:40:55 UTC, Ali Çehreli wrote:
> On 02/13/2017 06:28 AM, Mike Parker wrote:
>
>> https://www.reddit.com/r/programming/comments/5tt33y/a_new_import_idiom_for_d/
>
> I claimed there is a performance improvement in compilation. Can someone answer kibwen's question on this subthread please:
>
>
> https://www.reddit.com/r/programming/comments/5tt33y/a_new_import_idiom_for_d/ddp6a4p/
>
> Ali

I ran it a couple of times and just doing the following has a faster compile time:

   import std.datetime : SysTime;
   import std.traits   : isIntegral;

No difference in binary size as the article stated either, using dmd.

Anyways yes this is kind of cool and fascinating how it works, but that aside I hope I never see this used in phobos. Does anyone else feel this way?
February 14, 2017
On Tuesday, 14 February 2017 at 02:32:33 UTC, Jerry wrote:
> On Monday, 13 February 2017 at 22:40:55 UTC, Ali Çehreli wrote:
>> On 02/13/2017 06:28 AM, Mike Parker wrote:
>>
>>> https://www.reddit.com/r/programming/comments/5tt33y/a_new_import_idiom_for_d/
>>
>> I claimed there is a performance improvement in compilation. Can someone answer kibwen's question on this subthread please:
>>
>>
>> https://www.reddit.com/r/programming/comments/5tt33y/a_new_import_idiom_for_d/ddp6a4p/
>>
>> Ali
>
> I ran it a couple of times and just doing the following has a faster compile time:
>
>    import std.datetime : SysTime;
>    import std.traits   : isIntegral;
>
> No difference in binary size as the article stated either, using dmd.
>
> Anyways yes this is kind of cool and fascinating how it works, but that aside I hope I never see this used in phobos. Does anyone else feel this way?

I suspect you test something slightly different, I tested both on linux and windows, with dmd, ldc and gdc(not on windows).

time dmd slow.d
time dmd fast.d

====== Slow ======
import std.datetime : SysTime;
import std.traits : isIntegral;

void func(T)(SysTime a, T value) if (isIntegral!T)
{
    import std.stdio : writeln;
    writeln(a, value);
}

void main() {}

====== Fast ======
template from(string moduleName)
{
    mixin("import from = " ~ moduleName ~ ";");
}

void func(T)(from!"std.datetime".SysTime a, T value) if (from!"std.traits".isIntegral!T)
{
    import std.stdio : writeln;
    writeln(a, value);
}

void main() {}



February 14, 2017
On Tuesday, 14 February 2017 at 02:32:33 UTC, Jerry wrote:
> Anyways yes this is kind of cool and fascinating how it works, but that aside I hope I never see this used in phobos. Does anyone else feel this way?

Yes. +1
February 15, 2017
On 2/14/17 3:32 AM, Jerry wrote:
> Anyways yes this is kind of cool and fascinating how it works, but that
> aside I hope I never see this used in phobos. Does anyone else feel this
> way?

+1
Let's not make Phobos as scary as C++ STL.

---
Dmitry Olshansky

February 14, 2017
On Wednesday, February 15, 2017 00:01:42 Dmitry Olshansky via Digitalmars-d- announce wrote:
> On 2/14/17 3:32 AM, Jerry wrote:
> > Anyways yes this is kind of cool and fascinating how it works, but that aside I hope I never see this used in phobos. Does anyone else feel this way?
>
> +1
> Let's not make Phobos as scary as C++ STL.

Honestly, as hideous as functions signatures can get - particularly with heavily templated stuff, I think that the result tends to be far more understandable than the likes of the STL of Boost. That being said, I think that D function signaures are certainly pushing it as it is, and I don't think that the benefits of adding imports to them is worth the clutter that they add.

- Jonathan M Davis

February 15, 2017
On Tuesday, 14 February 2017 at 23:01:42 UTC, Dmitry Olshansky wrote:
> On 2/14/17 3:32 AM, Jerry wrote:
>> Anyways yes this is kind of cool and fascinating how it works, but that
>> aside I hope I never see this used in phobos. Does anyone else feel this
>> way?
>
> +1
> Let's not make Phobos as scary as C++ STL.
>
> ---
> Dmitry Olshansky

Honestly, after staring at C++ STL, I never imaged that the standard library of a language can be *readable* and *understandable* until I read phobos. Kudos to Walter, Andrei and contributors. I still believe that templated D code is much more readable and intuitive than templated C++ code.

Arun
February 15, 2017
On Monday, 13 February 2017 at 14:28:20 UTC, Mike Parker wrote:
> Daniel Nielsen put together a post describing the import idiom that came to light in a recent forum discussion regarding DIP 1005 [3]. The relevant links are at [1] and [2].
>
> [1] https://dlang.org/blog/2017/02/13/a-new-import-idiom/
> [2] https://www.reddit.com/r/programming/comments/5tt33y/a_new_import_idiom_for_d/
> [3] https://forum.dlang.org/thread/tzqzmqhankrkbrfsrmbo@forum.dlang.org?page=1

Thanks for writing this up, Daniel. Has become quite a nice article.
Next ›   Last »
1 2