new DIP47: Outlining member functions of aggregates

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Sep 9 20:02:18 PDT 2013


On Mon, Sep 09, 2013 at 10:09:51PM -0400, Michel Fortin wrote:
> On 2013-09-09 00:03:11 +0000, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> said:
> 
> >D's module system has always favored a file-granular approach,
> >e.g. private stuff is module-private. This notion of spilling
> >private access outside the file into methods defined in various
> >other files works against that nice tenet.
> 
> Is the D module system file-granular or module-granular? I always
> thought the later. Putting the implementation of functions in the .d
> file while the declarations are in the corresponding .di does not
> change things much: it's still one module, but it's one module split
> over two files.
> 
> It also helps solve another problem: the problem where you're
> shipping a library and want to force some things to not be inlined.
> This is needed if the library is to be swapped for another version
> without having to recompile all client code. You can do this
> currently by hand-crafting .di files, but it's a pain to keep it
> manually in sync with the .d file.
[...]

It would be nice if UDAs can somehow be used to mark functions as
don't-inline, so that dmd -H produces the correct .di file without
requiring manual maintenance.


T

-- 
Mediocrity has been pushed to extremes.


More information about the Digitalmars-d mailing list