On Sat 11 May 2013 06:48, Mark H Weaver <[email protected]> writes:
> I have only one comment for now, which regards arity information. The
> required/optional/rest representation is not sufficiently general. Not
> only is it unable to handle empty case-lambdas, but it's also unable to
> properly represent a case-lambda that can accept 1 or 3 arguments, but
> not 2.
I did think about this and I think I just didn't express myself well. I
said:
struct guile_arity {
Elf_Addr pc;
Elf_Off size;
nreq; // encodings for these not determined yet
nopt;
flags; // has-keyword-args, has-rest, is-case-lambda
Elf_Offset offset;
}
An entry describes how many required, optional, keyword, and rest
arguments a function has. The .guile.arities section is prefixed by a
length indicating how many entries there are, then all the arity
structures, sorted by pc. Note that one arity may contain another! In
particular for case-lambda clauses you can have one arity for the whole
function, then a number of other ones for the cases.
The case-lambda as a whole would get the is-case-lambda flag. The
arities of the clauses would follow and have their [pc*, pc*+size*]
within the [pc, pc+size] of the case-lambda entry.
I don't know whether to use the nreq/nopt/flags of the "outer" arity for
any purpose or not.
Cheers,
Andy
--
http://wingolog.org/