Issue Details (XML | Word | Printable)

Key: DUBY-1
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: headius
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
duby

Variables can change types without an inference error

Created: 13/Oct/09 09:27 PM   Updated: 13/Oct/09 09:29 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Tags:


 Description  « Hide

This should give an inference error. Instead it's a class verification error:
a = :int
a = "foo"
puts a



headius added a comment - 13/Oct/09 09:28 PM

I suppose there's three things you could do here:

1. raise an inference error
2. allow a to be a variant type of either int or string
3. allow a to change types as many times as you want, with all references
lexically after a given type-change using that new type

I don't really like 3. Option 1 would be simplest, obviously, and probably
should be the initial way it behaves. Option 2 could come later, if we decide
to improve the compile-time type system in that way.


headius added a comment - 13/Oct/09 09:29 PM

This was bug 1219 in bugzilla before switching to JIRA.