[jhc] misleading comment

John Meacham john at repetae.net
Thu Mar 8 13:05:19 EST 2007


On Thu, Mar 08, 2007 at 05:45:17AM -0500, Isaac Dupree wrote:
> In jhc lib/base/Jhc/Monad.hs
> there is
> {- INLINE return, fail, (>>=), (>>) -}
> before class Monad.
> This looks like a pragma but doesn't have the # marks.
> Is it even possible to inline methods for a whole class (or is it meant
> for the instances defined in the file?), and if so, is that place or on
> lines inside the class's "where" clause the right place?

At some point I was experimenting with the idea of being able to inline
class methods and it was possible at some point. in practice it turned
out to be a hassle and didn't buy much and that comment is a remenant
from that time when I was turning it on and off. Once a class method is
specialized though, it is beneficial to inline and that happens pretty
much automatically. 

Currently you can't specify INLINE attributes for
instances directly, but the aggressive inlining does it anyway as they
most often turn out to be small functions or primitives. it would be a
fairly straightforward fix. in the front end you would just need to
notice when an INLINE is applied to a class instance method and
translate it to an INLINE on the appropriate Instance at .method.type
instance name via FrontEnd.Class.instanceName. 

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the jhc mailing list