On Wed, 04 Feb 2015 06:59:52 +0000, Ola Fosheim Grøstad wrote: > On Wednesday, 4 February 2015 at 05:20:30 UTC, ketmar wrote: >> there. i still can't see what's wrong with `@attribute("inline")`, >> `@attribute("force_inline")` and so on. ah, except it breaks one of the >> first rules in The Book Of D: "try to escape uniformity whenever it is >> possible". > > Using pragmas for inlining is common in compilers for other clean > languages (Ada, Haskell). > > Unless inlining affects the ability to use functions as actual > parameters it is not part of the language and therefore a pragma, > but I agree that the pragma syntax is ugly, but "@attribute" is also > ugly. > > Maybe better to reserve "@_word" so that they cannot be used for UDA and > let all pragmas start with "@_": > > @_inline(0) // never, inline_weight*0 => 0 @_inline(1) // default, > inline_weight*1 => inline_weight @_inline(Inf) // always, > inline_weight*Inf => Inf @_inline // same as @_inline(Inf)
using `@attribute("...")` is ugly, but it has the advantage of simple workarounding for compilers that still not supporting that attribute. plus, it allows things like `@attribute("...") { ... }` or `@attribute ("..."):` on module level, whereas `pragma` isn't. as for uglyness... it's too late to thing about this. one more, one less... ;-)
signature.asc
Description: PGP signature