hurra, a first test. looks a lot.... but lets not spoil th efeeling

This commit is contained in:
Torsten Ruger
2014-06-26 18:39:02 +03:00
parent 525f9d45c5
commit 16ceb2a60d
13 changed files with 94 additions and 87 deletions

42
lib/virtual/object.rb Normal file
View File

@ -0,0 +1,42 @@
module Virtual
# our machine is made up of objects, some of which are code, some data
#
# during compilation objects are module Virtual objects, but during execution they are not scoped
#
# functions on these classes express their functionality as function objects
class Object
def initialize
@layout = Layout.new([:layout])
end
def attributes
raise "abstract #{self}"
end
def == other
return false unless other.class == self.class
attributes.each do |a|
left = send(a)
right = other.send(a)
return false unless left.class == right.class
return false unless left == right
end
return true
end
end
class Layout < Object
def initialize members
@members = members
end
def attributes
[:members]
end
end
class Class < Object
def initialize name , sup = :Object
@name = name
@super_class = sup
end
end
end