value_types + struct+types = decimal

Sam Ruby rubys at
Sat Oct 16 14:34:40 PDT 2010

I'm pleased to see value_types discussed again:

It is my belief that value_types[1] and struct_types[2] are sufficient 
to build a pure ECMAScript implementation of Decimal.  Such an approach 
would solve a number of problems:

(1) Ubiquity.  Making Decimals a required feature was controversial 
within the committee.  Anything less would hamper adoption.  Making the 
implementation in ECMAScript and having that implementation only depend 
on value_types and struct_types, then the implementation effectively 
becomes as ubiquitous as those two features.

(2) Format.  A number of committee members objected to 754R as a format. 
  Those that wish to pursue their own formats would be welcome do to so.

The only key requirement that this is not known to satisfy is:

(3) Performance.  While we were not expecting hardware level 
performance, something approximating C-level performance was the goal.

Mitigating that is:

(3a) ECMAScript implementations have improved dramatically since this 
was last evaluated.  The expectation is that this trend will continue. 
And given the expected use case for struct_types, it is especially 
likely that that feature will be implemented with performance in mind.

(3b) Not all users have the same performance requirements.

(3c) A stable implementation written in C with a liberal license[3] 
continues to be available.  This will always be an option for 
enlightened browser vendors with an interest in performance.

Given those mitigating factors, I am quite willing to proceed with the 
above approach, and would strongly encourage the committee to consider 
adopting the value_types proposal, and to not make any design decision 
which would preclude struct_types from being considered as a value_type.

- Sam Ruby


More information about the es-discuss mailing list