2016-12-06 11:38:09 +02:00
|
|
|
# Parfait is the ruby runtime
|
|
|
|
module Parfait
|
2019-02-10 21:00:25 +02:00
|
|
|
TYPE_INDEX = 0
|
2016-12-06 11:38:09 +02:00
|
|
|
end
|
|
|
|
|
2019-09-09 11:54:45 +03:00
|
|
|
require_relative "parfait/object"
|
|
|
|
require_relative "parfait/data_object"
|
|
|
|
require_relative "parfait/integer"
|
|
|
|
require_relative "parfait/factory"
|
2015-11-18 12:04:25 +02:00
|
|
|
require_relative "parfait/behaviour"
|
|
|
|
require_relative "parfait/class"
|
2019-02-16 23:24:16 +02:00
|
|
|
require_relative "parfait/meta_class"
|
2015-11-18 12:04:25 +02:00
|
|
|
require_relative "parfait/list"
|
|
|
|
require_relative "parfait/word"
|
|
|
|
require_relative "parfait/binary_code"
|
2018-07-07 09:11:09 +03:00
|
|
|
require_relative "parfait/callable"
|
2018-07-07 15:50:43 +03:00
|
|
|
require_relative "parfait/block"
|
2018-07-07 09:11:09 +03:00
|
|
|
require_relative "parfait/callable_method"
|
2017-12-10 20:47:26 +02:00
|
|
|
require_relative "parfait/vool_method"
|
2015-11-18 12:04:25 +02:00
|
|
|
require_relative "parfait/dictionary"
|
2016-02-25 11:50:10 -08:00
|
|
|
require_relative "parfait/type"
|
2018-03-17 19:03:39 +05:30
|
|
|
require_relative "parfait/cache_entry"
|
2015-11-18 12:04:25 +02:00
|
|
|
require_relative "parfait/message"
|
|
|
|
require_relative "parfait/space"
|
2019-09-18 22:36:56 +03:00
|
|
|
module Parfait
|
|
|
|
# temporary shorthand getter for the space
|
|
|
|
# See implementation, space is now moved to inside the Object class
|
|
|
|
# (not module anymore), but there is a lot of code (about 100, 50/50 li/test)
|
|
|
|
# still calling this old version and since it is shorter . . .
|
|
|
|
def self.object_space
|
|
|
|
Object.object_space
|
|
|
|
end
|
2019-09-19 15:48:27 +03:00
|
|
|
|
2019-09-18 22:36:56 +03:00
|
|
|
class Object
|
|
|
|
# redefine the runtime version
|
|
|
|
def self.new( *args )
|
|
|
|
object = self.allocate
|
|
|
|
# have to grab the class, because we are in the ruby class not the parfait one
|
|
|
|
cl = Parfait.object_space.get_class_by_name( self.name.split("::").last.to_sym)
|
|
|
|
# and have to set the type before we let the object do anything. otherwise boom
|
|
|
|
object.set_type cl.instance_type
|
|
|
|
object.send :initialize , *args
|
|
|
|
object
|
|
|
|
end
|
|
|
|
|
|
|
|
# Setter fo the boot process, only at runtime.
|
|
|
|
# only one space exists and it is generated at compile time, not runtime
|
|
|
|
def self.set_object_space( space )
|
|
|
|
@object_space = space
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|