Prodding by Matt Diephouse to generate documentation for two things:
- Things that partcl has done that might be considered hacks - things that will likely impair our ability in the distant future to cleanly do language interoperability.
- Things that partcl hasn't done yet at all because parrot makes them hard.
It is,
of course,
quite likely that said feature already exists with a nice interface,
and was just not found by the partcl developers - If you find something along these lines,
let them know on the internals list.
- subroutine meta information.
- Tcl provides the ability to query subroutines about their arguments and their code.
For example:
% proc sum {{a 2} {b 3}} {
return [expr $a + $b]
}
% sum
5
% info args sum
a b
% info body sum
return [expr $a + $b]
% info default sum a the_argument
1
% puts $the_argument
2
%
- Right now, partcl is using globals to store the argument list and the the body information. It would seem that we'd want to have a builtin mechanism for querying the subs directly rather than storing this information separately.
- user defined subs; parameter handling.
- Tcl provides nice exceptions for dealing with argument handling - to continue our example:
% sum a b c
wrong # args: should be "sum ?a? ?b?"
- Right now, this is handled inside the function definition - it is defined to take an arbitary number of args, and then is checked for correctness internally. It would be nice to have invoke() automatically figure this out and generate an exception that Tcl can use. (This also starts to drag in "how to do Tcl exceptions cleanly from parrot")
- stack depth
- Cheating and keeping a global around right now, so we can figure out if we should be using a global or a lexical (and if so, how far down or up).
- [trace]'ing
- There are two ways we can go about the tracing - either we can keep the information about the traces in a global, and check that global every time the appropriate action is taken; or, we can tie that information into the actual commands and variables. I think the latter would be somewhat cleaner, and, if any other languages support this feature, this would give us a chance to interoperate.
- list splicing
- There are several cases where we convert TclLists or ResizablePMCArrays to Arrays so that we can use the splice opcode. Need to have better splice support in parrot array classes, as well as our own. "commands/linsert.pir" in lib
- marshalling/unmarshalling
- When compiling, there is currently no easy way to embed a PMC that exists at runtime into the compiled code. Because of this, we have to interrogate the PMC at compile time for its type, and then handroll the appropriate PIR to intialize it's value. We should be able to freeze the PMC during compilation, And then have in the generated code
$P1 = thaw "..."
.