[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Project lead nominations for standard libraries?
- From: "David J. Slate" <dslate@...>
- Date: Mon, 3 Jan 2011 11:59:16 -0600
Just to clarify my post on the '#' operator:
This wasn't a "gotcha" for me, since I did read the manual, rather
than just relying on my intuition. I enjoy reading programming
language reference manuals, and have been doing so for instruction and
entertainment for several decades.
The '#' operator is fine as it is, and I'm certainly not suggesting
that it be changed at this point. However, if I were designing a
language from scratch to fit in Lua's "niche", then I would have
specified this "length" operator differently.
Issues with the '#' operator stem from Lua's insistence that all data
structures be represented as associative tables, with any
optimizations for particular uses of tables (such as lists and arrays)
done behind the scenes. But that is one of Lua's features that I
really like. I'm a big fan of Lua's syntactic and semantic
simplicity, which helped me to get up to speed quickly to make
productive use of it.
-- Dave Slate
On Mon, 03 Jan 2011 15:41:29 +0100 Henning Diedrich <email@example.com> wrote:
> Hi Dirk,
> On 1/3/11 10:38 AM, Dirk Laurie wrote:
> > On Sat, Jan 01, 2011 at 10:23:17PM +0200, David J. Slate wrote:
> > Your intuition belongs to tables with no anonymous items.
> I don't think you could explain somebody's intuition back to him.
> If you have to explain, it's no Harley.
> > You are allowed to override __len for such tables.
> Thanks! But that's not the point in the first place in my view.
> For me, I was concerned about people working on a level
> were they will not get in touch with such subtleties and
> should not need to bother.
> > People do read the reference manual, don't they? Surely? :-?
> For the case presented, as far as I see, this point is mute if
> we are talking about intuition, not knowledge.
> You are correct after the fact - for learned, decent, well
> behaving, manual studying programmers who do all their
> home work before writing their code.
> The reason intuition is an allowed term in discussions of
> languages is that people are fallible and time not available
> in abundance to everybody.
> You read something, you try to remember it and if it runs
> counter your intuition you are likely to get it wrong.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://vlists.pepperfish.net/cgi-bin/mailman/private/lua-l-lists.lua.org/attachments/20110103/8df34ee5/attachment-0001.htm
On Sat, 1 Jan 2011 14:23:17 -0600 "David J. Slate" <firstname.lastname@example.org> wrote:
> For what they're worth, I thought I would add my impressions to all
> the other posts about the '#' operator:
> My particular point of view is that of a relative Lua newbie, since
> I've only used Lua extensively for the last 18 months or so. On the
> other hand, I'm not a computer newbie; having programmed computers for
> more than 48 years, I've seen and used a lot of different hardware and
> OS platforms, and several programming languages, of which I would
> judge Lua to be the nicest I've encountered so far.
> When I first saw how the '#' operator applied to tables, it seemed a
> bit of an anomaly. In a language as elegant as Lua, I expected a
> single-character core operator like '#' to have a simple, general, and
> intuitively predictable meaning when applied to the data types for
> which it's relevant. As applied to strings it does, returning
> unambiguously the length of the string. But applied to tables, it
> produces a sensible result only for arrays or lists with integer
> indices beginning with 1 and without "holes". Intuitively, I would
> have expected a "length operator" as applied to an associative table
> to produce a count of its keys, regardless of what kind of table it
> was. There could of course be an appropriately-named function that
> worked like '#' actually does.
> Note that this is just my aesthetic sense reacting, and perhaps
> someday varieties in taste regarding programming languages will be
> explained by genetic differences (I wonder what strange combination of
> genes could lead to an appetite for Perl!).
> -- Dave Slate