Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Apocalypse 12 (whitespace)

by Abigail-II (Bishop)
on Apr 19, 2004 at 19:56 UTC ( #346445=note: print w/replies, xml ) Need Help??

in reply to Re^2: Apocalypse 12 (whitespace)
in thread Apocalypse 12

The closest example to this that I've run into is extremely close. When Perl changed the interpretation of "print (" to be the same as "print(", I found that the problems clearly increased, and stayed up even long after the change. So I enthusiastically support Perl6's idea to not allow whitespace in a few key places where whitespace has no good reason to be.
When was that, in the perl4 era? As far as I can remember, print has behaved the same as any other function, allowing you to have whitespace between the function name and the opening parenthesis - except that 'print' will whine if you actually use parenthesis (if you have warnings turned on, and haven't disabled the warning).
$ cat tye print (3 + 4) * 5; print "\n"; print(3 + 4) * 5; print "\n"; $ /opt/perl/5.000/bin/perl tye 7 7 $
If it was different in perl4, then I'm sure glad that in perl5 we don't have exceptions in the parsing of functions/arguments depending on the function name.

Note that in perl1 different results are printed - but at least they are consistent:

$ /opt/perl/1.0.0/bin/perl tye 35 35 $

Putting whitespace between a hash and the '{' makes as much sense to me as wanting to write "10 . 45 e - 12" because it is "easier to read" (no, actually wanting spaces in some numbers makes more sense to me)
Well, you can't put spaces inside numbers (for more or less obvious reasons), but Perl does have an alternative: it allows you to put underscores in numbers - for exactly that: better readability. Putting a space between the name of an aggragate and its index makes as much sense to me as to separate an adjective from a noun in an English sentence. $hash {index} is an operation (a mapping in this case) with two operands: a hash, and a string. A function call is also a mapping, but with a variable number of arguments. How do you call a function with say 5 arguments (say, a push of four elements on an array)? Do you call it like:
Or do you put in some whitespace? And if one puts in whitespace, then why not put whitespace between the name of the function and the first argument?

Oh well, at least this will cause the Python people to have a field day. They always got laughed at (often by Perl folks) for their "whitespace rules". And now we got perl6. At least in Python, the whitespace rules are sane.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://346445]
[stonecolddevin]: Corion I haven't heard much of his work to be honest.
[erix]: here is a nice cover, stevieb
[planetscape]: hello, Corion
[Corion]: Hi planetscape!
[stevieb]: Corion I like the groundbreaking ones (guitar players). I have the ability to pick up on sounds that are groundbreaking or specific to a person, thanks to my years of doing recording/mixing/ sampling (hip-hop mind you, but years of it...
[stevieb]: ...has honed in my skills of recognizing sound
[stevieb]: All of the early members are coming out of the woodwork today :) Hey, planetscape
[Corion]: This cover version had so much promise but the singing is underwhelming :-/
[stevieb]: erix Thanks! I dislike remakes of songs usually, but my favourite remix of guitar/weeps is Jeff Healey. I'll take a listen to yours
[planetscape]: hi stevieb!

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2017-06-22 21:28 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (531 votes). Check out past polls.