moved the whole parfait into its namespace/module

This commit is contained in:
Torsten Ruger
2015-05-11 18:55:49 +03:00
parent a552e3fbce
commit ab870e3323
13 changed files with 245 additions and 208 deletions

View File

@@ -12,26 +12,28 @@
# Value is an abstract class that unifies the "has a type" concept
# Types are not "objectified", but are represented as integer constants
class Value
module Parfait
class Value
# to make the machine work, the constants need
# - to start at 0
# - be unique
# - be smaller enough to fit into the 2-4 bits available
INTEGER_VALUE = 0
OBJECT_VALUE = 1
# the type is what identifies the value
def get_type()
raise "abstract clalled on #{self}"
end
# to make the machine work, the constants need
# - to start at 0
# - be unique
# - be smaller enough to fit into the 2-4 bits available
INTEGER_VALUE = 0
OBJECT_VALUE = 1
# Get class works on the type. The value's type is stored by the machine.
# So this function is not overriden in derived classes, because it is used
# to espablish what class a value has! (it's that "fake" oo i mentioned)
def get_class()
type = self.get_type()
return Integer if( type == INTEGER_VALUE )
raise "invalid type"
# the type is what identifies the value
def get_type()
raise "abstract clalled on #{self}"
end
# Get class works on the type. The value's type is stored by the machine.
# So this function is not overriden in derived classes, because it is used
# to espablish what class a value has! (it's that "fake" oo i mentioned)
def get_class()
type = self.get_type()
return Integer if( type == INTEGER_VALUE )
raise "invalid type"
end
end
end