Mailing List Archive

"Line Noise" considered offensive (was Re: Proposal: ^HANDLE)
I read perl5-porters avidly (and comp.lang.perl.misc (but not
quite so avidly :-))
I rarely ever post or reply because I don't feel that I can contribute
much to the discussion that hasn't already been said. It is very unusual
that I feel strongly enough about something to let everyone know about it.

I've been using perl since version 3 and I have a real fondness for it.
I like the way perl has evolved so far but some of the things I have
been reading lately tend to make me a bit sad.

Tim Bunce said:
> Remember that one day we may have references to regex's. I hope we
> won't be arguing over assigning a line noise character for them.

Whenever people used the phrase "line noise" to describe perl, I
tended to think that they just didn't understand Perl.
The concept of placing the type one wanted from the RHS in the syntax of
the LHS of an assignment, for example, is something that I've always
thought was unique to perl and was a good thing (e.g. @x = &foo() vs.
$x = &foo()). I thought that to anyone who knew Perl, this could not
be considered line noise since it is so intrinsic to Perl.
It bothers me to hear respected people perpetuating the idea that perl
looks like line noise; people such as Tom and Tim most recently.
This is not meant to be a personal attack, btw. I'm sure you don't think
perl is line noise -- you would probably just rather see perl develop
into a less terse language and adding new "line noise" seems to be going
backwards perhaps (but I'll let you speak for yourselves).

I like the new object oriented features in perl5. Along with references
we can now do things simply that were previously very cumbersome to
implement in perl4.

One thing that always bothered me about perl4 was the handling of
filehandles using "bearwords". A filehandle (or dirhandle) seemed to
want to be a type of its own with its own syntax character and
I always just thought it to be an historical accident which no one was
ever bothered enough about to fix.

With respect to giving a filehandle a syntax character of it's own,
I find that I am more convinced by the arguments of Charles Bailey
(I hope I've spelt your name correctly) than anyone else.

Perl is about choices and I'm afraid that perl might be heading in
a direction that seeks to deny us those choices. Sure, we can all
write everything in the new wonderful object oriented perl5 way.
We can all "use English" from now on as well. But I think we might
be losing something. Isn't Perl meant to be Pathologically Eclectic,
anyway?

I will write my programs in well structured object-oriented perl5
but in my spare time I would still like to be able to write the
tersest most "line noisy" programs that I feel like. That's why I like
perl; because I can write in what ever style feels right at the time.

> So, rather than use $ref = \*STDIN; or add a new line noise character
> I'd like to see a new function something like $ref = io(*STDIN);

Again with the line noise... :-). Although, I'm probably in
the minority here, I would welcome the addition of more "line noise"
to signify instrinsic types such as filehandles, regexps, formats etc.
provided the characters involved were well thought out. That is Perl.

Thanks for reading this far since I've probably gone on for too long
but in summary: I think that removing historical inconsistencies and
smoothing some jagged edges in the existing (and much loved) language
is just as important in its evolution as moving in new directions.

-paul
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
Tom Christiansen said:
>
> > Again with the line noise... :-). Although, I'm probably in
> > the minority here, I would welcome the addition of more "line noise"
> > to signify instrinsic types such as filehandles, regexps, formats etc.
> > provided the characters involved were well thought out. That is Perl.
>
> then you would welcome more line noise for all built-in or user-defined types
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
> Again with the line noise... :-). Although, I'm probably in
> the minority here, I would welcome the addition of more "line noise"
> to signify instrinsic types such as filehandles, regexps, formats etc.
> provided the characters involved were well thought out. That is Perl.

then you would welcome more line noise for all built-in or user-defined types.
if i define a new class, i should define the line noise that specifies
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
> No. As I mentioned, I think I would stop with the _intrinsic_ types :-)

> Of course if you want to debate what is an intrinsic type, I think
> I will leave that to those more qualified than I am.

Intriniscs would seem to be filehandles, directory handles,
formats, maybe formlines, and maybe even labels. oh and globs.
that's far too many to add !@#$%^&*()_+-={}[]\|"':;?/><,.
line noise for. anyway, less punctuation is the way to go, not more,
with the caveat that barewords are ursine.

you know, if any place that opcode.pl wants an F we could -w check
that they didn't say <F>, it would help. all of my beginners always
say

if (eof ( <STDIN> ) )

open ( <FH>, $path )

myfunc ( <STDOUT> );

etc, which terribly hoses them.
a clean object based $fh system would solve
all these problems, but we still have to -w check the
old stuff.


--tom
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
> From: "Paul E. Maisano" <pem@aaii.oz.au>
>
> I've been using perl since version 3 and I have a real fondness for it.

As I do too.

> I like the way perl has evolved so far but some of the things I have
> been reading lately tend to make me a bit sad.

It has been getting a little wild lately :-)

> Tim Bunce said:
> > Remember that one day we may have references to regex's. I hope we
> > won't be arguing over assigning a line noise character for them.

> It bothers me to hear respected people perpetuating the idea that perl
> looks like line noise; people such as Tom and Tim most recently.

I use'd the term with a pinch of humour.

> One thing that always bothered me about perl4 was the handling of
> filehandles using "bearwords". A filehandle (or dirhandle) seemed to
> want to be a type of its own with its own syntax character and
> I always just thought it to be an historical accident which no one was
> ever bothered enough about to fix.

Or, I suspect, no one was able to invent a good enough fix (or even
have a good enough grasp of all the issues).

> With respect to giving a filehandle a syntax character of it's own,
> I find that I am more convinced by the arguments of Charles Bailey
> (I hope I've spelt your name correctly) than anyone else.

I don't feel as strongly about it as Tom. Charles and others arguments
have been good. On the other hand it is a big step and certainly
needs to be argued well. See below for an update on my view.


> Perl is about choices and I'm afraid that perl might be heading in
> a direction that seeks to deny us those choices. Sure, we can all
> write everything in the new wonderful object oriented perl5 way.
> We can all "use English" from now on as well. But I think we might
> be losing something. Isn't Perl meant to be Pathologically Eclectic,
> anyway?

I very much doubt that Larry would let that happen. I suspect that
Larry's strong but quiet hand on the tiller is what lets the collective
mind of the perl5-porters roam so freely. If we believed that every
idea we came up with was likely to appear in Perl the following day I
suspect (and hope :-) that we wouldn't be so free with our brainstorming.


> I will write my programs in well structured object-oriented perl5
> but in my spare time I would still like to be able to write the
> tersest most "line noisy" programs that I feel like. That's why I like
> perl; because I can write in what ever style feels right at the time.

I agree. In the changes from Perl4 to Perl5 Larry has been walking
a fine line between making programming-in-the-large more practical
and keeping perl's consise practicality. I greatly value both.


> > So, rather than use $ref = \*STDIN; or add a new line noise character
> > I'd like to see a new function something like $ref = io(*STDIN);
>
> Again with the line noise... :-). Although, I'm probably in
> the minority here, I would welcome the addition of more "line noise"
> to signify instrinsic types such as filehandles, regexps, formats etc.
> provided the characters involved were well thought out. That is Perl.

Given that a reference can be used anywhere that a file handle is used
I can only find two good reasons for adding ^ to Perl:

1) as a way to access the SVt_PVIO within a typeglob in order to create
a reference to it (rather than a reference to a glob using \*NAME).

Since this need only actually be used in a constructor something
other than a syntax character would be fine. Even something ugly
and long winded. (Hence the io() suggestion - not a serious one.)

2) as a file handle type specifier in prototypes.

This is very appealing but look closer, the real issue is actually
how to prototype the fact that you want a reference to a particular
type. FileHandle's are just one example. ^ won't do for that.

It _might_ be a useful practicality in some cases (like a shortcut for
a file handle in prototypes) but I don't think we _need_ to add it yet
without more thought.

> Thanks for reading this far since I've probably gone on for too long
> but in summary: I think that removing historical inconsistencies and
> smoothing some jagged edges in the existing (and much loved) language
> is just as important in its evolution as moving in new directions.

So do I. But if the language is to remain much loved we must not change
it without thinking beyond apparently simple fixes for current problems.

Tim.
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
> From: Tom Christiansen <tchrist@mox.perl.com>
>
> > No. As I mentioned, I think I would stop with the _intrinsic_ types :-)
>
> > Of course if you want to debate what is an intrinsic type, I think
> > I will leave that to those more qualified than I am.
>
> Intriniscs would seem to be filehandles, directory handles,
> formats, maybe formlines, and maybe even labels. oh and globs.

I think you forgot regular expressions. I'd love to be able to
pass around and store pre-compiled regular expressions.

Tim.
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
: The folks I teach are more than sufficiently unhappy with @ and & and
: %; I do my best to get them through. Adding ^FileHandle, |PipeHandle,
: =SocketHandle, !Dirhandle, and #Format isn't going to help them learn
: or use the language more easily.

This is not necessarily true. The psychological hump is that there are
"funny characters". Adding more entries to the funny character list is
not much of a psychological strain--in fact, people keep asking for
more funny characters. Chip is far from the first. These folks feel
that they're *regularizing* things by doing this. They have a valid
point. It might not be valid enough to get me to do anything about
it, but we should at least recognize the tradeoffs when we take them.
That's why this discussion is so valuable.

: Having some well defined object class for these things, plus a smooth
: integration to the odd derived classes like STDIN etc, would do so.
: How to make this jive with the F type in opcode.pl and also with
: LArry's prototype prototype is certainly a challenging notion, however,
: and wild speculation (brainstorming) is a fine way to try to come up
: with a solution. I'm sure Larry will keep it tasteful. The last
: language feature I argued with Larry about was "and" and "or" en lieu
: of the old C line-noise mechanisms. Having just come from the REXX
: symposium, LArry thought de-emphasising line-noise was a good idea, and
: that's a direction we've been moving.

A frequently quoted quote of mine that appeared about the same time is:

I do worry about visual clutter, and have done so since the day my daughter
came in, looked over my shoulder and said, "What is that, swearing?"

Of course, as I type this, I'm wearing the munitions t-shirt, with RSA in
4 lines of Perl. :-)

Larry
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
: The folks I teach are more than sufficiently unhappy with @ and & and
: %; I do my best to get them through. Adding ^FileHandle, |PipeHandle,
: =SocketHandle, !Dirhandle, and #Format isn't going to help them learn
: or use the language more easily.

This is not necessarily true. The psychological hump is that there are
"funny characters". Adding more entries to the funny character list is
not much of a psychological strain--in fact, people keep asking for
more funny characters. Chip is far from the first. These folks feel
that they're *regularizing* things by doing this. They have a valid
point. It might not be valid enough to get me to do anything about
it, but we should at least recognize the tradeoffs when we take them.
That's why this discussion is so valuable.

: Having some well defined object class for these things, plus a smooth
: integration to the odd derived classes like STDIN etc, would do so.
: How to make this jive with the F type in opcode.pl and also with
: LArry's prototype prototype is certainly a challenging notion, however,
: and wild speculation (brainstorming) is a fine way to try to come up
: with a solution. I'm sure Larry will keep it tasteful. The last
: language feature I argued with Larry about was "and" and "or" en lieu
: of the old C line-noise mechanisms. Having just come from the REXX
: symposium, LArry thought de-emphasising line-noise was a good idea, and
: that's a direction we've been moving.

A frequently quoted quote of mine that appeared about the same time is:

I do worry about visual clutter, and have done so since the day my daughter
came in, looked over my shoulder and said, "What is that, swearing?"

Of course, as I type this, I'm wearing the munitions t-shirt, with RSA in
4 lines of Perl. :-)

Larry
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
> pem wrote:
> > Remember that one day we may have references to regex's. I hope we
> > won't be arguing over assigning a line noise character for them.


It's probably because I teach this to people who are looking at it from scratch,
as opposed to this audience, which is just looking at agglutination of detritus.
The folks I teach are more than sufficiently unhappy with @ and & and %; I
do my best to get them through. Adding ^FileHandle, |PipeHandle, =SocketHandle,
!Dirhandle, and #Format isn't going to help them learn or use the language more
easily. Having some well defined object class for these things, plus a smooth
integration to the odd derived classes like STDIN etc, would do so. How to
make this jive with the F type in opcode.pl and also with LArry's prototype prototype
is certainly a challenging notion, however, and wild speculation (brainstorming) is
a fine way to try to come up with a solution. I'm sure Larry will keep it tasteful.
The last language feature I argued with Larry about was "and" and "or" en lieu of
the old C line-noise mechanisms. Having just come from the REXX symposium, LArry
thought de-emphasising line-noise was a good idea, and that's a direction we've been
moving.

--tom
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
I just resubscribed to perl5-porters, and whooeee, mail's a flying! I
probably missed some stuff on this topic, but I can't restrain myself
from suggesting:

How about having bareword access for variable names the same as for
function names? That might make the data type "line noise" characters
optional. If a variable is declared:
my @arr;
or maybe
my list arr;
then you could use it:
arr[0] += 123;
if ( arr ){ ... }

It never did make sense to me to allow allow the same symbol name to be
reused for different data types.

If you declare a symbol, you know what it is, and so does the
compiler. You could do stuff like
my filehandle FH;
my socket SOCK;
new Socket(SOCK);
and not increase the clutter in the subsequent code with ^FH or =SOCK.

This wouldn't break perl4 scripts. It would make perl5 scripts much
more palatable to newcomers, advancing the Cause. However, now that
perl5 has references, dereferencing might become confusing:
my $var = \$othervar;
...
${var} # doesn't deref.
v.s.
${$var} # does
$${var} # does

Hmm. It also wouldn't provide a mechanism for variable interpolation
inside double quotes, but that's not too terrible, since bareword format
would be optional.

Anyway, maybe it's a silly idea, but it seems like the framework is in
place for something like this, which makes it worth suggesting.

-Eric
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
> : The folks I teach are more than sufficiently unhappy with @ and & and
> : %; I do my best to get them through. Adding ^FileHandle, |PipeHandle,
> : =SocketHandle, !Dirhandle, and #Format isn't going to help them learn
> : or use the language more easily.

> This is not necessarily true. The psychological hump is that there are
> "funny characters". Adding more entries to the funny character list is
> not much of a psychological strain--in fact, people keep asking for >
more funny characters. Chip is far from the first. These folks feel >
that they're *regularizing* things by doing this. They have a valid >
point.

So then the problem is again the syntactic bump of barewords, yes? I
wonder how in the best of all possible worlds and perfect hindsight you'd
do it over again. I know you thought very hard about the whole $ and @
and % thing when coming up with references, but ended up leaving it all
intact so that perl5 wouldn't be a whole nuther language and incompatible
with perl4. Perahps otherwise we'd have ended up with something more like
python {with curlies :-}.

--tom
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
On Wed, 18 Oct 1995, Larry Wall wrote:

> : The folks I teach are more than sufficiently unhappy with @ and & and
> : %; I do my best to get them through. Adding ^FileHandle, |PipeHandle,
> : =SocketHandle, !Dirhandle, and #Format isn't going to help them learn
> : or use the language more easily.
>
> This is not necessarily true. The psychological hump is that there are
> "funny characters". Adding more entries to the funny character list is
> not much of a psychological strain--in fact, people keep asking for
> more funny characters. Chip is far from the first.

I don't see the major aesthetic differences between saying "Your
filehandles should be capitalised as that makes understanding your code
much easier" and "Your filehandles should have a '<insert symbol of choice
that that's supposed to be a filehandle."

Both ways you alter the naming scheme of the variable you use as the
filehandle. However, the second way you tell the interpreter "This is a
Filehandle, *not* a bareword."

> These folks feel
> that they're *regularizing* things by doing this. They have a valid
> point.

"So that's a regular variable because it has a '$' in it."
'Yes. Now what does this '%' mean?'
"Oh, that's an associative array."
'And the '@'?'
"That's a regular array."
'What about this variable all in CAPS?'
"Uhhh. . . . It could be a filehandle, but what's the symbol that's
supposed to go in front of it?"

Once you get used to the idea that different kinds of variables have
different line noise in front of them it's not that big of a step to
accept more.

--
Dylan Northrup * northrup@pobox.com * http://onyx.slu.edu/dylan.html
My views are my own and do not reflect the views of SLU, the Department
of Neurosurgery, or the Journal of Image Guided Surgery unless otherwise
stated. I make HTML pages, not policy :-) * Ask me about e-mail POBoxes
---------------
Random B5 Quote
---------------
"Love? Pah. Overrated. Here, these are my three wives: Pestilence,
Famine and Death. Do you think I married them for their personalities?
Their personalities could shatter entire planets! Arranged marriages,
every one, but they worked out. They inspired me. Knowing that they
are waiting at home for me is what keeps me here -- 75 lights years away."
-- Londo (to Vir), "The War Prayer"
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
Tom Christiansen writes:
> The last language feature I argued with Larry about was "and" and "or" en lieu of
> the old C line-noise mechanisms. Having just come from the REXX symposium, LArry
> thought de-emphasising line-noise was a good idea, and that's a direction we've been
> moving.
>
> --tom
>

In fact (for me) there are two odious features of Perl: line noise and
broken object syntax. Thanks for Tom and syntax highlight (;-) I may
manage the first now, but
PLEASE PLEASE PLEASE
fix the second one! The parser is broken now...
We need warnings if having function prototyped would change
the syntax, we need to be able use parentheses in object call syntax
and get what we want (or a warning if it will break existing code) (I
do not mean object slot here, I mean arguments), we need
print OBJECT
to work.

I posted several most frustrating examples to the list some time ago,
but can never reconstruct them on will :-(

Ilya
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
> Once you get used to the idea that different kinds of variables have
> different line noise in front of them it's not that big of a step to
> accept more.


Ok. I'd like the variables of type CGI::Request to please have the
line-noise type of *--* premended, as in

*--*req = new CGI::Request;

like, why not? :-)

Oh, cuz :-) is the Funny::HaHa type, of course.

--tom
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
Tom Christiansen writes:
| > Again with the line noise... :-). Although, I'm probably in
| > the minority here, I would welcome the addition of more "line noise"
| > to signify instrinsic types such as filehandles, regexps, formats etc.
| > provided the characters involved were well thought out. That is Perl.
|
| then you would welcome more line noise for all built-in or user-defined types.
| if i define a new class, i should define the line noise that specifies

Hmm. I think there's a (possibly intentional?) semantic split occurring here.
I think we need to make a clear distinction between 'type' and 'class'. I
realize that's anathema in the pure OO paradigm, but Perl's not pure OO, and I
think that these concepts are (mostly) orthogonal in Perl. 'Type' is an
attribute that's defined in Perl's internals, while 'class' is at the
programmer's disposal. 'Type' is used to determine how to allocate a value,
and what intrinsic operations can be performed on that value. 'Class' is used
to determine where to find a function associated with that value. Operator
overloading and tying provide bridges between these continua, but they're not
really unified. I'd argue that

package Foo;
sub new { my($pkg) = ref($_[0]) or $_[0]; bless {}, $pkg; }
sub whoami { print ref($_[0]),"\n"; }

doesn't return an object of type Foo, it returns an object of class Foo but
type reference to hash. To illustrate the distinction I'm trying to make,
I'll propose an alternate implementation:

package Foo;
sub new { my($pkg) = ref($_[0]) or $_[0]; bless [], $pkg; }

In both cases, the sequence

$obj = new Foo;
$obj->whoami;

will print "Foo", but in the first case,

$obj->{SOMEKEY} = 1;

is legal, while

$obj->[0] = 1;

is not, and the reverse is true in the second case (barring tying which
implements an array as a hash or vice versa).

It's with this distinction in mind that we're suggesting that we add a type
designator for I/O-associated values. Absent the ability to refer to the type
directly, one's ability to use the parts of Perl which intrinsically care about
'type' is limited. It's possible to emulate a notion of type using class
structure, but that incurs a performance penalty for the repeated runtime
traversals of @ISA to "check type", and would also have to be worked back into
internal operators. There are other advantages to having direct access to
intrinsic types, as have been mentioned in this discussion, as well as prior
discussions of "promoting" regexps and formats in a similar fashion.

I agree completely with you that it'd be a mistake to associate every
user-defined class with a prefix designator, but I think that the use of
intrinsic type designators both makes the sytax flow more cleanly and
makes the code more readable.

Hmm -- lots of "I think"s up there; I hope they're well thought out. :-)
If I'm being unclear, please let me know, and I'll try to explain
my ideas more coherently.

Regards,
Charles Bailey bailey@genetics.upenn.edu
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
Tim Bunce writes:
| Given that a reference can be used anywhere that a file handle is used

At the risk of starting another argument, I'll state that I'm not sure this
is a good idea. Allowing refs to typeglobs to serve wherever a filehandle
could is part of the current hack to work around absence of a true I/O
type, and runs contrary to Perl's handling of other references. In general,
Perl's pretty strict about not automatically dereferencing things on you;
filehandles are the sole case in which reference == thing. This does
have a certain stdio-ishness about it, since we're used to using a FILE *
in the same way we use ints, for instance, but it strikes me as
something of a bump in otherwise level Perl syntax. (This could be
taken as an indication that the current approach to I/O handles
isn't natural.) Given an IO type, I'd rather that \^io not
be the same as ^io, in the same way that \$scalar isn't the same
as $scalar. For compatibility, we'd probably need to allow \*handle
as a functional equivalent to ^handle, though I'd certainly suggest
it be deprecated.

| I can only find two good reasons for adding ^ to Perl:
|
| 1) as a way to access the SVt_PVIO within a typeglob in order to create
| a reference to it (rather than a reference to a glob using \*NAME).
|
| Since this need only actually be used in a constructor something
| other than a syntax character would be fine. Even something ugly
| and long winded. (Hence the io() suggestion - not a serious one.)
|
| 2) as a file handle type specifier in prototypes.
|
| This is very appealing but look closer, the real issue is actually
| how to prototype the fact that you want a reference to a particular
| type. FileHandle's are just one example. ^ won't do for that.

I'd add two more:

3) as a way to create a new IO value.

Whether via ^, or "io", or some other syntax, we need a way
to generate a SVt_PVIO without juggling SVt_PVGVs.

4) as a way to tell that a value is has an IO "association".

This is related to your point 2), in that I don't think one
often wants a reference to a particular class. An indication
that one can perform I/O via that value is sufficient; the
specific class can handle the particulars. Here's a (fairly
contrived) example:

sub tellval {
my($self,$route) = @_;
if (ref($route) eq 'CODE') {
&$route($self->nexthunk) while $self->moredata;
}
elsif (ref($route) eq 'SCALAR') {
$$route = '';
$$route .= $self->nexthunk while $self->moredata;
}
elsif (ref($route) eq 'ARRAY') {
push(@$route, $self->nexthunk) while $self->moredata;
}
elsif (ref($route) eq 'STREAM') {
print ^$route $self->nexthunk while $self->moredata
}
}

In this case, I don't really care whether $route is of class
FileHandle, Socket, ViaSatellite, or WithBellsAndWhistles,
as long as I can print to it. (I realize that this example
is also running close to the ambiguity in C<ref> between
returning basic type information and class information;
this is a limitation of C<ref>, IMHO -- it's more OO than Perl.)
OTOH, in executing

sub shiftsat {
my($self) = @_;
$self->{SAT} = 'ComSatII' if $self->{SAT} eq 'Telsat';
. . .
}

I do care that $self is of class ViaSatellite, but I'll usually
let the method call mechanism take care of that for me. It's
the "basic" operations that need intrinsic type info.

Regards,
Charles Bailey bailey@genetics.upenn.edu
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
Larry wrote, in response to TomC:
> : The folks I teach are more than sufficiently unhappy with @ and & and
> : %; I do my best to get them through. [...]
>
> This is not necessarily true. The psychological hump is that there are
> "funny characters". [...]

I agree. This is similar to teaching someone vi. I've known many vi users,
some long term, who think vi has a funny collection of one and two letter
commands. Once the underlying model is explained (two modes, command +
region, etc), it becomes a lot easier to both learn, understand, and use.

There is often a trade-off between the following points:

* clarity of model & philosophy, conceptual integrity,
and thus (I think) ease of use once you've learned it

* ease of learning.

though these aren't mutually inclusive. If you get the first one right,
then the second shouldn't be hard, as long as you're learning according
to the model etc underlying it. For example, vi is harder to learn if
you're just taught a bunch of commands, rather than taught the underlying
stuff first.

neilb
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
> I just resubscribed to perl5-porters, and whooeee, mail's a flying! I
> probably missed some stuff on this topic, but I can't restrain myself
> from suggesting:
>
> How about having bareword access for variable names the same as for
> function names? That might make the data type "line noise" characters
> optional. If a variable is declared:
> my @arr;
> or maybe
> my list arr;
> then you could use it:
> arr[0] += 123;
> if ( arr ){ ... }
>
> It never did make sense to me to allow allow the same symbol name to be
> reused for different data types.

I'm gonna crawl out of the woodwork just long enough to say NO! NO!
NO!, don't change this! 'Cause once you've gotten used to it, this
feature is indispensable.

And while I'm at it, I'd like to cast my vote in favor of line
noise. I can't imagine why anyone familiar with the language would
choose to use the English module over 'line noise'. And, if Tom finds
his students complain about this, he could offer to teach them COBOL
instead ;-)

> If you declare a symbol, you know what it is, and so does the
> compiler. You could do stuff like
> my filehandle FH;
> my socket SOCK;
> new Socket(SOCK);
> and not increase the clutter in the subsequent code with ^FH or =SOCK.
>
> This wouldn't break perl4 scripts. It would make perl5 scripts much
> more palatable to newcomers, advancing the Cause. However, now that
> perl5 has references, dereferencing might become confusing:
> my $var = \$othervar;
> ...
> ${var} # doesn't deref.
> v.s.
> ${$var} # does
> $${var} # does
>
> Hmm. It also wouldn't provide a mechanism for variable interpolation
> inside double quotes, but that's not too terrible, since bareword format
> would be optional.
>
> Anyway, maybe it's a silly idea, but it seems like the framework is in
> place for something like this, which makes it worth suggesting.

--
Jim Anderson Phone: (201)524-4076
Lehman Brothers, Inc. Fax: (201)524-5153
101 Hudson Street, 34th Floor E-mail: jander@lehman.com
Jersey City, NJ 07302 jander@jander.com
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
Larry Wall writes:
>
> : We need warnings if having function prototyped would change
> : the syntax, we need to be able use parentheses in object call syntax
> : and get what we want (or a warning if it will break existing code) (I
> : do not mean object slot here, I mean arguments), we need
> : print OBJECT
> : to work.
>
> I don't understand what you mean here.
>

One example of broken object syntax was posted today:
method $obj (@args);
with
print OBJECT
I meant
print $OBJECT @data;

This call may be pessimized so that the object syntax is tried only
if $OBJECT is not a FileHandle (whatever it is).

Ilya
Re: "Line Noise" considered offensive (was Re: Proposal: ^HANDLE) [ In reply to ]
According to Tom Christiansen:
> Anyway, less punctuation is the way to go, not more [...]

That doesn't sound like a design principle, but a religious tenet.
And in the Church of Perl, that makes you a heretic. ;-)
--
Chip Salzenberg, aka <chs@nando.net>
"Hey, it's the Miss Alternate Universe Pageant!"
-- Crow T. Robot, MST3K: "Stranded In Space"
Re: references to REs (was Re: Line Noise) [ In reply to ]
According to Tim Bunce:
> I think you forgot regular expressions. I'd love to be able to
> pass around and store pre-compiled regular expressions.

Sure, but globs don't contain regexps, so there's no need for a
punctuation mark. All you need is another suffix character:

$ref = /howdy/r;

Then you can do:

if ($var =~ $ref) { print "Pardner!\n"; }

--
Chip Salzenberg, aka <chs@nando.net>
"Hey, it's the Miss Alternate Universe Pageant!"
-- Crow T. Robot, MST3K: "Stranded In Space"
Re: references to REs (was Re: Line Noise) [ In reply to ]
> From: Chip Salzenberg <chs@nando.net>
>
> According to Tim Bunce:
> > I think you forgot regular expressions. I'd love to be able to
> > pass around and store pre-compiled regular expressions.
>
> Sure, but globs don't contain regexps, so there's no need for a
> punctuation mark.

Good point. s/regular expressions/formats/g.

> All you need is another suffix character:
>
> $ref = /howdy/r;
>
> Then you can do:
>
> if ($var =~ $ref) { print "Pardner!\n"; }

Nice.

Tim.
Re: references to REs (was Re: Line Noise) [ In reply to ]
> > From: Chip Salzenberg <chs@nando.net>
> >
> > According to Tim Bunce:
> > > I think you forgot regular expressions. I'd love to be able to
> > > pass around and store pre-compiled regular expressions.
> >
> > Sure, but globs don't contain regexps, so there's no need for a
> > punctuation mark.

> Good point. s/regular expressions/formats/g.

> > All you need is another suffix character:
> >
> > $ref = /howdy/r;
> >
> > Then you can do:
> >
> > if ($var =~ $ref) { print "Pardner!\n"; }

> Nice.

Ah, flashbacks into again.

We talked about this aq good bit a ago. Larry was
going to use a switch, but now he's more interested in having a
pair of o-o dimes instead, as it were.

--tom

1 2 3 4  View All