fancy 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. data/README.md +14 -14
  2. data/Rakefile +16 -4
  3. data/bin/fancy +3 -0
  4. data/bin/fspec +20 -0
  5. data/bin/fyi +27 -11
  6. data/bin/ifancy +1 -1
  7. data/boot/fancy_ext.rb +1 -0
  8. data/boot/fancy_ext/block_env.rb +1 -9
  9. data/boot/fancy_ext/delegator.rb +64 -0
  10. data/boot/fancy_ext/object.rb +4 -0
  11. data/boot/fancy_ext/thread.rb +4 -0
  12. data/boot/load.rb +5 -1
  13. data/boot/rbx-compiler/compiler/ast.rb +0 -1
  14. data/boot/rbx-compiler/compiler/ast/class_def.rb +2 -0
  15. data/boot/rbx-compiler/compiler/ast/method_def.rb +2 -0
  16. data/boot/rbx-compiler/compiler/ast/node.rb +10 -0
  17. data/boot/rbx-compiler/compiler/ast/ruby_args.rb +12 -0
  18. data/boot/rbx-compiler/compiler/ast/singleton_method_def.rb +2 -0
  19. data/boot/rbx-compiler/parser/fancy_parser.bundle +0 -0
  20. data/boot/rbx-compiler/parser/lexer.lex +5 -11
  21. data/boot/rbx-compiler/parser/parser.rb +16 -5
  22. data/boot/rbx-compiler/parser/parser.y +39 -24
  23. data/doc/api/fancy.css +1 -1
  24. data/doc/api/fancy.jsonp +1 -1
  25. data/doc/api/fdoc.js +22 -4
  26. data/doc/api/index.html +5 -6
  27. data/doc/api/jquery-ui.min.js +401 -0
  28. data/doc/api/jquery.tools.min.js +192 -0
  29. data/doc/api/themeswitchertool.js +250 -0
  30. data/doc/features.md +17 -0
  31. data/examples/actor_bunnies.fy +32 -0
  32. data/examples/actors.fy +26 -0
  33. data/examples/actors_primitive.fy +27 -0
  34. data/examples/actors_ring.fy +37 -0
  35. data/examples/armstrong_numbers.fy +1 -1
  36. data/examples/array.fy +7 -9
  37. data/examples/async_send.fy +1 -2
  38. data/examples/blocks.fy +4 -4
  39. data/examples/call_with_receiver.fy +1 -1
  40. data/examples/class.fy +1 -1
  41. data/examples/default_args.fy +4 -1
  42. data/examples/define_methods.fy +2 -2
  43. data/examples/echo.fy +1 -1
  44. data/examples/factorial.fy +1 -1
  45. data/examples/future_composition.fy +2 -2
  46. data/examples/futures.fy +0 -5
  47. data/examples/game_of_life.fy +1 -1
  48. data/examples/person.fy +1 -1
  49. data/lib/argv.fy +7 -2
  50. data/lib/array.fy +109 -42
  51. data/lib/block.fy +39 -14
  52. data/lib/boot.fy +2 -0
  53. data/lib/class.fy +2 -0
  54. data/lib/compiler/ast.fy +2 -1
  55. data/lib/compiler/ast/assign.fy +2 -3
  56. data/lib/compiler/ast/async_send.fy +1 -15
  57. data/lib/compiler/ast/class_def.fy +2 -1
  58. data/lib/compiler/ast/expression_list.fy +4 -5
  59. data/lib/compiler/ast/future_send.fy +1 -10
  60. data/lib/compiler/ast/goto.fy +46 -0
  61. data/lib/compiler/ast/identifier.fy +9 -7
  62. data/lib/compiler/ast/literals.fy +8 -1
  63. data/lib/compiler/ast/match.fy +14 -4
  64. data/lib/compiler/ast/message_send.fy +34 -6
  65. data/lib/compiler/ast/method_def.fy +6 -6
  66. data/lib/compiler/ast/node.fy +3 -3
  67. data/lib/compiler/ast/range.fy +1 -0
  68. data/lib/compiler/ast/script.fy +0 -2
  69. data/lib/compiler/ast/singleton_method_def.fy +2 -4
  70. data/lib/compiler/ast/string_interpolation.fy +17 -0
  71. data/lib/compiler/ast/super.fy +5 -4
  72. data/lib/compiler/ast/try_catch.fy +8 -6
  73. data/lib/compiler/ast/tuple_literal.fy +3 -2
  74. data/lib/compiler/command.fy +0 -1
  75. data/lib/compiler/compiler.fy +1 -5
  76. data/lib/compiler/stages.fy +6 -14
  77. data/lib/documentation.fy +57 -46
  78. data/lib/enumerable.fy +257 -23
  79. data/lib/enumerator.fy +122 -15
  80. data/lib/false_class.fy +10 -1
  81. data/lib/fancy_spec.fy +263 -61
  82. data/lib/fdoc.fy +11 -25
  83. data/lib/fiber.fy +11 -0
  84. data/lib/file.fy +8 -11
  85. data/lib/future.fy +84 -5
  86. data/lib/hash.fy +65 -14
  87. data/lib/integer.fy +35 -0
  88. data/lib/iteration.fy +54 -29
  89. data/lib/message.fy +6 -0
  90. data/lib/method.fy +0 -16
  91. data/lib/nil_class.fy +58 -8
  92. data/lib/number.fy +49 -22
  93. data/lib/object.fy +371 -65
  94. data/lib/package.fy +24 -1
  95. data/lib/package/installer.fy +5 -9
  96. data/lib/package/specification.fy +2 -2
  97. data/lib/parser/ext/lexer.lex +15 -11
  98. data/lib/parser/ext/parser.y +70 -23
  99. data/lib/parser/methods.fy +33 -14
  100. data/lib/proxy.fy +33 -3
  101. data/lib/range.fy +28 -0
  102. data/lib/rbx.fy +3 -1
  103. data/lib/rbx/actor.fy +53 -0
  104. data/lib/rbx/alpha.fy +31 -0
  105. data/lib/rbx/array.fy +21 -12
  106. data/lib/rbx/bignum.fy +6 -2
  107. data/lib/rbx/block.fy +23 -26
  108. data/lib/rbx/class.fy +54 -2
  109. data/lib/rbx/code_loader.fy +8 -4
  110. data/lib/rbx/date.fy +9 -0
  111. data/lib/rbx/directory.fy +18 -0
  112. data/lib/rbx/environment_variables.fy +1 -0
  113. data/lib/rbx/exception.fy +9 -2
  114. data/lib/rbx/fiber.fy +22 -4
  115. data/lib/rbx/file.fy +5 -5
  116. data/lib/rbx/fixnum.fy +5 -0
  117. data/lib/rbx/float.fy +11 -3
  118. data/lib/rbx/hash.fy +31 -16
  119. data/lib/rbx/integer.fy +1 -0
  120. data/lib/rbx/io.fy +17 -7
  121. data/lib/rbx/match_data.fy +15 -4
  122. data/lib/rbx/method.fy +40 -7
  123. data/lib/rbx/name_error.fy +4 -0
  124. data/lib/rbx/object.fy +92 -24
  125. data/lib/rbx/range.fy +20 -6
  126. data/lib/rbx/regexp.fy +11 -3
  127. data/lib/rbx/string.fy +51 -1
  128. data/lib/rbx/stringio.fy +17 -0
  129. data/lib/rbx/symbol.fy +15 -1
  130. data/lib/rbx/system.fy +20 -2
  131. data/lib/rbx/tcp_server.fy +4 -1
  132. data/lib/rbx/tcp_socket.fy +11 -0
  133. data/lib/rbx/time.fy +6 -0
  134. data/lib/rbx/tuple.fy +14 -5
  135. data/lib/set.fy +144 -29
  136. data/lib/stack.fy +42 -11
  137. data/lib/string.fy +118 -8
  138. data/lib/struct.fy +13 -3
  139. data/lib/symbol.fy +21 -2
  140. data/lib/thread_pool.fy +2 -1
  141. data/lib/true_class.fy +45 -7
  142. data/lib/tuple.fy +27 -9
  143. data/lib/version.fy +2 -2
  144. data/ruby_lib/fancy +43 -0
  145. data/ruby_lib/fdoc +23 -0
  146. data/ruby_lib/fspec +3 -0
  147. data/ruby_lib/fyi +3 -0
  148. data/ruby_lib/ifancy +3 -0
  149. data/tests/argv.fy +5 -9
  150. data/tests/array.fy +323 -196
  151. data/tests/assignment.fy +29 -29
  152. data/tests/block.fy +72 -59
  153. data/tests/class.fy +227 -138
  154. data/tests/control_flow.fy +83 -51
  155. data/tests/documentation.fy +8 -8
  156. data/tests/enumerable.fy +8 -0
  157. data/tests/enumerator.fy +47 -29
  158. data/tests/exception.fy +49 -32
  159. data/tests/file.fy +28 -28
  160. data/tests/fixnum.fy +170 -0
  161. data/tests/future.fy +24 -7
  162. data/tests/hash.fy +55 -38
  163. data/tests/method.fy +50 -43
  164. data/tests/nil_class.fy +37 -37
  165. data/tests/object.fy +152 -70
  166. data/tests/pattern_matching.fy +67 -31
  167. data/tests/range.fy +6 -6
  168. data/tests/set.fy +101 -4
  169. data/tests/stack.fy +14 -5
  170. data/tests/string.fy +115 -61
  171. data/tests/stringio.fy +18 -0
  172. data/tests/struct.fy +27 -0
  173. data/tests/symbol.fy +19 -6
  174. data/tests/true_class.fy +34 -34
  175. data/tests/tuple.fy +30 -12
  176. metadata +103 -81
  177. data/boot/rbx-compiler/compiler/ast/require.rb +0 -20
  178. data/examples/actor.fy +0 -37
  179. data/examples/curl_async.fy +0 -37
  180. data/lib/compiler/ast/require.fy +0 -15
  181. data/tests/number.fy +0 -135
  182. data/tests/parsing/sexp.fy +0 -50
@@ -5,11 +5,26 @@ class ProxyReceiver : BasicObject {
5
5
  """
6
6
 
7
7
  def initialize: @proxy for: @obj {
8
+ """
9
+ @proxy Proxy receiver for @obj.
10
+ @obj Original receiver object.
11
+
12
+ Initializes a new ProxyReceiver with @proxy for @obj.
13
+ """
14
+
15
+ self
8
16
  }
9
17
 
10
18
  def unknown_message: msg with_params: params {
11
- @proxy send_message: msg with_params: params
12
- @obj send_message: msg with_params: params
19
+ """
20
+ @msg Incoming message name.
21
+ @params Paremeters of incoming message send.
22
+
23
+ Forwards all incoming messages to @self to @@proxy and then @@obj.
24
+ """
25
+
26
+ @proxy receive_message: msg with_params: params
27
+ @obj receive_message: msg with_params: params
13
28
  }
14
29
  }
15
30
 
@@ -23,11 +38,26 @@ class RespondsToProxy : BasicObject {
23
38
  """
24
39
 
25
40
  def initialize: @target {
41
+ """
42
+ @target Target receiver object.
43
+
44
+ Initializes a new RespondsToProxy for @target.
45
+ """
46
+
47
+ self
26
48
  }
27
49
 
28
50
  def unknown_message: msg with_params: params {
51
+ """
52
+ @msg Incoming message name.
53
+ @params Paremeters of incoming message send.
54
+
55
+ Forwards all incoming message to @self to @@target
56
+ only if @@target responds to them.
57
+ """
58
+
29
59
  if: (@target responds_to?: msg) then: {
30
- @target send_message: msg with_params: params
60
+ @target receive_message: msg with_params: params
31
61
  }
32
62
  }
33
63
  }
@@ -0,0 +1,28 @@
1
+ class Range {
2
+ """
3
+ Class of Range values. Are created by using Range literal syntax in Fancy.
4
+
5
+ Example:
6
+ (10..100) # Range from 10 to 100
7
+ # the following code does the same as above:
8
+ Range new: 10 to: 100
9
+ """
10
+
11
+ include: FancyEnumerable
12
+
13
+ def to_s {
14
+ """
15
+ Same as Range#inspect
16
+ """
17
+
18
+ inspect
19
+ }
20
+
21
+ def inspect {
22
+ """
23
+ @return @String@ representation of @self.
24
+ """
25
+
26
+ "(" ++ @start ++ ".." ++ @end ++ ")"
27
+ }
28
+ }
data/lib/rbx.fy CHANGED
@@ -5,6 +5,7 @@
5
5
  # NOTE:
6
6
  # Don't change the order in here, unless you know what you're doing.
7
7
 
8
+ require: "rbx/alpha"
8
9
  require: "rbx/documentation"
9
10
  require: "rbx/object"
10
11
  require: "rbx/class"
@@ -26,14 +27,15 @@ require: "rbx/io"
26
27
  require: "rbx/file"
27
28
  require: "rbx/tcp_server"
28
29
  require: "rbx/tcp_socket"
30
+ require: "rbx/match_data"
29
31
  require: "rbx/regexp"
30
32
  require: "rbx/directory"
31
33
  require: "rbx/method"
32
34
  require: "rbx/environment_variables"
33
35
  require: "rbx/name_error"
34
36
  require: "rbx/no_method_error"
35
- require: "rbx/match_data"
36
37
  require: "rbx/thread"
37
38
  require: "rbx/fiber"
38
39
  require: "rbx/date"
39
40
  require: "rbx/time"
41
+ require: "rbx/actor"
@@ -0,0 +1,53 @@
1
+ require("actor")
2
+
3
+ class Actor {
4
+ """
5
+ Primitive Actor class.
6
+ Actors can be sent messages asynchronously. They process incoming messages
7
+ (which can be any object, including Tuples, Arrays, Numbers ...) in a
8
+ first-come, first-serve manner.
9
+
10
+ Actors are used to implement asynchronous and future message sends in Fancy
11
+ using the @@ and @@@ syntax.
12
+
13
+ Example usage:
14
+
15
+ a = Actor spawn: {
16
+ loop: {
17
+ match Actor receive {
18
+ case 'hello -> \"Hello World\" println
19
+ case 'quit ->
20
+ \"OK, done!\" println
21
+ break # Quit loop and let actor die
22
+ }
23
+ }
24
+ }
25
+
26
+ 10 times: {
27
+ a ! 'hello # send 'hello to actor asynchronously
28
+ }
29
+ a ! 'quit
30
+ """
31
+
32
+ alias_method(':!, '<<)
33
+
34
+ forwards_unary_ruby_methods
35
+ metaclass forwards_unary_ruby_methods
36
+
37
+ def Actor spawn: block {
38
+ """
39
+ @block @Block@ that represents the @Actor@'s code body to be executed in a new @Thread@.
40
+ @return A new @Actor@ running @block in a seperate @Thread@.
41
+
42
+ Example usage:
43
+
44
+ Actor spawn: {
45
+ loop: {
46
+ Actor receive println # print all incoming messages
47
+ }
48
+ }
49
+ """
50
+
51
+ Actor spawn(&block)
52
+ }
53
+ }
@@ -0,0 +1,31 @@
1
+ class Object {
2
+ # Let's define false, true & nil =)
3
+ dynamic_method(':false) |g| {
4
+ g push_false()
5
+ g ret()
6
+ }
7
+
8
+ dynamic_method(':true) |g| {
9
+ g push_true()
10
+ g ret()
11
+ }
12
+
13
+ dynamic_method(':nil) |g| {
14
+ g push_nil()
15
+ g ret()
16
+ }
17
+ }
18
+
19
+ class Class {
20
+ def alias_method: new for: old {
21
+ alias_method(new, old)
22
+ }
23
+
24
+ def ruby_alias: method_name {
25
+ alias_method(":" + (method_name to_s), method_name)
26
+ }
27
+ }
28
+
29
+ class String {
30
+ alias_method: ":+" for: "+"
31
+ }
@@ -1,17 +1,12 @@
1
1
  class Array {
2
2
  ruby_alias: '==
3
3
  ruby_alias: '<<
4
- ruby_alias: 'clear
5
- ruby_alias: 'size
6
- ruby_alias: 'reverse
7
- ruby_alias: 'reverse!
8
- ruby_alias: 'sort
9
4
  ruby_alias: 'pop
10
5
  ruby_alias: 'last
11
- ruby_alias: 'shuffle
12
- ruby_alias: 'inspect
13
6
  ruby_alias: 'shift
14
7
 
8
+ forwards_unary_ruby_methods
9
+
15
10
  def Array new: size with: default {
16
11
  "Creates a new Array with a given size and default-value."
17
12
 
@@ -19,7 +14,12 @@ class Array {
19
14
  }
20
15
 
21
16
  def includes?: obj {
22
- "Indicates, if an Array includes a given value."
17
+ """
18
+ @obj Object to search for in @self.
19
+ @return @true, if @obj is in @self, @false otherwise.
20
+
21
+ Indicates, if an Array includes a given value.
22
+ """
23
23
 
24
24
  include?(obj)
25
25
  }
@@ -61,7 +61,7 @@ class Array {
61
61
  at(idx)
62
62
  }
63
63
 
64
- def at: idx put: obj {
64
+ def [idx]: obj {
65
65
  """
66
66
  @idx Index to set a value for.
67
67
  @obj Value (object) to be set at the given index.
@@ -72,6 +72,8 @@ class Array {
72
72
  ruby: '[]= args: [idx, obj]
73
73
  }
74
74
 
75
+ alias_method: 'at:put: for: '[]:
76
+
75
77
  def index: item {
76
78
  """
77
79
  @item Item/Value for which the index is requested within an @Array@.
@@ -122,15 +124,22 @@ class Array {
122
124
  }
123
125
 
124
126
  def reject!: block {
125
- "Same as Array#reject: but doing so in-place (destructive)."
127
+ """
128
+ Same as Array#reject: but doing so in-place (destructive).
129
+ """
126
130
 
127
131
  reject!(&block)
128
132
  return self
129
133
  }
130
134
 
131
135
  def join: join_str {
132
- """Joins all elements in the Array by a given String.
133
- E.g.: [1,2,3] join: ', ' # => '1,2,3'"""
136
+ """
137
+ @join_str @String@ by which to @join all elements in @self into a new @String@.
138
+ @return Joined @String@ with all elements with @join_str.
139
+
140
+ Joins all elements in the Array with a given @String@.
141
+ [1,2,3] join: \", \” # => \”1, 2, 3\"
142
+ """
134
143
 
135
144
  join(join_str)
136
145
  }
@@ -1,4 +1,8 @@
1
1
  class Bignum {
2
+ """
3
+ Class for large integer values in Fancy.
4
+ """
5
+
2
6
  include: Number
3
7
 
4
8
  ruby_alias: '==
@@ -11,11 +15,11 @@ class Bignum {
11
15
  ruby_alias: '<=
12
16
  ruby_alias: '>=
13
17
  ruby_alias: '===
14
- ruby_alias: 'chr
15
- ruby_alias: 'to_i
16
18
  ruby_alias: '**
17
19
  ruby_alias: '&
18
20
 
21
+ forwards_unary_ruby_methods
22
+
19
23
  alias_method: 'to_s: for: 'to_s
20
24
  alias_method: 'modulo: for: 'modulo
21
25
  alias_method: ":%" for: "modulo:" # prepend with : so we dont overwrite ruby's % operator
@@ -1,17 +1,8 @@
1
1
  # Block = BlockEnvironment
2
2
 
3
3
  class Block {
4
- ruby_alias: 'arity
5
-
6
- def argcount {
7
- """
8
- @return Arity of a @Block@.
9
-
10
- Returns the amount of arguments (arity) a Block takes.
11
- """
12
-
13
- arity()
14
- }
4
+ forwards_unary_ruby_methods
5
+ metaclass forwards_unary_ruby_methods
15
6
 
16
7
  def receiver {
17
8
  """
@@ -31,32 +22,38 @@ class Block {
31
22
  @top_scope receiver: recv
32
23
  }
33
24
 
25
+ # Ugh. HACK.
26
+ # Use try/catch to deal with older and latest version of rbx (method got changed)
34
27
  def call_with_receiver: receiver {
35
- call_under(receiver, method() scope())
28
+ try {
29
+ return call_under(receiver, method() scope())
30
+ } catch {
31
+ return call_on_instance(receiver)
32
+ }
36
33
  }
37
34
 
38
35
  def call: args with_receiver: receiver {
39
- call_under(receiver, method() scope(), *args)
36
+ try {
37
+ return call_under(receiver, method() scope(), *args)
38
+ } catch {
39
+ return call_on_instance(receiver, *args)
40
+ }
40
41
  }
41
42
 
42
- def loop {
43
- wrapper = {
44
- try {
45
- call
46
- } catch (Fancy NextIteration) => ex {
47
- ex return_value
48
- }
49
- }
43
+ def to_proc {
44
+ """
45
+ @return Ruby Proc representing @self.
50
46
 
51
- try {
52
- loop(&wrapper)
53
- } catch (Fancy BreakIteration) => ex {
54
- return ex return_value
55
- }
47
+ Turns a @Block@ into a Ruby Proc object.
48
+ """
49
+
50
+ Proc new(&self)
56
51
  }
57
52
  }
58
53
 
59
54
  class Rubinius VariableScope {
55
+ forwards_unary_ruby_methods
56
+
60
57
  def receiver {
61
58
  @self
62
59
  }
@@ -4,6 +4,8 @@ class Class {
4
4
  ruby_alias: 'ancestors
5
5
  ruby_alias: 'instance_methods
6
6
  ruby_alias: 'methods
7
+ ruby_alias: 'inspect
8
+ ruby_alias: 'to_s
7
9
 
8
10
  def new {
9
11
  """
@@ -37,8 +39,8 @@ class Class {
37
39
  @body_block A @Block@ that is used as the body of the new @Class@.
38
40
  @return A new @Class@ inherited from @superclass.
39
41
 
40
- Creates a new @Class@ by subclassing @superclass and using
41
- @body_block as its body.
42
+ Creates a new @Class@ by subclassing @superclass and
43
+ using @body_block as its body.
42
44
  """
43
45
 
44
46
  new(superclass, &body_block)
@@ -149,4 +151,54 @@ class Class {
149
151
  """
150
152
  alias_method(message_name: new_method_name, ruby_method_name)
151
153
  }
154
+
155
+ def public: method_names {
156
+ """
157
+ @method_names One or more (@Array@) method names (as a @Symbol@) to be set to public in this @Class@.
158
+
159
+ Sets any given method names to public on this @Class@.
160
+ """
161
+
162
+ method_names = method_names to_a()
163
+ method_names = method_names map: |m| { message_name: m }
164
+ public(*method_names)
165
+ }
166
+
167
+ def private: method_names {
168
+ """
169
+ @method_names One or more (@Array@) method names (as a @Symbol@) to be set to private in this @Class@.
170
+
171
+ Sets any given method names to private on this @Class@.
172
+ """
173
+
174
+ method_names = method_names to_a()
175
+ method_names = method_names map() |m| { message_name: m }
176
+ private(*method_names)
177
+ }
178
+
179
+ def protected: method_names {
180
+ """
181
+ @method_names One or more (@Array@) method names (as a @Symbol@) to be set to protected in this @Class@.
182
+
183
+ Sets any given method names to protected on this @Class@.
184
+ """
185
+
186
+ method_names = method_names to_a()
187
+ method_names = method_names map() |m| { message_name: m }
188
+ protected(*method_names)
189
+ }
190
+
191
+ def forwards_unary_ruby_methods {
192
+ """
193
+ Creates ruby_alias methods for any unary ruby methods of a class.
194
+ """
195
+
196
+ instance_methods select() |m| {
197
+ m =~(/^[a-z]+/)
198
+ } select() |m| {
199
+ instance_method(m) arity() == 0
200
+ } each() |m| {
201
+ ruby_alias: m
202
+ }
203
+ }
152
204
  }
@@ -100,7 +100,7 @@ class Fancy {
100
100
  }
101
101
 
102
102
  # Returns the compiled filename for a given filename.
103
- # E.g. "foo.fy" => "foo.fyc", "foo" => "foo.compiled.rbc"
103
+ # E.g. "foo.fy" => "foo.fyc", "foo" => "foo.compiled.fyc"
104
104
  def self compiled_filename_for: file {
105
105
  match file {
106
106
  case /\.fyc$/ -> file
@@ -121,7 +121,7 @@ class Fancy {
121
121
  # Rubinius::Compiler.compile_fancy_file filename, nil, 1, false
122
122
  Compiler compile_file: filename to: compiled_file
123
123
  } else: {
124
- @@compiled at: filename put: true
124
+ @@compiled[filename]: true
125
125
  }
126
126
  }
127
127
  compiled_file
@@ -153,10 +153,14 @@ class Fancy {
153
153
  dirname = File dirname(compiled_file)
154
154
  push_loadpath: dirname
155
155
  @@current_dir push(dirname)
156
- @@loaded at: compiled_file put: true
156
+ @@loaded[compiled_file]: true
157
157
 
158
158
  cl = Rubinius::CodeLoader new(compiled_file)
159
- cm = cl load_compiled_file(compiled_file, 0)
159
+ try {
160
+ cm = cl load_compiled_file(compiled_file, 0)
161
+ } catch ArgumentError {
162
+ cm = cl load_compiled_file(compiled_file, 0, 0)
163
+ }
160
164
 
161
165
  script = cm create_script(false)
162
166
  script file_path=(source_file)