Class: Apricot::SpecialForm

Inherits:
Object show all
Defined in:
lib/apricot/special_forms.rb,
lib/apricot/special_forms/fn.rb

Defined Under Namespace

Classes: ArgList, Overload

Constant Summary collapse

SPECIAL_FORMS =
{}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, block) ⇒ SpecialForm

Returns a new instance of SpecialForm.



13
14
15
16
# File 'lib/apricot/special_forms.rb', line 13

def initialize(name, block)
  @name = name
  @block = block
end

Class Method Details

.[](name) ⇒ Object



5
6
7
# File 'lib/apricot/special_forms.rb', line 5

def self.[](name)
  SPECIAL_FORMS[name]
end

.define(name, &block) ⇒ Object



9
10
11
# File 'lib/apricot/special_forms.rb', line 9

def self.define(name, &block)
  SPECIAL_FORMS[name] = new(name, block)
end

Instance Method Details

#bytecode(g, args) ⇒ Object



18
19
20
# File 'lib/apricot/special_forms.rb', line 18

def bytecode(g, args)
  @block.call(g, args)
end