moved the whole parfait into its namespace/module
This commit is contained in:
parent
a552e3fbce
commit
ab870e3323
@ -1,6 +1,6 @@
|
||||
### Parfait: a thin layer
|
||||
|
||||
Parfait is the run-time of the vm.
|
||||
Parfait is the run-time of the **vm**.
|
||||
To be more precise, it is that part of the run-time that can be expressed in ruby.
|
||||
|
||||
The run-time needs to contain quite a lot of functionality for a dynamic system.
|
||||
@ -19,7 +19,7 @@ And thus parfait can be used at run-time.
|
||||
It's too simple: just slips off the mind like a fish into water.
|
||||
|
||||
Parfait has a brother, the Builtin module. Builtin contains everything that can not be coded in ruby,
|
||||
but we stil need (things like array access).
|
||||
but we still need (things like array access).
|
||||
|
||||
#### Example: Message send
|
||||
|
||||
@ -42,3 +42,16 @@ Part of those are some that we just don't allow to be overridden.
|
||||
|
||||
Also what in ruby is object.send is Message.send in salama, as it is the message we are sending and
|
||||
which defines all the data we need (not the object). The object receives, it does not send.
|
||||
|
||||
### Vm vs language- core
|
||||
|
||||
Parfait is not the language (ie ruby) core library. Core library functionality differs between
|
||||
languages and so the language core lib must be on top of the vm parfait.
|
||||
|
||||
Also Parfait is meant to be as thin as humanly possibly, so extra (nice to have) functionality
|
||||
will be in future modules.
|
||||
|
||||
So the Namespace of the Runtime is actually Parfait (not nothing as in ruby).
|
||||
Only in the require does one later have to be clever and see which vm one is running in and either
|
||||
require or not. Maybe one doesn't even have to be so celver, we'll see (as requiring an existing
|
||||
module should result in noop)
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
|
||||
module Parfait
|
||||
class Array < Object
|
||||
#many basic array functions can not be defined in ruby, such as
|
||||
# get/set/length/add/delete
|
||||
@ -18,3 +20,4 @@ class Array < Object
|
||||
# :each_slice, :each_cons, :each_with_object, :chunk, :slice_before, :lazy
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -8,7 +8,9 @@
|
||||
# The Layout lists the names of the instance variables
|
||||
# The class keeps a list of instance methods, these have a name and code
|
||||
|
||||
module Parfait
|
||||
class Class < Module
|
||||
# ruby 2.1 list (just for reference, keep at bottom)
|
||||
#:allocate, :new, :superclass
|
||||
end
|
||||
end
|
||||
|
@ -20,6 +20,7 @@
|
||||
# Also at runtime Messages and Frames remain completely "normal" objects. Ie have layouts and so on.
|
||||
# Which resolves the dichotomy of objects on the stack or heap. Sama sama.
|
||||
|
||||
module Parfait
|
||||
class Frame < Object
|
||||
def initialize locals , temps
|
||||
@locals = locals
|
||||
@ -27,3 +28,4 @@ class Frame < Object
|
||||
end
|
||||
attr_accessor :locals , :tmps
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
# almost simplest hash imaginable. make good use of arrays
|
||||
|
||||
module Parfait
|
||||
class Hash < Object
|
||||
def initialize
|
||||
@keys = Array.new()
|
||||
@ -69,4 +70,4 @@ class Hash < Object
|
||||
# :reverse_each, :each_entry, :each_slice, :each_cons, :each_with_object, :zip, :take, :take_while, :drop, :drop_while,
|
||||
# :cycle, :chunk, :slice_before, :lazy
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
# TODO how this idea works with Numeric ?
|
||||
|
||||
module Parfait
|
||||
class Integer < Value
|
||||
|
||||
# :integer?, :odd?, :even?, :upto, :downto, :times, :succ, :next, :pred, :chr, :ord, :to_i, :to_int, :floor,
|
||||
@ -21,3 +22,4 @@ class Integer < Value
|
||||
# :quo, :to_c, :real, :imaginary, :imag, :abs2, :arg, :angle, :phase, :rectangular, :rect, :polar, :conjugate, :conj,
|
||||
# :>, :>=, :<, :<=, :between?
|
||||
end
|
||||
end
|
||||
|
@ -18,6 +18,7 @@
|
||||
# the Layout is an array of names of length n
|
||||
# Together they turn the object into a hash like structure
|
||||
|
||||
module Parfait
|
||||
class Layout < Object
|
||||
|
||||
# given a name as symbol, return the integer index of that entry
|
||||
@ -29,3 +30,4 @@ class Layout < Object
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
# A message is what is sent when you invoke a method. Args and stuff are packed up in to a Message
|
||||
# and the Message is sent to the receiver.
|
||||
|
||||
module Parfait
|
||||
class Message < Object
|
||||
|
||||
def get_type_for(name)
|
||||
@ -40,3 +41,4 @@ class Message < Object
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -11,6 +11,7 @@
|
||||
# In fact this property is implemented in the Object, as methods
|
||||
# may be added to any object at run-time
|
||||
|
||||
module Parfait
|
||||
class Module
|
||||
# :<, :<=, :>, :>=, :included_modules, :include?, :name, :ancestors, :instance_methods, :public_instance_methods,
|
||||
# :protected_instance_methods, :private_instance_methods, :constants, :const_get, :const_set, :const_defined?,
|
||||
@ -20,3 +21,4 @@ class Module
|
||||
# :private_method_defined?, :protected_method_defined?, :public_class_method, :private_class_method, :autoload,
|
||||
# :autoload?, :instance_method, :public_instance_method
|
||||
end
|
||||
end
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
# that does lead to the fact that we have Reference functions on the Object though
|
||||
|
||||
module Parfait
|
||||
class Object < Value
|
||||
|
||||
def get_type()
|
||||
@ -33,3 +34,4 @@ class Object < Value
|
||||
# BasicObject
|
||||
# :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__
|
||||
end
|
||||
end
|
||||
|
@ -8,6 +8,8 @@
|
||||
# object. The smallest object is usually a cache line, 16 bytes or
|
||||
# an exponent of two larger.
|
||||
|
||||
module Parfait
|
||||
class Page < Object
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -8,8 +8,10 @@
|
||||
# "New" is slightly misleading in that normal operation only ever
|
||||
# recycles objects.
|
||||
|
||||
module Parfait
|
||||
class Space < Object
|
||||
|
||||
# ObjectSpace
|
||||
# :each_object, :garbage_collect, :define_finalizer, :undefine_finalizer, :_id2ref, :count_objects
|
||||
end
|
||||
end
|
||||
|
@ -12,6 +12,7 @@
|
||||
# Value is an abstract class that unifies the "has a type" concept
|
||||
# Types are not "objectified", but are represented as integer constants
|
||||
|
||||
module Parfait
|
||||
class Value
|
||||
|
||||
# to make the machine work, the constants need
|
||||
@ -35,3 +36,4 @@ class Value
|
||||
raise "invalid type"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user