Actions
Bug #16140
closednon-typed variable
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]
Backport:
Description
I not sure if it's a bug. But maybe it is.
a = 2
puts a
a = "two"
puts a
=> 2
=> two
I was expecting it to produce an error. After all, Ruby is supposed to be a dynamically typed language. Clearly for variables, it's not the case. if it's not a bug, it is possibly an option to be added to the interpreter.
Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
- Status changed from Open to Rejected
This is expected behavior. I'm not sure why you are expecting an error, this is how variables in most dynamically typed languages work. It is the feature that separates dynamically typed languages from statically typed languages.
Actions
Like0
Like0Like0