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

> not adding anything of value to this discussion

Your plain wrong, you did! ;-)

I was recently complaining about many Pythonistas having this fundamentalist "There is only one true way to code and Guido is the prophet" attitude.

I was even claiming that the Perl crowd having more tolerance about paradigms, giving them the flexibility to adopt to new tasks...

Well ...maybe I wasn't completely wrong ... thanks! 8)

Cheers Rolf

  • Comment on Re^2: What are the drawbacks of autobox?

Replies are listed 'Best First'.
Re^3: What are the drawbacks of autobox?
by dsheroh (Monsignor) on Mar 01, 2010 at 11:22 UTC
    There's flexibility and there's following fads.

    Show me a valid, real-world use case in which there is a significant advantage to treating the number 3 as an object rather than as a simple integer and I'm happy to be flexible and consider whether I would find a benefit in doing things that way. Until then, the idea that everything must be an object and all action should be expressible as method calls looks an awful lot like a fad to me.

      Show me a valid, real-world use case...

      OK one more try:

      This is valid JS Code: ¹

      var fruits = ["Banana", "Orange", "Apple", "Mango"]; document.write(fruits.push("Kiwi") + "<br />"); document.write(fruits.push("Lemon","Pineapple") + "<br />"); document.write(fruits);

      this is still valid JS-Code

      var $fruits = ["Banana", "Orange", "Apple", "Mango"]; document.write($fruits.push("Kiwi") + "<br />"); document.write($fruits.push("Lemon","Pineapple") + "<br />"); document.write($fruits);

      with the help of autobox this could become valid perl code:

      my $fruits = ["Banana", "Orange", "Apple", "Mango"]; document->write($fruits->push("Kiwi") + "<br />"); document->write($fruits->push("Lemon","Pineapple") + "<br />"); document->write($fruits);

      or maybe better without overloading +

      my $fruits = ["Banana", "Orange", "Apple", "Mango"]; document->write($fruits->push("Kiwi") . "<br />"); document->write($fruits->push("Lemon","Pineapple") . "<br />"); document->write($fruits);

      Real world enough for you???

      Cheers Rolf

      ¹) from my first google hit on "javascript push" http://www.w3schools.com/jsref/jsref_push.asp

      UPDATE: corrected . to ->

      Show me a valid, real-world use case in which there is a significant advantage to treating the number 3 as an object rather than as a simple integer

      Your reducing the possibilities of autobox to a little feature.

      And did I ever say I want to call a method on 3?

      I'm really surprised by the emotions caused by this little question about the technical side-effects of a cpan module, I didn't expect the Spanish inquisition...

      Cheers Rolf

        Fair enough. On further reflection, this thread is suffering from a bad case of excluded-middle: The anti-autobox folks (myself among them) are trying to push you into defending the position that everything should be objects, when you've not stated that this should be the case.

        I do see potential benefit to making at least some array/list/hash operations available as methods. I don't see it as a strong benefit in general, but reasonable people can differ on that. In the particular case of your javascript fruit basket, it reads more naturally to me in the standard Perl syntax than the js/autobox version, but that may just be a matter of acclimation; what would read most naturally to me would be "push 'kiwi', @fruits", to mirror English "push kiwi onto fruits", but I've not seen a language which allows that ordering.