Curt H. wrote:
On 10/25/07, Charles Oliver N. <[email protected]
mailto:[email protected]> wrote:
frozen is another thing entirely, and it has good uses (locking down
strings and arrays so they can't be modified, for example).
Are extensions not able to ignore “frozen”, then?
No, extensions can pretty much do anything they want, which is why they
suck and why it’s nearly impossible for any non-C-based implementation
to ever support them.
Other than strings and arrays, it’s hard for me to see a compelling
reason for this feature. But then, my thinking is undoubtedly
influenced by Python, where strings are immutable and “frozen arrays”
are called tuples.
Even .NET and Java collection libraries provide ways to get immutable
collections; it’s similar to this. But regardless of whether you think
it’s useful, the important point is below…
More to the point of this list, though, how can you decide which
features of CRuby to ignore? It can’t just be a matter of overhead,
because the overhead for “taint” seems to be almost exactly the same as
that for “frozen” – both features require you to keep external
bookkeeping information for objects defined outside of Ruby when the
feature is used.
You can decide what features to ignore once you know what features are
needed for existing apps to run. For example…JRuby can run Rails and
just about anything else that’s pure Ruby, so we’ve been able to
determine that certain optimizations are safe and certain features can
be safely “unsupported”. It’s really, really hard to make that
determination before you can run nontrivial apps, but you can learn from
I’d say the only feature we gave up on early was continuations, and I
actually made a serious effort to support them until we discovered how
infrequently they were used in the real world. I shall miss my stackless
interpreter, slow though it was.