Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: Computer Language Question

From:tim talpas <tim@...>
Date:Wednesday, November 27, 2002, 14:58
#
# >On Tue, Nov 26, 2002 at 05:57:02PM -0500, Erich Rickheit KSC wrote:
# >> H. S. Teoh wrote:
# >> > Wait till you see a badly-written Perl script. ;-)
# >It doesn't. It just has number markings. Or, more precisely, it has
# >"grammatical gender", which is what $, @, and  really are. And it's not
# >the first language to do this, too. Applesoft BASIC, from the old days,
# >suffixed string variables with $. I forget if it explicitly marked
# >numerical variables, but I wouldn't be surprised if it did.
# Old basics had something like $ for a string, % for a boolean, & for a
number... here it is some kind of gender marker. A$ is a string variable which
has nothing to do with A%
#
# Perl is different. thoses afixes do not indicate the nature of the variable,
but the way you want to use it. the SAME variable takes $ if accessed as a
whole, or @ for accessing as a list (in which case you can access its
elements), or % if it is accessed as a hash. It definitly refer to the same
entity, but with different aproches. To call this gender do not seems
appropriate. But case marker either. Because it can always act as an "object"
of the "verb". So we are on something different. But i can not think of what
feature of human languages could be considered similar.
#


This really isn't right. $foo in perl can be used independely from @foo,
and %foo. They are not the same variable.

The difference comes when you access single array: $foo[0], or hash: $foo{bar},
elements... The difference now lies in the suffix. By using the curly brackets
 {}, perl knows you're referencing the hash %foo, not @foo or $foo.

(though perl doesnt seem to complain much if you reference @foo[0], but that's
rather redundant)

If anything, perl makes a distinction between singular and plural. Or
maybe individual and whole would be better terminology, in addition to the
hash/string/array difference.


-tim
http://www.zece.com/conlang/