limbo array/list pick adt assignment discrepancies, pick adt leakage, and (pick) adt assignment

Issue #194 new
Former user created an issue

Original issue 194 created by inferno-os on 2009-07-22T15:38:00.000Z:

just tested with the latest inferno from hg (333:85e747cf56ef).

i ran into problem 1 quite some time ago. now that i looked closer i found a few other things. i'll dive into the compiler to see if i can come up with a patch in a few days.

# problem 1

cannot assign array of ref pickadt to an array of ref adt.  the
same with lists instead of arrays does work.  you can go through a
"direct tuple" representation though.  or is the assignment unsafe?
i doubt it.

$ limbo -gw testpa0.b
testpa0.b:24: type clash in 'a' of type array of ref A = 'b' of type array
of ref A.B
$


# problem 2

pick adt members leak across adt's.  testpb0.b and testpb1.b are
identical except that adt C's pick member is called D in testpb0.b
and B in testpb1.b (the same as A's pick member).  the case for
arrays is already denied, but the case for lists is wrongly (i
think) allowed in testpb1.b.

$ limbo -gw testpb0.b
testpb0.b:25: type clash in 'la' of type list of ref C = 'lb' of type list
of ref A.B
testpb0.b:29: type clash in 'a' of type array of ref C = 'b' of type array
of ref A.B
$

$ limbo -gw testpb1.b
testpb1.b:29: type clash in 'a' of type array of ref C = 'b' of type array
of ref A.B
$

# problem 3

you can assign across ref adt and direct ref tuple when their member
types are the same (and the other way around), but you cannot directly
assign across compatible adt's.  probably intentional.  but compatible
pick adt's _cannot_ be assigned through a tuple with compatible
types.  it feels like a mismatch.

perhaps adt's shouldn't be assignable to matching tuples.  or perhaps
pick adt's should also be assignable to matching tuples.  the latter
makes more sense to me:  it's nice that you can assign different
but matching adt's, but that you have to go through the trouble of
"casting" it through a tuple.  the same holds for pick adt's.

# testpc0.b assigns a ref adt A to a ref adt B through a tuple with the
same types.  works.
$ limbo -gw testpc0.b
$

# testpc1.b does the same, but with the adt's being pick adt's.  it fails.
$ limbo -gw testpc1.b
testpc1.b:27: type clash in 'la' of type list of ref A.B = 'lt' of type
list of ref (int, int)
testpc1.b:33: type clash in 'a' of type array of ref A.B = 't' of type
array of ref (int, int)
$

hope this makes sense.

Comments (3)

  1. Log in to comment