value_types + struct+types = decimal

Sam Ruby rubys at intertwingly.net
Mon Oct 18 15:16:52 PDT 2010


On Mon, Oct 18, 2010 at 6:01 PM, David Herman <dherman at mozilla.com> wrote:
> Are you suggesting a) that struct types should always be value types, or b) some sort of extension to the binary data spec that allows the creation of immutable structs that are value types?
>
> I'm afraid a) just seems unworkable -- compound binary data needs to be mutable, and its sub-components really need to be selectable by reference, not by copying. If you meant b) (or something else), can you flesh it out a bit more?

Another possibility is that the current proposal labeled "value-types"
doesn't mention immutability :-)

My read of the so-called value-types proposal is that some (as of yet
undefined) mechanism which will cause some set of non-primitive
objects to override the default "call toString() and concatenate the
results" behavior for the plus operator.  That override would likely
be some form of double-dispatch.

That being said, if the immutability is a pre-requisite for
"value-types" (presumably in order to address the triple equals hard
case), and given that value-types was tossed out there as a potential
solution to the bignum requirement, can somebody sketch out how ===
would work for bignums?  My intuition is that any triple-equals
solution that works for bignums would also work for decimal.

> Dave

- Sam Ruby


More information about the es-discuss mailing list