flattening

Stephen Weeks sweeks@intertrust.com
Thu, 13 May 1999 13:50:45 -0700 (PDT)


> I'm confused about the last paragraph.  I agree that it is surprising that
> you can eliminate tuples entirely once you go to N-ary functions and
> constructors, but it seems that to avoid blow up (in the sense of unbounded
> extra allocation) you need to know that dynamically you don't use it in
> such things.  Not statically.

Yes.  But the static count ensures that the data flow of a tuple never
"splits" into two different paths, which is enough to guarantee the
dynamic property.

> Also, you inc the count on selects?  This would seem to break
> 	fun z =
> 	   let val x = #1 z	# first use of z
> 	       val y = #2 z	# z is now MANY
> 	       ...
> 
> Have I missed something?

Oops.  I misread the code.  In looking more closely, it carefully
avoids incrementing the count for Select expressions.  The count is
only incremented for Tuple, Known, Con, and Prim.