Specifying C++ symbols in C++ namespaces

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Sun Apr 6 13:41:52 PDT 2014


On Sunday, 6 April 2014 at 20:17:09 UTC, Walter Bright wrote:
> It's seriously wrong to allow such. It makes a larger code base 
> nearly impossible to reliably reason about, leading one to rely 
> on conventions like "don't add stuff to namespaces".

Depends on how it is done. For BETA, there was a seperate 
"fragment system" that allowed AST specified extension points. 
This system was used for both extensions and for 
encapsulation/API definition. You basically defined "slots" in 
the syntax three where code could be injected (following the 
grammar of the slot) and what should be hidden etc. It was 
simplistic elegance IMO:

http://www.cs.au.dk/~beta/Manuals/latest/beta/fragment.html

The weakness was that they didn't allow for dynamic dispatch 
(required static resolution), but that was an implementation 
issue, I think.


More information about the Digitalmars-d mailing list