Import improvement

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 17 07:40:23 PDT 2012


On 10/15/12 9:30 PM, 1100110 wrote:
>>> I like what vibe.d did by having an import all file named d.d
>>>
>>> Therefore you can:
>>> import vibe.d;
>>>
>>> It's nice, it's clean, and I've blatantly stolen it for a few of my own
>>> projects.
>>>
>>
>> O_O .. That might be one of the worst things I've ever seen!
>> It doesn't even make sense. Is there actually a vibe.d file? And why
>> try to
>> make the import statement look like a source filename?
>
> There is a source/vibe/d.d file.
> The reason it is there is because vibe.d includes it's own main(),
> There is a source/vibe/vibe.d file, but that is there for you to roll
> your own main().
>
> Shrug. "import file.d;" <- actual name is file.d
> doesn't work, and it isn't designed to work like that. So unless you
> know nothing about how the import
> system works, it's not really a problem.
>
> And I would assume that it was done since the name of the project is
> "vibe.d".
>
> If this is the worst thing that you've seen, then I don't think you've
> seen golang.. Or javascript's underscore library...
> "_.each([1, 2, 3], function(num){ alert(num); });
> => alerts each number in turn...
> _.each({one : 1, two : 2, three : 3}, function(num, key){ alert(num); });
> => alerts each number in turn..."
>
> That might be one of the worst, most confusing things that I've seen.

Wondering what happens if one has a file called something.d.d and 
imports it as something.d.

Andrei


More information about the Digitalmars-d mailing list