add INLINEABLE to maybe, either, bool

wren at freegeek.org wren at freegeek.org
Fri Oct 11 23:14:58 UTC 2013


On 9/16/13 4:59 PM, Dan Burton wrote:
> I'm wary of "let's not mark it as INLINE because we want the compiler 
> to
> automagically inline it for us." This seems like saying we should not 
> have
> type signatures, because we want the type inferencer to figure it out 
> for
> us. (If you want to test the auto-inliner's wisdom, then just add a 
> setting
> that ignores INLINE pragmas and see if it inlines the same thing that
> humans do?)
>
> I don't really care how it's accomplished, but I do think that we 
> should
> make sure that maybe, either, and bool are inlined, and the most 
> obvious
> way to accomplish this is to directly mark them INLINE, is it not?

I almost wonder if there should be a SHOULD_INLINE pragma which does 
not actually change program behavior, but rather will emit warnings if 
the marked function does not end up in the interface file. (N.B., this 
is distinct from ensuring that we inline it at any particular 
call-site.)

The inliner is fairly robust at this point, but SHOULD_INLINE would 
also help catch regressions; I'm mainly thinking of base and core 
libraries here, rather than general libraries. Though, for general 
libraries, having the pragma could help folks learn what the inliner 
deems to be "small enough". I think it's clear *what* the inliner does; 
but it's not always clear *when* it will decide to do its magic.

-- 
Live well,
~wren



More information about the Libraries mailing list