[Arg. My outgoing mail was messed up last week when I sent out a whole bunch of emails just before leaving for Hawaii, so this message was very delayed.]
On Feb-24, K Stol wrote: > Hello, > > As Lua is a typeless language, variables can take values of any > type. This has to be checked during runtime, obviously. My guess is > that variables should be implemented on parrot as PMC's. I have > tried to read as much as possible on PMC's, but it's still a bit > unclear. > What I have understood is that PMC's are like C unions, but all > fields are accessible (or something like that). Not really. PMCs are really anything other than an int, a float, or a string. They all implement a common set of operations in a way that makes sense for the datatype they represent -- so the add operation for a complex number PMC, for example, would add the real and imaginary parts together. > Are there any good tutorials on PMC's somewhere? I looked in the > mailing lists, but I couldn't find much there. The most relevant documentation for PMCs is in docs/vtables.pod. Knowing to look there requires you to know what a PMC is and even something about how it's implemented, which isn't very nice. We really ought to have a pointer to it somewhere. You will want to implement variables and values with PMCs, but the names of the variables will be elsewhere, in a symbol table. The best pointer I can give you for that right now is the "Symbol table ops" section of docs/core_ops.pod. Although it's possible that you can manage your own compile-time symbol table and never need to look up names at runtime; I'm guessing Lua is too dynamic for that, but I don't know.