Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^17: Ovid's take on the renaming of "Perl6" (updated)

by Jenda (Abbot)
on Sep 09, 2019 at 11:57 UTC ( #11105864=note: print w/replies, xml ) Need Help??

in reply to Re^16: Ovid's take on the renaming of "Perl6" (updated)
in thread Ovid's take on the renaming of "Perl6"

Prototypes are best ignored.

In Ruby, if you only need to pass one function/lambda/block/whatever-you-decide-to-call-it, you do NOT specify the function parameter in the method signature, you just happen to use the misnamed, absolutely illogical statement yield (or whatever concoction of vowels that word contains). There is no indication whatsoever in the signature that a block will be accepted as an unmentioned, unnamed parameter.

As the parameter has got no name, you can't do something like testing it for null or undef, something that'd be in any way consistent with anything. Nope. You test the value of the block_given? method. How lovely.

Now if you need to pass two lambdas ... you can throw all this down the drain and start again with a named parameter &whatever, call it with How do you specify the hailed blocks when calling that method I can't remember. What I do remember was that if you copied a block from one place to another, suddenly what used to introduce a new variable, lexical to the block, happily accesses a more global variable, 'cause variable declaration is too uncool and you are supposed to have a gazillion of two line methods anyway.

Yes, you guess right. I had to use Ruby for some time and I hated every single minute.

1984 was supposed to be a warning,
not a manual!

Replies are listed 'Best First'.
Re^18: Ovid's take on the renaming of "Perl6" (updated)
by Corion (Pope) on Sep 09, 2019 at 12:04 UTC

    I think what LanX means when saying "prototypes" are formal subroutine parameters, like what Function::Parameters provides and what maybe becomes part of Perl 5.34, not what Perl currently implements under the name uf "prototypes".

Re^18: Ovid's take on the renaming of "Perl6" (updated)
by Anonymous Monk on Sep 09, 2019 at 12:21 UTC
    One of the main selling points of Ruby are Domain Specific Languages.

    Restricting Perl to have a code block prototype (&) only at first position is hindering many options for syntactic sugar.

    Be it more expressive versions of 'map' and 'grep' or 'loop' constructs. Basically because you want to add a modifier between keyword and block, without needing to explicitly introduce ', sub' .

    Your rant about the limits of Ruby may be legit, but had little or nothing to do with what I said or meant.

      If you add too much sugar, you end up with diabetes.

      The resulting syntax would be too confusing. "Is that thing a block or a hash?"

      I was reacting to your "better code blocks" and your mention of Ruby. Ruby doesn't have better code blocks. It has a highly confusing, hard to extend, misdesigned, misbehaving nonsense.

      1984 was supposed to be a warning,
      not a manual!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2020-05-27 07:36 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (153 votes). Check out past polls.