Re: Computer Language Question
From: | Erich Rickheit KSC <rickheit-cnl@...> |
Date: | Tuesday, November 26, 2002, 22:57 |
H. S. Teoh wrote:
> Wait till you see a badly-written Perl script. ;-)
> [Disclaimer: I like Perl.]
Actually, I think Perl is interesting, as it's the only programming
language I'm familiar with that has case markings.
(discussion simplified for non-programmers - Perl fans, don't give me grief)
Variables have three numbers in Perl:
scalar, indicating a single value; marked with a '$' prefix
list, indicating an ordered list; marked with a '@' prefix or '[ ]'
hash, indicating an unordered list of pairs; marked with a '%'
prefix or '{ }'
To use the variable in a different number, you change the prefix
@foo represents the entire array 'foo'
$foo[7] represents a scalar ($), the seventh element of the list
'foo' ( [] )
%bar represents the entire hash 'bar'
$bar{bletch} represents a scalar, the element of the hash 'bar' ( {} )
associated with the word 'bletch'
@bar{'a', 'b', 'c'}
represents a list (@) of the elements of the hash
'bar' ( {} ) assocatied with 'a', 'b', and 'c'
I understand that this is slated to change in the next major version
of Perl, and that the case markers '$ @ %' are going to become
fosilized part-of-speech markers, and be considered part of the
variable name.
If I may digresss somewhat, I find the development of Perl also
interesting from sociological point of view. The notion of a
programming language is to take advantage of humans' talent in
manipulating languange to control a machine. In doing so, we bring
with it the use of language as a group identity. People boast about
the superiority of their favored language (though we can demonstrate
mathematically that essentially all languages are equally powerful),
and they develop complicated and abtruse idioms to show off their
cleverness, and to reinforce their membership in an in-group.
For example, in years past, Perl enthusiasts spent a lot of energy
in evangelizing their language, working to get it established as
an important tool and a standard part of the Unix/internet toolbox.
Now that they've suceeded, they are constructing a new version of
Perl, much more complicated than earlier versions, more difficult
to use for people not already familiar with the Perl way of doing
things.
I don't think much of anyone is doing this deliberately; I think
it's a sort of inevitable outcome of trying to use human language
skills without taking into account their human context. Language
is for communicating; that also means that its for not-communicating;
for separating them from us. This is one of the answers to Elgin's
riddle of why Láadan vanished but tlhIngan became immensely popular.
Erich
Replies