Klaas-Jan~

On 1/20/06, Klaas-Jan Stol <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I tried to index aggregates using several types of keys (that is,
> several types of values), and it seems only string and integer values
> can be used as keys. A quick look at the source in
> compilers/imcc/symreg.c confirms this, there is no case for 'N' values
> (and a test makes Parrot say build_key: unknown set).
>
> Will it be possible to use floating points as keys for arrays? It's up
> to the PMC to implement the indexing correctly, so support for this by
> IMCC should be no problem, I think.
>
> (I vaguely remember myself asking this sort of question before, quite
> some time ago, but I couldn't find it anywhere in the mail archives --
> sorry about that)
>
> The reason for this question is LuaTable PMC, which can be used as both
> an array as well as a Hashtable. I'd like to implement proper Lua Table
> behaviour into the LuaTable PMC, but it should be able to cope with code
> like this:
>
>     $P0 = new .LuaTable
>     $P1 = new .LuaNumber
>     $P1 = 42
>     $P0[1.234] =  $P1
>
> And this currently doesn't work, as mentioned above. (According to the
> PDD on keys, it should be possible to do this:
>
>         op arg, P1[12.34] # Constant number key - handled as constant key

I am not sure how wise an idea this is given the difficult of
comparing floating point numbers for equality.

Matt
--
"Computer Science is merely the post-Turing Decline of Formal Systems Theory."
-Stan Kelly-Bootle, The Devil's DP Dictionary

Reply via email to