4 Dec 2005 01:58
Type system edge cases: underenthusiastic deflection or individual bugs?
? def map := [5 => 10]; null
Both of the following seem to me to be bugs of a similar form:
suitable arguments are rejected because the argument and the
recipient are both ordinary Java objects which must implement each
interface, whereas E objects get the Deflection mechanism.
In each example, the first part is the nonworking code and the second
is a workaround.
1.
? for i in 0..10 { println(map.fetch(i, __continue)) }
# problem: <ClassCastException: Ejector doesn't coerce to a Thunk>
? for i in 0..10 { println(map.fetch(i, thunk { __continue() })) }
# stdout: 10
#
2.
? int.coerce("1", throw)
# problem: <ClassCastException: Thrower doesn't coerce to an
OneArgFunc>
? int.coerce("1", def _ extends throw {})
# problem: <ClassCastException: String doesn't coerce to an int>
I see two possible fixes:
(Continue reading)
RSS Feed