This variable access in ruby shouldn’t work, or should it?

Ok this is weird, and seems kind of dangerous.

http://gist.github.com/624138.js

In my opinion there should be an error thrown when I access, a local variable and it is undefined, it should not be passed to the instance and the similar named variable from the instance is passed back. Esspecially when using initializations like the following.

http://gist.github.com/624144.js?file=Variable%20initilization

A long discussion showed this is really something to think about wether it’s a bug or a feature…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s