Created
May 28, 2011 16:49
-
-
Save rdp/997022 to your computer and use it in GitHub Desktop.
using 3.times seems to nuke times'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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