[ruby-core:94770] [Ruby master Bug#16140] non-typed variable

From: merch-redmine@...
Date: 2019-09-04 03:04:34 UTC
List: ruby-core #94770
Issue #16140 has been updated by jeremyevans0 (Jeremy Evans).

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.

----------------------------------------
Bug #16140: non-typed variable
https://bugs.ruby-lang.org/issues/16140#change-81381

* Author: professeurx (Fran輟ys Proulx)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------

I not sure it's a bug. But maybe it's should be.

``` ruby
a =  2
puts a

a = "two"
puts a

=> 2
=> two
```
I was expecting to produce an error. After all Ruby is supposed to be a dynamically types language. Clearly for the variable it's not the case. if it's not a bug, it possibly an option to added to the interpreter.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next