Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^9: Spot the bug

by shotgunefx (Parson)
on Dec 22, 2005 at 12:12 UTC ( #518527=note: print w/replies, xml ) Need Help??


in reply to Re^8: Spot the bug
in thread Spot the bug

I'm not agaist obvious and useful side effects (that's why I don't program in LISP, though I like some aspects of it).

Personally, I don't consider your two examples as side effects (even though some would). The effect of warn and assigment is the intended effect. There could be other effects due to magic hanging off them, but that's another story.

As far as lexically bound, I mean that it seems more intuitive to have the hash iterator block scoped.

Replies are listed 'Best First'.
Re^10: Spot the bug
by Perl Mouse (Chaplain) on Dec 22, 2005 at 22:28 UTC
    Personally, I don't consider your two examples as side effects
    I actually gave five examples of side effects (looking at a value, assignment, warn, processing @ARGV, reading from a handle).

    Now, you might not call them side-effects, but than you have a private definition of a side-effect. Using private definitions doesn't contribute to succesful communication.

    Perl --((8:>*
      I actually gave five examples of side effects (looking at a value, assignment, warn, processing @ARGV, reading from a handle).

      Well, you got me there. Shouldn't answer nodes right after rolling out of bed. Now, you might not call them side-effects, but than you have a private definition of a side-effect. Using private definitions doesn't contribute to succesful communication.

      I thought that was quite clear.
      Personally, I don't consider your two examples as side effects (even though some would)

      Yes from a language design standpoint, Perl is full of side effects. I'm talking about the expectations of people using Perl. Yes, it's a well know trap and easy to avoid.

      But it's non-intuitive and dare I say non-sensical. I'd be hard pressed to think of any situation were someone would want their loop iterations influenced transparently by code outside the current scope. Certainly that's what most people don't want the majority of the time. It doesn't follow expectation.


      -Lee

      perl digital dash (in progress)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2021-03-04 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (104 votes). Check out past polls.

    Notices?