= render "pages/rubyx/menu"

%h1= title "Parfait, a minimal runtime"

RubyX uses the these following classes at compile time to build the base of an object
oriented system.
%p
  In RubyX every object really is an object and data is hidden to the language level.
%p
  Objects have a Type and constant size. See memory for more on memory layout and
  management.

%h3 Types
%ul
  %li every object has a type as it's first variable
  %li types are immutable
  %li an object's type may change at run-time
  %li
    a type describes a class
    %em at a certain time
%p
  If we would be talking about a language, this would be like Javascript, or previously
  =ext_link "Self." , "https://en.wikipedia.org/wiki/Self_(programming_language)"
  Basically rubyx's types would be (immutable) prototypes in a
  =ext_link "prototype based language." , "https://en.wikipedia.org/wiki/Prototype-based_programming"

%p
  It may be easiest to understand types by how they are used. When rubyx parses a class,
  it creates a Sol::ClassExpression, which in turn creates a Parfait::Class. This class carries
  the Sol methods, basically the language code for the methods.
  %br
  At this point a type, representing the object layout as known at the time, is created.
  Parfait::SolMethod are compiled to binary (Parfait::Callable) according to the type information
  and stored in the type.
  %br
  If the class changes at run-time, ie variables are added or removed, a new type object is
  created (with the updated layout) and the same ruby code is compiled to new Parfait::Methods.

%h3 Method, Message and Frame
%p
  The TypedMethod class describes a callable method. It carries a name, argument and local variable
  type and several descriptions of the code:
  %ul
    %li The risc instructions
    %li Cpu level instructions
    %li Binary code
%p
  When TypedMethods are invoked, A message object (instance of Message class) is populated.
  The data in the Message holds the receiver, return addresses, arguments and a frame.
  Frames are also created at compile time and just reused at runtime.
  =link_to "Calling" , "calling.html"
  describes more detail about the calling convention, while
  =link_to "method resolution" ,"method_resolution.html"
  described how the methods are found, mainly at run-time.

%h3 Memory
%p
  The single instance of
  %b Space
  holds a list of all Types and all Classes, which in turn hold
  the methods.
  The space also holds messages and will hold memory management objects like pages.
%p
  %b Pages
  are currently not implemented but will be used to realise the aproach described in
  the page about
  =link_to "memory management." , "memory.html"

%h3 Util
%p
  There are off course several utility classes necessary just to implement the type
  and class system.
  %ul
    %li Words represent short immutable text and other word processing (buffers, text) is still tbd.
    %li Lists (aka Array) are number indexed containers
    %li Dictionaries (aka Hash) are mappings from words to objects.
    %li
      DataObjects are just objects that hold data. Data can not be accessed at the
      language level, only through methods that are programmed at the risc level.
    %li Integers, which are DataObjects that hold data interpreted as an integer