Summary of current change suggestions

Marcin 'Qrczak' Kowalczyk mk167280 at students.mimuw.edu.pl
Thu Feb 22 06:33:54 EST 2001


On Thu, 22 Feb 2001, Simon Peyton-Jones wrote:

> I must say that I like Manuel's proposal below.

Please don't force to put header names in *every* foreign declaration!

For header names which are detected at configure time, we would have to
write forwarding headers in separate files and install them with the
package. When a header name changes from constant to not constant, every
reference to it must change. Because nobody wants to have #ifdef around
every foreign declaration.

This scheme is not quite open for future defaults, because if every
attribute has its own ad hoc syntax in the string, the way in which
local definitions are overridden by defaults cannot be described
language-independently.

Here is a more backwards compatible variant of my proposal:

foreign_decl ::= 'foreign' what foreign_name attributes
                     varid '::' prim_type
               | 'foreign' 'default' attributes
what         ::= 'import' | 'export' | 'label'
foreign_name ::= empty | string_literal
attributes   ::= empty | attribute attributes
attribute    ::= varid | varid string_literal

Attribute names to be defined now:
    'dynamic'
    'ccall'
    'stdall'
    'unsafe'
    'safe'
    'include'
In future:
    'java'
    the blocking issues
Uncertain what to do with:
    'noproto'

As a deprecated compatibility feature, calling conventions can also be
specified before the foreign_name, in which case a string following them
is not their argument but the foreign_name.

What I find ugly is that 'dynamic' does not really fit here. It changes
whether the name is created or exported (for foreign export), it does not
make sense as a default, it makes the presence of foreign_name illegal.

-- 
Marcin 'Qrczak' Kowalczyk







More information about the FFI mailing list