A good start on the macro idea
I call it macro because it lets you insert basically arbitrary risc code into the ruby level. The way it works: Reserve namespace X map any X.some_call to a Mom instruction by the name SomeCall which must take the same args in constructor as given And obviously produce whatever risc it wants Hoping to rewrite builtin around this idea (with the existing Mom builtn instructions)
This commit is contained in:
@ -4,6 +4,12 @@ module Ruby
|
||||
# The SendStatement really only provides to_s, so see CallStatement
|
||||
#
|
||||
class SendStatement < CallStatement
|
||||
|
||||
def to_vool
|
||||
return super unless @receiver.is_a?(ModuleName) and @receiver.name == :X
|
||||
args = @arguments.collect { |arg| arg.to_vool }
|
||||
Vool::MacroExpression.new(name , args)
|
||||
end
|
||||
def to_s(depth = 0)
|
||||
at_depth( depth , "#{receiver}.#{name}(#{arguments.join(', ')})")
|
||||
end
|
||||
|
Reference in New Issue
Block a user