Very interesting, looking forward to reading the DIP.
Atila
On Friday, 9 January 2015 at 11:40:28 UTC, Dicebot wrote:
I think that push for more inference / WPO is an important goal
for D. However I had somewhat more radical and generic changes
in mind, ones that don't add new keywords or semantics but
rather strictly define what existing ones mean. This was
supposed to be turned into a DIP at some point (possibly after
consulting with Walter) but here is the draft outline:
- separate compilation in basic C sense becomes illegal
- minimal legal unit of separate compilation is defined as
static library
- any time library gets built, it _must_ be distributed with
matching .di interfaces. If there are original .d files
imported, one must not try to link prebuilt library.
- .di generation is split in two modes:
1) 'minimal' (API) which only writes exported symbols and
ignores even public ones. All inferred attributes gets written
explicitly there. This is what gets recommended for public
distribution (even if it is source-only distribution) and what
defines stable API.
2) 'full' mode which is similar to existing .di generation
but with all attributes explicitly written to all functions. It
is approach recommended for creating intermediate built
artifacts (such as dub building of dependencies).
Stability of (1) headers can be validated mechanically by
compiler / external tool in such scenario. As you may notice no
new keywords / language concepts are proposed, it is only about
more strict definition of standard development flow. It also
opens well-defined borderline for any WPO.
Needs a lot of work before any serious destruction of course
but should give some overall feeling of what I am going at.