D import idiom compilation time

Jonathan M Davis newsgroup.d at jmdavisprog.com
Tue Jan 8 20:41:06 UTC 2019


On Tuesday, January 8, 2019 7:40:47 AM MST Johan Engelen via Digitalmars-d 
wrote:
> On Tuesday, 8 January 2019 at 13:39:48 UTC, JN wrote:
> > On Monday, 7 January 2019 at 21:50:20 UTC, Andrei Alexandrescu
> >
> > wrote:
> >> This is pretty awesome.
> >>
> >> Since the implementation would (initially at least) be
> >> private, the presence of "from" in documentation would be
> >
> >> awkward. So I suggest the glorious hack:
> > I am probably in minority here, or I am misunderstand the
> > purpose of this feature, but wouldn't such stuff be better put
> > somewhere around the compiler/frontend rather than in the
> > library with compile-time magic?
>
> FYI: at the end of last year Eyal (Weka) and Andrei (and me a
> little bit) have been discussing lazy importing (full import) of
> symbols by the compiler. We hope to have a student work on this.
> Indeed I agree with you: the compiler could do (some of) this
> stuff, and because the rewards seem large it makes sense to
> indeed have the compiler do it.

Yeah, Walter has expressed interest in having lazy imports in the past (e.g.
he talked about it when Liran was complaining about importing issues at
dconf a few years ago). So, if it were implemented, I wouldn't expect it to
have much trouble getting merged. Personally, I've argued every time this
sort of solution has come up that it's incredibly ugly and tedious and that
we should just do lazy imports if possible, because they would cleanly fix
the compilation times without requiring such verbose workarounds. But of
course, someone has to actually do the work of implementing lazy imports.

- Jonathan M Davis





More information about the Digitalmars-d mailing list