Dan Sugalski wrote:
>
> I'm not sure. Given the mushy state of my brain at the moment, that doesn't
> ring any bells. Details? (Keeping in mind I'm not on the PDL list)
>
> Dan
>
Here it is again
It is "radical"
Note this is purely my idea - some PDL people like it. But's I am
deliberately NOT tieing it to PDL.
Karl
=head1 TITLE
Queen of Hearts proposal for variables in Perl.
=head1 VERSION
Maintainer: Karl Glazebrook <[EMAIL PROTECTED]>
Date: 8 August 2000
Version: 1.00
Mailing List: [EMAIL PROTECTED]
Number: ??
=head1 ABSTRACT
This RFC proposes that C<$x>, C<@x>, and C<%x> be ditched and
replaced with one thing.
=head1 DESCRIPTION
Back in the days of yore, Larry had a dream of a simple
typeless language. Variables were 'things', they could
hold numbers or strings, and manipulated without much
caring. The only important distinctions were whether they
were lists of things or hashes of things for which was
introduced the compact notation of C<@> and C<%>. Perl4 was
the anti-object-oriented language in an age when there
were Real Computers and Bill Gates was still trying to
flog BASIC.
Those days are gone. Perl 5 introduced the idea of Objects
and now any variable can be one of ten million possible
types all of very different behaviours.
Also in modern programming, lists are not longer simple
lists, neither are hashes, we have multidimensional arrays,
FIFO stacks, LIFO stacks, semi-infinite lists, etc. Basically there
are innumerable ways of containing things and they are usually
represented by objects.
I argue in this Brave New World the distinction between C<$x>, C<@x> and
C<%x> are no longer useful and should be abolished. We might want
to use all kinds of array objects, why should @x be special?
A RFC by Andy Wardley proposes `Highlander Variable Types' (`there can
only be one'). My proposal goes further: 'Queen of Hearts variables'
('off with their heads').
There should be NO C<$x>, C<@x> and C<%x>. This would make for
a simplification of the language with extreme prejudice.
=over 4
=item The weak Queen of Hearts proposal:
All variables should be C<$x>. They should behave appropriately
according to their object types and methods. ARRAY objects
and HASH objects would provide methods (inline, optimised
of course) to make $x[42] and $x{Fred} do the right thing.
See the pdl-porters RFC on 'default methods' for elegant
ways to do this.
=item The strong Queen of Hearts proposal:
All variables should be C<x>. This would make perl more like
Python and other languages. Some of the elegance of perl code
like
print "The answer is $x"
is lost though. The making of perl more like other langauges
may be desirable to some though.
=back
The author personally prefers the weak Queen of Hearts proposal,
as it keeps perl, well perl. The strong Queen of Hearts proposal
is mentioned for completeness.