Created
August 8, 2012 02:45
-
-
Save CrypticSwarm/3291607 to your computer and use it in GitHub Desktop.
Showcases a subtle problem that can occur due to getters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var optimist = require('optimist') | |
optimist.demand('color') | |
optimist.demand('size') | |
optimist.argv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var optimist = require('optimist') | |
optimist.demand('color') | |
optimist.demand('size').argv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rwldrn Agreed. However, it makes another thing that people need to keep in their minds if they copy something. Having a function (assuming it was bound to the correct object) that returned a value you could copy regularly. Not really arguing for or against, but this was something that made me do a double take when someone asked me about this situation.
Proxies will probably also have similar oddities that show up when people start making more use of them.
My thoughts are if you start using a language feature make sure you are aware of any nuances that might creep in.