Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generating runtime type information.


Congratulations everyone! you get to rebuild as we break ABI
again!

We now generate type descriptions for variadic types, and push
a pointer to the variadic arguments on to the stack when we call.
The valist code currently ignores this, and does nothing useful
with it -- this should be fixed.

In other words, if you have a variadic function f:

	const f : (a : int, b : byte[:], ... -> void)

and you call it like this:

	f(1, "asdf", 'c', "blah", false)

you will get, on the stack:

	[
	1	: int,
	"asdf"	: byte[:], 
	argtype	: byte#
	'c'	: char,
	"blah"	: byte[:],
	false	: bool
	]

The argtype will be a binary encoded description of the types
of the tuple (char, byte[:], bool)

This means that you can write (admittedly, slightly hairy) code
to parse out the types passed in for variadics, and write code
that looks like:

	const pack : (vals : ... -> byte[:])

One goal that I would like to support is making std.fmt()
callable as such:

	std.fmt("%: list contains %\n", 1, [1,2,3][:])


-- 
Ori Bernstein <ori@xxxxxxxxxxxxxx>

Follow-Ups:
Re: Generating runtime type information.Ryan Gonzalez <rymg19@xxxxxxxxx>
Re: Generating runtime type information.Ryan Gonzalez <rymg19@xxxxxxxxx>