[Yhc] Some suggested changes to Yhc.Core

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Aug 7 06:29:51 EDT 2007


Tom Shackell <shackell at cs.york.ac.uk> wrote:

> As far as I know the FFI doesn't stipulate what you might have as a 
> calling convention but it suggests all implementations should support 
> "ccall" and "stdcall" where they make sense.

Yes, the FFI spec explicitly allows you to name any calling convention
you care to think of, but states that if you use "ccall" or "stdcall",
then the contents of the literal string must conform to the FFI spec for
ccall/stdcall, and of course do the right thing.

So you are free to develop any new calling convention, like
"javascript", and to define what is permitted in the literal string for
that convention.  Ideally, if defined fully, this could later be added
to the FFI spec to ensure that any other Haskell implementation that
chooses to allow "javascript" would follow the same convention.

nhc98/yhc already has the extra non-standard calling conventions "cast"
and "noproto", whilst Hat has "haskell"(!) as an FFI convention.

> Well the parser would need to be modified to understand 'javascript', 
> perhaps the best way to do that is to say that any identifier is fine.

Actually, I think it would be better just to add the single new name
"javascript".  It's pretty easy, and allows us to represent the
convention using an enumerated type internally, rather than just a
String.  Types are one of the reasons we like Haskell, aren't they?

> If I remember correctly the 'external name' is just treated as a
> quoted  string and can be anything you want so "new Data.getTime"
> should be  parsed fine at the moment.

Indeed.

Regards,
    Malcolm


More information about the Yhc mailing list