Dan Sugalski wrote:
> =item if tx, X, Y
What's the purpose of providing Y? Does it make anything easier
allowing Y != 0?
> =item jump tx
I expected a "call" op too. Not a named sub call, but just "call
tx" where tx has the same semantics as in "jump".
A "return" op is needed too.
> =item iton Nx, Iy
> =item ntoi Ix, Ny
> =item tostring Sx, ty, Iz
Are these good names? They aren't very regular IMHO. Why is
integer abbreviated "i" and string left spelled out? Why does
tostring have three operands and the other two?
> =item inc tx, nn *
> =item dec tx, nn *
> Decrement register x by nn. nn is an integer constant. If nn is
> omitted, decrement by 1.
Variable length ops don't sound so cool to me. Why not use
add/sub to inc/dec by something other than 1?
Also, it would be nice if inc/dec *always* kept Parrot semantics
instead of automagically transmogrifying to Perl inc/dec. Is
this the plan?
> =head2 Register and stack ops
I'm a little confused why we can only push/pop entire register
frames. Won't this make function value returns via registers
impossible? IMHO, instead of push/pop a rotate command
would be nice. That would allow SPARC-like register usage which
has always seemed elegant to me.
> =item warp [string]
>
> Reset the current register stacks to the state they were in when the
> warp was set. Resets only the frame pointers, doesn't guarantee the
> contents of the registers. Be I<very> careful modifying the frame
> pointers by, for example, pushing register frames.
I don't understand this explanation. It sounds like you are setting
up co-routines or maybe resuming a continuation. Shouldn't the ops
be a little safer? IMHO we don't want a co-routine construction set,
we just want co-routines.
> =item find_lex Px, sy
>
> Find the lexical of name sy and store the PMC pointer in register Px.
You're expecting the current lexical scope to be carried implicitly
via the PC? Seems like find_lex should really be implemented as a
vtable method on a compiler's scope object.
> =item find_method Px, Py, tz
> =item call_method Px, ty
Multi-methods are notably absent. I'm assuming that Parrot does not
understand multi-methods and requires the object (or the compiler
generating the object) to register a multi-method dispatcher as the
single-dispatch method known to Parrot.
This only lets us use multi-methods where arg0 is an object. Is
this sufficient for implementing Perl 6?
- Ken