2014-06-26 17:39:02 +02:00
|
|
|
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 == other
|
|
|
|
return false unless other.class == self.class
|
2014-08-19 21:40:28 +02:00
|
|
|
Sof::Util.attributes(self).each do |a|
|
|
|
|
begin
|
|
|
|
left = send(a)
|
|
|
|
rescue NoMethodError
|
|
|
|
next # not using instance variables that are not defined as attr_readers for equality
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
right = other.send(a)
|
|
|
|
rescue NoMethodError
|
|
|
|
return false
|
|
|
|
end
|
2014-06-26 17:39:02 +02:00
|
|
|
return false unless left.class == right.class
|
|
|
|
return false unless left == right
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
2014-07-12 20:59:17 +02:00
|
|
|
|
2014-07-14 10:29:38 +02:00
|
|
|
def inspect
|
2014-07-17 23:30:36 +02:00
|
|
|
to_yaml
|
2014-07-14 10:29:38 +02:00
|
|
|
end
|
|
|
|
|
2014-07-12 20:59:17 +02:00
|
|
|
def self.space
|
|
|
|
if defined? @@space
|
|
|
|
@@space
|
|
|
|
else
|
|
|
|
@@space = ::Boot::BootSpace.new
|
|
|
|
end
|
|
|
|
end
|
2014-06-26 17:39:02 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
class Layout < Object
|
|
|
|
def initialize members
|
|
|
|
@members = members
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Class < Object
|
|
|
|
def initialize name , sup = :Object
|
|
|
|
@name = name
|
|
|
|
@super_class = sup
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|