in reply to Re^2: What are the drawbacks of autobox?
in thread What are the drawbacks of autobox?

it's easier to read (and write) $ar->[$x][$y][$z]->push("element") than push @{$ar->[$x][$y][$z]}, "element"

The basic programming 'association' as you term it is: $name = value;

And I think there is clarity in the mirrors: push @array, value; and push @{ <arrayRef> }, $value;.

The flow is in one left-to-right direction and doesn't jump around, the association is much more evident.

The left to right association of an array reference pushed onto an element?

I don't know of any language where the car->get's into->the man or the queue->joins->the boy are valid. Syntactically or semantically.

this clear association ...

I do not see this association you speak of, let alone clearly.

make it much easier to parse (statically) and to design help systems in IDEs, interactively popping up the documentation for a method.

Hm. So you consider making the language easier for the computer to parse, at the expense of making it harder for the human being, a benefit?

method calls often allow cascading, like this enabling more expressive code.

I'd really like to see you find a real live working example that demonstrates the use of cascading method calls. Once you find an example, we can then argue about how "expressive" it is.

For me, one of the many things I like about Perl is the wonderful expressiveness of the carefully tuned syntax. Making every operator a method call, is like fitting a tiller and anchor to your Fireblade.

it's easier to introspect (dynamically)

I absolutely challenge the need for dynamic introspection. Beyond your, REPL-prompts-the-programmer example, do you have a good example of when you might make use of this?

Extending new methods which only work with special data-types (like adding ruby's each-behaviour to arrays)

Is defining each() for arrays so hard? Or do you even need to do it at all:

map{ ... } @array; ... for @array; sub each{ my $code = shift; $code->( $_ ) for @_; }
it gets easier to port JS or Ruby code to Perl,

That'd be a nice challenge. Pick a piece of published Ruby code, and you can port it with autobox and me without?

look at the arguments from the Perl6 designers ...

Only time will tell how well that works out in practice.

TIMTOWTDI =)

Actually, the underlying tenet of autobox is TIOOWTDI. Ie. The only operator allowed is ->.

JS, Ruby and even Smalltalk don't try and replace the normal math infix operators with a post-fix operator and verbose method names.

If you really want your 2009 cpu to run like a 1999 cpu, investigate:

use DB; sub DB::db{ sleep 1 }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^4: What are the drawbacks of autobox?
by punkish (Priest) on Mar 01, 2010 at 03:21 UTC
    I don't know of any language where the car->get's into->the man or the queue->joins->the boy are valid. Syntactically or semantically.

    So, this is an interesting thing I learned a while back, when trying to understand OO. While in English, the verb comes first followed by the subject, it is actually quite the opposite in other languages. For example, in English, we say lift chair, while in Hindi, I would say कुर्सी उठाअो. It is actually quite natural in other languages to first establish what we are referring to, and then specify what we are going to do to it. Not unlike how, say, copying or moving a file works in a Mac (or any graphic user interface). We first select the file with the mouse, and once the file is selected, we copy, move, delete or duplicate it, unlike a terminal command where we type 'copy file <target' or 'delete file'.

    Now, on to another topic... does being able to cascade methods help in programming? I don't know. I had been doing stuff like (fake example ahead)

    left(uc(substr($string, 0, length($string) - 4)),1) until I discovered JavaScript (Note: I particularly enjoy method chaining in jQuery) where I could do string.substr(0, string.length - 4).upper.left(1)

    In the former, I have to start in the very inside and work my way to the outside, while in the latter, I just move from left to right, applying methods as I go along.

    I think there is value in autobox. I too would like to explore, like Lanx, what that value is, and what its costs are.

    --

    when small people start casting long shadows, it is time to go to bed
      I think there is value in autobox. I too would like to explore, like Lanx, ..., and what its costs are.

      My inquiry of LanX in no way prevents you (or others) continuing that discussion in the main thread.

      what that value is

      For me, that was the more interesting discussion. And I've yet to see any such value. That doesn't stop you finding value, but it stops me from giving it any further consideration.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^4: What are the drawbacks of autobox?
by chromatic (Archbishop) on Mar 01, 2010 at 03:01 UTC

    I'm not sure anyone who's ever used Smalltalk would use the phrase "normal math infix operators", as Smalltalk has no operator precedence, not even for "normal math infix operators".

    I suppose that's an example of making the language easier to parse at the expense of humans, though. (What a useless false dilemma that is; I had a lovely discussion with Adin Falkoff a couple of years ago about teaching APL to inner-city students in the '60s. I asked him specifically about operator precedence and the like, and his approach was very different from that of Alan Kay, Dan Ingalls, et al.)

      I'm not sure anyone who's ever used Smalltalk would use the phrase "normal math infix operators", as Smalltalk has no operator precedence, not even for "normal math infix operators".

      Well, it has been a long time, but I think you are more confused than I am. Precedence, (or a lack thereof), does not preclude the use of normal math infix operators. (Or as they call them "the usual binary arithmetic operators".)

      And if you look at the best example I turned up in a quick peruse of my 20 y/o SmallTalk V/PM manual, you'll see ^self fromSeconds:((( hours*60 ) + minutes ) * 60 ) + seconds doesn't look any different to the way many people would code the same thing in a language that supports precedence. Contrast that with the same expression in languages that use reverse polish notation, or postfix method syntax.

      Indeed, there are many programming books that advocate that precedence should be ignored and all compound expressions should be fully bracketed. This for the clarity and simplicity it gives the programmer. Not the computer parser.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Indeed, there are many programming books that advocate that precedence should be ignored and all compound expressions should be fully bracketed.

        Keep holding on to that false dilemma; I'm sure that Lisp will succeed any day now when the unwashed masses realize that fully-parenthesized homoiconicity is the the One True Syntax form.

      You know, I really like hot dogs and beer
Re^4: What are the drawbacks of autobox?
by LanX (Saint) on Mar 01, 2010 at 00:38 UTC
    Yes there are good answers to your questions¹ but I'm not in the mode to flame with you...we had this already.

    Anyway it's simple, if you don't like autobox ... better don't use it. 8)

    Cheers Rolf

    PS: To get back to the OP. Anyone knowing side effects of autobox making it not suitable for production?

    Footnotes:

    ¹) I mean the non-polemic portions of them

      I spend 4 hours constructing methodical, rational, reasoned, non-flame responses to your reasons for using autobox, and you counter with a dismissive, "there are good answers to your questions". Yeah right!

      If you can't justify why you would use it, why are you concerned with whether it is safe to be used?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
      A reply falls below the community's threshold of quality. You may see it by logging in.
Re^4: What are the drawbacks of autobox?
by dsheroh (Monsignor) on Mar 01, 2010 at 11:12 UTC
    I don't know of any language where the car->get's into->the man or the queue->joins->the boy are valid. Syntactically or semantically.
    Listen to Yoda enough you have not.