DIP56 - inlining

via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 3 22:59:52 PST 2015


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)


More information about the Digitalmars-d mailing list