[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.2 custom array demo
- From: David Kastrup <dak@...>
- Date: Sat, 09 Jan 2010 18:37:01 +0100
steve donovan <firstname.lastname@example.org> writes:
> On Sat, Jan 9, 2010 at 6:27 PM, David Manura <email@example.com> wrote:
>> where "::" is basically like a "function()" but allows omitting
>> parenthesis in the call.
> Such a bit of sugar would also be useful with pcall.
> Actually, there's no reason to use rawget/rawset, instead just:
> function s.__newindex(t,i,val) t.store[i] = val end
> and so forth. Then t.store could be userdata.
> Now, it would be cool if table.concat was intelligent enough to
> understand such proxy arrays (i.e. use the overloadable ipairs, and
> use tostring where applicable) without much performance cost.
The art of getting a computer language off the ground, with all due
respect to Douglas Adams, should not be hurling it towards C++ and
The increasing "wouldn't it be cool if we could write one thing and let
it mean something almost, but not quite, entirely unlike what it looks
like" chants start worrying me. Should every sufficiently advanced
computer language be doomed to have its programs become
indistinguishable from magic?
How much coolness is actually uncool?
We are not just talking in a performance cost when every operation can
be made to mean something different. We are also talking a
comprehensibility cost. There is currently sufficient pressure to use
metatables in order to be able to "generalize" all sorts of syntactic
entities with a fixed meaning, unfixing their meaning.
The C++ type conversion mess appears to me to result from the "wouldn't
it be cool if we could create a user-defined complex type that
automatically fitted into C++' type conversion mesh with the same
automatic conversions that Fortran has" stipulation. With absolutely
awful results if you, say, use user-defined types for polynomials with
integral coefficients, or Galois fields on numeric types not compatible
with double arithmetic or a lot of other things.
It's one "wouldn't it be cool" after the other, and each one costs just
a little. And then we have the "wouldn't it be more consistent now"
phase which just costs a little. And then we are back to the "wouldn't
it be cool" phase.