V
Vivek Nallur
Hi
I was just wandering through some lisp code and I saw this:
(let ((x 1))
(flet ((x (y) (+ x y)))
(x x)))
(I'm not sure if the indentation came out properly)
A transliteration(?) of this code gave me an error!
[nvivek@indus nvivek]$ cat t.rb
x = 1;
def x (y)
x += y
end
x x
[nvivek@indus nvivek]$ ruby t.rb
t.rb:3:in `x': undefined method `+' for nil:NilClass (NoMethodError)
from t.rb:5
All I want to do is to check if ruby supports the same identifier having
both a value binding as well as a function binding.
Comments?
-vivek
I was just wandering through some lisp code and I saw this:
(let ((x 1))
(flet ((x (y) (+ x y)))
(x x)))
(I'm not sure if the indentation came out properly)
A transliteration(?) of this code gave me an error!
[nvivek@indus nvivek]$ cat t.rb
x = 1;
def x (y)
x += y
end
x x
[nvivek@indus nvivek]$ ruby t.rb
t.rb:3:in `x': undefined method `+' for nil:NilClass (NoMethodError)
from t.rb:5
All I want to do is to check if ruby supports the same identifier having
both a value binding as well as a function binding.
Comments?
-vivek