This file contains hidden or 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
# define some additional methods | |
class Fiber { | |
def sleep: seconds { | |
@sleep_end = Time now + seconds | |
} | |
def asleep? { | |
if: @sleep_end then: { | |
Time now < @sleep_end | |
} |
This file contains hidden or 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
backtype ~/projects/rubinius[master] $ rbx | |
irb(main):001:0> require "rubygems" | |
=> true | |
irb(main):002:0> require "fancy" | |
=> true | |
irb(main):004:0> r = Range.fy :new, 0, :to, 100 | |
=> 0..100 | |
irb(main):005:0> r.fy :each, Proc.new{|i| i.fy :println} | |
0 | |
1 |
This file contains hidden or 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
require("rubygems") | |
require("sinatra") | |
gives me: | |
An exception occurred running /Users/backtype/projects/fancy/bin/fancy | |
invalid identifier if_nil: (NameError) | |
Backtrace: | |
{ } in Object#DelegateClass at /Users/backtype/projects/rubinius/lib |
This file contains hidden or 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
require("rubygems") | |
require("sinatra") | |
get("/") { | |
"Hello, Sinatra, from Fancy!" | |
} | |
Sinatra Application run!() |
This file contains hidden or 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
diff --git a/lib/compiler/ast/identifier.fy b/lib/compiler/ast/identifier.fy | |
index 591036b..49e70fa 100644 | |
--- a/lib/compiler/ast/identifier.fy | |
+++ b/lib/compiler/ast/identifier.fy | |
@@ -53,9 +53,9 @@ class Fancy AST { | |
def bytecode: g { | |
pos(g) | |
match @string { | |
- case "true" -> g push_true() | |
- case "false" -> g push_false() |
This file contains hidden or 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
def while: a do: b { | |
loop() { | |
a call if_true: b else: { return nil } | |
} | |
} | |
i = 0 | |
while: { i < 1_000_000 } do: { | |
i println | |
i = i + 1 |
This file contains hidden or 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
backtype ~/Downloads $ rbx ffi-cairo.rb | |
An exception occurred running ffi-cairo.rb | |
Tried to use non-reference value 0x1 as type Float (25) (TypeError) | |
Backtrace: | |
Object#__script__ at ffi-cairo.rb:263 | |
Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:65 | |
Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:90 | |
Rubinius::Loader#script at kernel/loader.rb:591 | |
Rubinius::Loader#main at kernel/loader.rb:721 |
This file contains hidden or 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
require "rubygems" | |
require "xmpp4r" | |
jid = Jabber::JID.new "[email protected]" | |
client = Jabber::Client.new jid | |
client.connect | |
puts "connected!" | |
client.auth "mysecretpassword" | |
puts "authenticated!" | |
client.close |
This file contains hidden or 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
backtype ~/projects/fancy[master] $ rake -v | |
(in /Users/backtype/projects/fancy) | |
bison --output /Users/backtype/projects/fancy/lib/parser/ext/parser.c -d -v /Users/backtype/projects/fancy/lib/parser/ext/parser.y | |
/Users/backtype/projects/fancy/lib/parser/ext/parser.y:182.17-25: warning: type clash on default action: <object> != <> | |
/Users/backtype/projects/fancy/lib/parser/ext/parser.y: conflicts: 301 shift/reduce, 46 reduce/reduce | |
flex --outfile /Users/backtype/projects/fancy/lib/parser/ext/lexer.c --header-file=lexer.h /Users/backtype/projects/fancy/lib/parser/ext/lexer.lex | |
rbx /Users/backtype/projects/fancy/lib/parser/ext/extconf.rb | |
checking for main() in -lfl... yes | |
creating Makefile | |
flex --outfile /Users/backtype/projects/fancy/boot/rbx-compiler/parser/lexer.c --header-file=lexer.h /Users/backtype/projects/fancy/boot/rbx-compiler/parser/lexer.lex |
This file contains hidden or 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
g++ -I. -I. -I/Users/backtype/projects/rubinius/vm/capi/include -I/Users/backtype/projects/idefy/FXRuby-1.6.19/ext/fox16 -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include/fxscintilla -I/usr/local/include/fox-1.6 -fPIC -ggdb3 -O2 -fPIC -O0 -Iinclude -c FXRuby.cpp | |
FXRuby.cpp: In function ‘long int FXRbHandleMessage(FX::FXObject*, intptr_t, FX::FXObject*, FX::FXSelector, void*)’: | |
FXRuby.cpp:1271: error: invalid conversion from ‘intptr_t (*)()’ to ‘intptr_t (*)(...)’ | |
FXRuby.cpp:1271: error: initializing argument 1 of ‘intptr_t rb_rescue2(intptr_t (*)(...), intptr_t, intptr_t (*)(...), intptr_t, ...)’ | |
FXRuby.cpp:1271: error: invalid conversion from ‘intptr_t (*)()’ to ‘intptr_t (*)(...)’ | |
FXRuby.cpp:1271: error: initializing argument 3 of ‘intptr_t rb_rescue2(intptr_t (*)(...), intptr_t, intptr_t (*)(...), intptr_t, ...)’ | |
make: *** [FXRuby.o] Error 1 |