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

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

by spurperl (Priest)
on May 11, 2007 at 14:38 UTC ( [id://614926]=note: print w/replies, xml ) Need Help??


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

I started typing the whole thing but it's too long, so I'll just post the code relevant to my comment. I feel that sigils are unnecessary at all (and they are harmful to my wrists !)
## ## Sigil invariance ## array = [1, 3, 5, 12, 37, 42] # I use symbols here, but one can use strings: {'alpha' => 4, 'beta' = +> 6} # hash = {:alpha => 4, :beta => 6} third = array[2] # This would be hash['beta'] when using strings # beta = hash[:beta] # Ruby doesn't slice as a part of syntax - there are special member # methods for that. I personally see it as a good thing. odds = array.values_at(1, 3, 5) bets = hash.values_at(:alpha, :beta)

Replies are listed 'Best First'.
Re^4: What's wrong with Perl 6?
by chromatic (Archbishop) on May 11, 2007 at 17:48 UTC

    You like having symbol names automagically spring into existence without even the namespacing protection of different prefixes?

      ...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
        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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found