Compiler hints, inlining and syntax consistency
Jakob Ovrum
jakobovrum at gmail.com
Sat Dec 28 03:58:47 PST 2013
On Saturday, 28 December 2013 at 11:38:38 UTC, Ola Fosheim
Grøstad wrote:
> 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"
@disable is definitely not something a compiler should be allowed
to ignore.
> length() @warningonuse "in this class the length-function is
> O(n), consider xyz instead"
This is a terrible example - in D it's generally accepted that
such a `length` function should NOT be provided at all. If it
provides anything that standard algorithms like `walkLength`
don't, then it must at least be named something other than
`length`.
With this philosophy in mind and with the lack of any good
examples, I think it's possible that @warningonuse is in fact
undesirable.
More information about the Digitalmars-d
mailing list