equivariant functions

Bill Baxter wbaxter at gmail.com
Mon Oct 13 20:14:50 PDT 2008


On Tue, Oct 14, 2008 at 12:02 PM, Jeff Nowakowski <jeff at dilacero.org> wrote:
> Andrei Alexandrescu wrote:
>>
>> I agree. When considering keyword addition, I think we all should think
>> more about adding contextual keywords, which in the grand D tradition are
>> usually defined as keyword(contextual_keyword).
>
> Is there some reason why most languages don't use a reserved symbol for
> keywords, like prefixing them with $ or %?  Every language runs into the
> problem of wanting to add new keywords later on -- why don't new languages
> avoid this old problem?

As someone mentioned, Perl uses the opposite.  User identifiers are
prefixed with $ or @, keywords are bare.

I think the reason it's not used more commonly is just that the code
starts to look like line noise.

I've not seen a language where keywords are prefixed, but now that you
mention it, it does kinda make sense.  You only expect to have a few
dozen keywords, but the number of variables used in any given program
will be much much greater.  So if you're going to push one or the
other into a separate namespace, it seems more logical to do it to the
keywords, not the identifiers.

I think in Perl's case, Larry Wall thought that making the distinction
between scalars ($var) and arrays (@var) would be useful information
to always have right in your face like.

--bb



More information about the Digitalmars-d mailing list