Daniel Brockman <[EMAIL PROTECTED]> wrote:
> So what is my suggestion?  Obviously disallowing underscores
> and instead allowing hyphens would just replace one problem
> with an even worse problem (not only would there still be
> people who don't like hyphens, but it would alienate a large
> portion of the user base).  Therefore, to make the language
> more appealing (i.e., less alienating) to the group of
> people I am going to refer to as "Lispers", it's obvious
> that both characters should be allowed.

I see a few syntactic problems with this idea: the subtraction and
negation operators you already mentioned, but also the fact that
dashes are already used in package names to indicate version and
author (`class Foo::Bar-2.10-cpan:BRENTDAX;`).  I suspect that both of
these problems will be more troublesome than you might guess.

But there's a philosophical problem too.  This proposal is an instance
of what I'm going to call the "dimmer switch problem".

In American cars at least, virtually every control on a car's
dashboard has an immediate purpose and utility.  There are steering
controls (i.e. the wheel), cruise control settings, controls for
exterior lights, controls for the radio and air conditioner, and so
on; all of these need to be within easy reach of the driver, either
because he needs them to safely operate the car or because he's likely
to want to twiddle them while he's driving.

And then there's the dimmer switch, used to control the brightness of
the dashboard's lighting.  This is not something the driver often
changes, and it's not crucial to the car's operation.  A driver will
adjust it once if he bothers adjusting it at all.  It's there solely
because different people have different preferences for the
brightness, and there's nowhere else to put it.

Perl has a lot of different ways of doing things.  But if you examine
the design, you'll realize that they aren't mere cosmetic
differences--each form lends itself to different tasks.  For example,
`for`` and `map` are functionally equivalent, but implementing a
Schwartzian transform is much easier with `map`, and a large loop body
is much easier to visually parse with `for`.

A lot of the suggestions I see for Perl 6 are dimmer switches; they
add an option or two to better suit someone's tastes but don't add any
power to the language.  This is hardly the first case; the suggestion
a long time ago to use backtick as a subscript operator comes to mind,
but there have been many others.

Car designers, of course, are stuck with the dimmer switch: they do
need to provide some way to provide this feature to their customers,
and there are only so many ways to do it with a physical piece of
plastic and vinyl.  Language designers are luckier, though, and Perl 6
is better than most.

This feature can be added as grammar-modifying pragma.  If you want
the hyphen, simply type something like `use hyphens;` and you can use
hyphenated identifiers in the surrounding scope.  And unlike Ruby,
this will be easy to do unambiguously: just override the Perl 6
grammar's identifier rule.  All the edge cases will be resolved by the
longest token principle, so `foo-bar-baz` will be an identifier.

--
Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]>
Perl and Parrot hacker

Reply via email to