Time to destroy Walter: breaking modules into packages

nazriel spam at dzfl.pl
Thu Jun 6 07:53:37 PDT 2013


On Wednesday, 5 June 2013 at 22:31:21 UTC, Andrei Alexandrescu 
wrote:
> https://github.com/D-Programming-Language/dmd/pull/2139
>
> Andrei

I had a spin[1] with it long before Adam Wilson made it so 
popular topic. Feature was frequently mentioned on IRC as 
desired. Unfortunately I faced few holes in both Martin's and 
Andrei's DIPs and gave up on implementing it.

Few issues I remember were:

---

module std.datetime.core;
class Foo {}

module std.datetime.calendar;
class Foo {}

module std.datetime;

public import std.datetime.core;
public import std.datetime.calendar;

module usage;

import std.datetime;

Foo x; // is it std.datetime.core or std.datetime.calender?

// ok workaround..
std.datetime.Foo x; // same issue as above

std.datetime.core.Foo x; // works atleast

---

My point is, are directions Jonathan wants to go are right?
I think std.datetime.Foo shouldn't be available.

I remember also having some issues with ambiguous symbols. I had 
more corner cases in IRC Logs, but can't find it now.

Also I see we are going with Andrei's DIP route.
It is worth noting that Martin's one may have some additional 
functionality.

Like glueing modules. Ie.

---

module std.net;

public import std.net.http;
public import std.net.uri;

shared(Uri) uri = new shared(Uri);

---

In Martin's proposal uri symbol is reachable via
std.net.__init__.uri in case of ambiguous. In Andrei's it is 
unreachable due to package being keyword.

I am glad Walter is tackling it, because it is really useful 
feature, but please take a chill pill and rethink all corner 
cases.

[1] https://github.com/nazriel/dmd/tree/dip16++



More information about the Digitalmars-d mailing list