Skip to content

Instantly share code, notes, and snippets.

@rdp
Created May 28, 2011 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdp/997022 to your computer and use it in GitHub Desktop.
Save rdp/997022 to your computer and use it in GitHub Desktop.
using 3.times seems to nuke times'
$ mirah yoyo.mir
Inference Error:
Can't assign java.lang.Object to variable of type int
yoyo.mir:21: Can't assign java.lang.Object to variable of type int
RubyInt.new(1).times do |n|
import java.util.ArrayList
interface CallableOneArg do
def call(arg1:Object):Object
end
end
# should I make this class static? cache it [in a hash]?
class RubyInt < Object
def initialize(a:int) # numeric ?
@a = a
end
def times(call_me:CallableOneArg):Object
self
end
end
RubyInt.new(1).times do |n|
3
nil
end
3.times do |n|
33
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment