Re: PERL as a first programming language?

Larry Wall (lwall@netlabs.com)
Wed, 27 Jul 1994 19:24:13 GMT

In article <RSANDERS.94Jul27011237@hrothgar.mindspring.com> rsanders@mindspring.com (Robert Sanders) writes:
: > In fact, most of the time, they aren't going to use references at
: > all.
:
: Really? Let's say I have a function that takes two lists. It's
: either going to take references or type globs, and references are the
: clear winner in most cases.

Most of the time a function isn't going to take two lists.

: I think it's always going to be confusing to people that argument
: passing coalesces all the arguments into one big list with no
: discernible boundaries.

Part of the reason it's confusing is that people have conflicting
expectations. Sometimes they expect lists to autointerpolate, and
sometimes they don't. I went for consistency in this particular case,
rather than trying to second-guess when the user expects what.

I think people will latch rather quickly onto the Perl5ism that backslash
means to protect the following thing from interpretation. It's so much
like how backslash behaves in the usual Unix string, and it's so much
like how ampersand behaves in C.

Of course, there will always be the people that just don't manage to
latch on at all, but they're not gonna latch onto Lisp or C either...

: I think there are very few languages like that. C++ is guilty, but I
: use many languages about which I don't know everything (obviously).
: Just for my information, could you tell me some of the others?

Well it's all a matter of degree, of course, but I'd tend to put Ada
and Icon in that category. C has tendencies that way which are amplified
greatly in C++. It's a tough call, actually, because whether some
subset of a language is easy to learn depends in part on the shared
cultural heritage of the language and the user, and in part on how
fascist the language designer is about making people do it "the right way".

I think Lisp does pretty well at this by the way. Language cultures
that are evolved rather than designed tend to do well here, because
there's always that pressure to make sure the old code works, and that's
going to be a cultural subset, unless there have been genocidal episodes.

: Hey, it's Perl. There's got to be more than one way to invoke
: methods. I really don't mean to bash Perl. I'm just trying to point
: out some of the nuances that might be unnecessarily interesting in a
: teaching language.

I don't disagree with you. There is value in learning theory, and there's
plenty of non-theory in Perl.

: Since we're on the subject of overloading, will there be a way to
: specify a function to give the string representation of an object?
: I'd like to be able to use simple interpolation (print "answer was
: $a") instead of some more explicit function call of a's print method.

As far as I can recall offhand, the proposed overloading module included
the capability of intercepting implicit conversions.

On the other hand, the folks looking at persistence say that the current
default string conversion of references is rather useful, and overloading
that might put a crimp in generality of a persistence package. I don't
profess to know the best answer here.

Larry