Compiler hints, inlining and syntax consistency

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Sat Dec 28 03:38:17 PST 2013


I think it would be useful to have a dedicated syntax for symbols 
that a naive compiler can ignore, that is, for compiler hints. 
I'd consider "@disable" and "pragma" a compiler hint, but not 
"@property"

I don't grasp the motivation for the naming of keywords in D. I 
think the syntax would be more clear if "@" was reserved for 
compiler hints.

Suggestions for compiler-hints that are useful and empowering:

@inline(fuzzylogic-expression){ }

Examples:

@inline some_function(){...}

@inline{
    while(...){ ...inline_all_inner_loop_statements... }
}

@inline(0) never-inline-this...
@inline(1) always-inline-this...
@inline(0.5) inline-if-compiled-to-not-conserve-memory-footprint


@warningonuse "some text"

length() @warningonuse "in this class the length-function is 
O(n), consider xyz instead"

The "@warningonuse" keyword enables text editors to emit symbols 
on the side of the text with helpful warnings about possible 
bottlenecks when using libraries.



More information about the Digitalmars-d mailing list