[Yhc] Yhc.Core proposed change to primitives

Neil Mitchell ndmitchell at gmail.com
Wed May 2 09:53:39 EDT 2007


Hi,

I'm considering making a change to Yhc.Core that will effect
primitives and how they are handled. I think the change will make
everything simpler for everyone, but since this is an imcompatible
change, I thought I'd check first.

The current treatment of primitives is basically:

CorePrim String -- a call to a primitive

We also have CoreFunc's which are somewhat primitive, but thats a bit
variable throughout.

My proposed treatment is:

data CoreFunc = CoreFunc ...
                       | CorePrim {corePrimName :: String, corePrimArity :: Int}

Then CorePrim calls become standard CoreFun's.

What are the advantages of my proposal? Firstly, we have a list of all
CorePrim's which are used in the program, and reachability etc. works
on these as standard. Secondly, we currently have at least two ways
primitives show up, now we have just one.

Disadvantages? That Yhc --linkcore needs to magically insert a list of
bytecode primitives into the program. This is a disadvantage only for
the person writing --linkcore (i.e. me), but explains the original
reason why it got done this way.

I am happy to reimplement all of Yhc.Core that makes a distinction,
but obviously people will need to tweak their own things
appropriately.

Anyone any objections?

Thanks

Neil


More information about the Yhc mailing list