Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^7: Spot the bug

by shotgunefx (Parson)
on Dec 21, 2005 at 19:04 UTC ( [id://518398]=note: print w/replies, xml ) Need Help??


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

I think it would be better to bind lexically to the value myself. Having some code you pulled in cause side effects is definitely not what most people think of as DWIW.

I started to try and address this issue with RFC Magic::Attach some time ago, but it fell by the way side due to outside obligations.

-Lee

perl digital dash (in progress)

Replies are listed 'Best First'.
Re^8: Spot the bug
by Perl Mouse (Chaplain) on Dec 22, 2005 at 01:50 UTC
    I think it would be better to bind lexically to the value myself.
    What does "bind lexically to the value" mean?
    Having some code you pulled in cause side effects is definitely not what most people think of as DWIW.
    Well, perhaps not in a language like LISP or Haskell, but it's pretty hard to do something in Perl that doesn't have side-effects. Even looking at a value can change it (and hence, is a side-effect). Assignment is a side-effect. warn is a side-effect. Processing @ARGV is a side-effect. Reading from a handle is a side-effect.

    People don't actually mind side-effects. In fact, most people will expect side-effects. What people don't like is unexpected side-effects. But I never advocated not telling what code does.

    Perl --((8:>*
      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.
        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:>*

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-19 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found