rename method to typed_method
This commit is contained in:
@ -17,7 +17,7 @@ module Typed
|
||||
# - an object graph containing all the Methods, their classes and Constants
|
||||
#
|
||||
# Some compile methods just add code, some may add Instructions while
|
||||
# others instantiate Class and Method objects
|
||||
# others instantiate Class and TypedMethod objects
|
||||
#
|
||||
# Everything in ruby is an statement, ie returns a value. So the effect of every compile
|
||||
# is that a value is put into the ReturnSlot of the current Message.
|
||||
|
@ -51,7 +51,7 @@ basically meaning pinned to a register, the Message.
|
||||
|
||||
One can think of the Message as an oo replacement of the stack.
|
||||
|
||||
When a Method needs to make a call, it creates a NewMessage object.
|
||||
When a TypedMethod needs to make a call, it creates a NewMessage object.
|
||||
Messages contain return addresses (yes, plural) and arguments.
|
||||
|
||||
The important thing here is that Messages and Frames are normal objects.
|
||||
|
@ -10,7 +10,7 @@ require_relative "parfait/class"
|
||||
require_relative "parfait/list"
|
||||
require_relative "parfait/word"
|
||||
require_relative "parfait/binary_code"
|
||||
require_relative "parfait/method"
|
||||
require_relative "parfait/typed_method"
|
||||
require_relative "parfait/meta_class"
|
||||
require_relative "parfait/variable"
|
||||
require_relative "parfait/dictionary"
|
||||
|
@ -29,7 +29,7 @@ module Parfait
|
||||
end
|
||||
|
||||
def add_instance_method method
|
||||
raise "not a method #{method.class} #{method.inspect}" unless method.is_a? Method
|
||||
raise "not a method #{method.class} #{method.inspect}" unless method.is_a? TypedMethod
|
||||
raise "syserr #{method.name.class}" unless method.name.is_a? Symbol
|
||||
if self.is_a?(Class) and (method.for_class != self)
|
||||
raise "Adding to wrong class, should be #{method.for_class}"
|
||||
|
@ -49,7 +49,7 @@ module Parfait
|
||||
clazz = instance_type().object_class()
|
||||
raise "??? #{method_name}" unless clazz
|
||||
#puts "Self: #{self.class} clazz: #{clazz.name}"
|
||||
add_instance_method Method.new( clazz , method_name , arguments )
|
||||
add_instance_method TypedMethod.new( clazz , method_name , arguments )
|
||||
end
|
||||
|
||||
# this needs to be done during booting as we can't have all the classes and superclassses
|
||||
|
@ -60,7 +60,7 @@ module Parfait
|
||||
def create_instance_method method_name , arguments
|
||||
raise "create_instance_method #{method_name}.#{method_name.class}" unless method_name.is_a?(Symbol)
|
||||
log.debug "Add_method: #{method_name} clazz: #{self.name}"
|
||||
add_instance_method Method.new( self , method_name , arguments )
|
||||
add_instance_method TypedMethod.new( self , method_name , arguments )
|
||||
end
|
||||
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
# A Method (at runtime , sis in Parfait) is static object that primarily holds the executable
|
||||
# code.
|
||||
# A TypedMethod is static object that primarily holds the executable code.
|
||||
# It is called typed, because all arguments and variables it uses are typed.
|
||||
# (Type means basic type, ie integer or reference)
|
||||
|
||||
# It's relation to the method a ruby programmer knows (called RubyMethod) is many to one,
|
||||
# meaning one RubyMethod (untyped) has many TypedMethod implementations.
|
||||
# The RubyMethod only holds ruby code, no binary.
|
||||
|
||||
# For reflection also holds arguments and such
|
||||
|
||||
@ -13,10 +18,10 @@ module Parfait
|
||||
# known local variable names
|
||||
# executable code
|
||||
|
||||
# ps, the compiler injects its own info, see Register::MethodSource
|
||||
# ps, the compiler injects its own info
|
||||
|
||||
|
||||
class Method < Object
|
||||
class TypedMethod < Object
|
||||
|
||||
attributes [:name , :source , :instructions , :binary ,:arguments , :for_class, :locals ]
|
||||
# not part of the parfait model, hence ruby accessor
|
Reference in New Issue
Block a user