Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^5: What's wrong with Perl 6?

by jdporter (Paladin)
on May 14, 2007 at 14:24 UTC ( [id://615315]=note: print w/replies, xml ) Need Help??


in reply to Re^4: What's wrong with Perl 6?
in thread What's wrong with Perl 6?

...spring into existence without even the namespacing protection of different prefixes?

The extremely miniscule benefit of having same-named variables of different types is one I would gladly trade for the reduction in typing and visual clutter. Some people code according to style guidelines which explicitly discourage the use of this feature — and for good reason, imho.

Note that in a name like $x, the keystrokes involved are three times that necessary to type x. That really belies the alleged priority given to Huffman coding in the design of Perl.

Of course one will argue that good Perl coders don't use names that short; but a keystroke penalty against them is not a good way to encourage better behavior. The two keystoke penalty is incurred on every variable name occurrence.

I think it also worth mentioning that the elimination of sigils would have major PR benefit as well.

As for springing into existence — this (undeclared variables) is the sort of behavior that the interpreter should be in the business of discouraging. The penalty of having to declare a variable is incurred only once per variable.

A word spoken in Mind will reach its own level, in the objective world, by its own weight

Replies are listed 'Best First'.
Re^6: What's wrong with Perl 6?
by chromatic (Archbishop) on May 14, 2007 at 15:16 UTC
    The extremely miniscule benefit of having same-named variables of different types is one I would gladly trade for the reduction in typing and visual clutter.

    How much is the benefit of being able to look at a piece of code and identify which elements are variables and, of those, which are aggregates and which are scalars and which support which types of indexing operations? People will invent their own Hungarian notations without scalars, I promise you.

    (undeclared variables) is the sort of behavior that the interpreter should be in the business of discouraging.

    Somehow Ruby and Python don't manage that feature. It's awfully difficult if you allow lvalue functions and features such as method_missing.

      Being able to see the variables is good, but the other benefits you mention sort of went out the window with references. Some $foo might be a simple scalar, as the sigil implies, but it might also be the gatekeeper to a huge complex data structure, which may or may not be an object. We have ref and Scalar::Util::blessed to help figure that out at run time (thank goodness), but those don't help at comprehension time. It's hard to look at any code that's heavy in objects and get a sense of what some $foo really is if it doesn't have a good name.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://615315]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found