On Nov 29, 2005, at 15:08, Chip Salzenberg wrote:
Comments? Fresh or rotten vegetables?
My objections:
Consider:
P0 = P1
P0 = S1
P0 = I1
P0 = N1
o/~ One of these things is not like the others
One of these things just doesn't belong o/~
And if I have to read:
P0 = new .Integer
P0 = 1
one more time... *sigh*
- These 4:
P0 = P1
S0 = S1
N0 = N1
I0 = I1
All do exactly the same thing. They say "X0 register now contains the
same thing as X1 register". In the case of strings and PMC's these
"things" just happen to be pointers to something instead of a literal
value. That's the fundamental nature of the registers, not a matter
of syntax.
- These are different:
P0 = S1
P0 = I1
P0 = N1
because a vtable entry for that particular PMC decides what to do
with any operation. It could just as well be:
P0 XX S1
or
snarfblat P0, S1
but = is easy to type and the meaning is clear in the context.
- Linguistically speaking, you only want to create orthographic
distinctions when they represent meaningful contrasts. So, we use "s"
for plural in both "cats" and "dogs" even though one makes a 'ssss'
sound and the other makes a 'zzzz' sound. In the cases you mention:
P0 := P1 # aliasing: P0 and P1 point to same PMC
P0 := opcode # aliasing: P0 points to PMC returned by opcode
P0 = ... # assignment: modifies P0, NO MATTER WHAT '...' IS
S0 := S1 # aliasing: S0 and S1 point to same header
S0 := opcode # aliasing: S0 points to header returned by opcode
S0 = ... # assignment: modifies S0, NO MATTER WHAT '...' IS
The difference is not significant. The compiler knows what to do in
all cases even with only one symbol. The user also has no trouble
figuring out what's going on.
The only context where the difference is significant is if you were
trying to alias vs. assign the value of one PMC to another. You propose:
P0 := P1 # P0 and P1 registers contain the same pointer
P0 = P1 # copy the value contained by one PMC to another
different PMC, without copying structure
But the latter is rare enough that Huffman coding would argue for a
syntax more like:
P0 = P1 # P0 and P1 registers contain the same pointer
P0 = copy P1 # copy the value contained by one PMC to another
different PMC, without copying structure
- It's also annoying to introduce syntax that's useless in 50% of
possible cases. It's a waste of good operator symbols:
I0 := ... # ILLEGAL
I0 = ... # assignment: modifies I0
N0 := ... # ILLEGAL
N0 = ... # assignment: modifies N0
- It adds confusion to the language as users ask "which form of
assignment operator do I need here?", but unlike Perl 6, it doesn't
add enough benefit to PIR to be worth the cost.
- PIR is an assembly language not an HLL. This injects too much high-
level semantics into it.
Allison