On Jan 13, 2006, at 10:20, François PERRAD wrote:
=head1 DESCRIPTION This test file describes an improvement for the directive .const when an HLL is using.
Not really - see below.
.const .Integer i = "12"
The Integer PMC implements the constructor "new_from_string", which is called at compile time to create a possibly constant PMC item with the given value. PMC constants are frozen/thawed as usual, and above just works. The .const pmc directive is just sugar for
set_p_pc Px, <pmc_constant>
.const .Sub _test = "_test"
A .Sub is a bit special, as the Sub PMC is already created, when a .sub directive is encountered during codegen. So this is again just a C<set_p_pc> opcode.
.const .LuaNumber n = "12.34"
I presume LuaNumber doesn't have new_from_string (Float hasn't either).
.const .LuaFunction _test = "_test"
Creation of Sub PMCs currently doesn't honor HLL mappings. There are a few hardcoded references of "Sub", "Closure", and "Coroutine" in the compiler and in packfile.c. These should be easily to spot. Explicit tests against enum_class_Sub need to be replaced by VTABLE_isa or _does.
leo