renamed the kernel dir/ module to Builtin (so to not confuse with ruby kernel module)

This commit is contained in:
Torsten Ruger 2014-08-28 18:27:04 +03:00
parent 8c1c72f1c3
commit b8a74f4a77
7 changed files with 22 additions and 24 deletions

17
lib/builtin/README.md Normal file
View File

@ -0,0 +1,17 @@
### Builtin module
The Builtin module contains functions that can not be coded in ruby. It is the other side of the parfait coin, part of
the runtime.
The functions are organized by their respective class and get loaded in boot_classes! , right at the start.
These functions return their code, ie a Virtual::CompiledMethod object, which can then be called by ruby code
as if it were a "normal" function.
A normal ruby function is one that is parsed and transformed to code. But not all functionality can be written in ruby,
one of those chicken and egg things. C uses Assembler in this situation, we use Kernel function.
Slightly more here : http://salama.github.io/2014/06/10/more-clarity.html (then still called Kernel)
The Builtin module is scattered into several files, but that is just so the file doesn't get too long.

View File

@ -1,4 +1,4 @@
module Salama module Builtin
class Array class Array
module ClassMethods module ClassMethods
def get context , index = Virtual::Integer def get context , index = Virtual::Integer

View File

@ -1,5 +1,5 @@
#integer related kernel functions #integer related kernel functions
module Salama module Builtin
module Kernel module Kernel
# The conversion to base10 is quite a bit more complicated than i thought. The bulk of it is in div10 # The conversion to base10 is quite a bit more complicated than i thought. The bulk of it is in div10
# We set up variables, do the devision and write the result to the string # We set up variables, do the devision and write the result to the string

View File

@ -1,4 +1,4 @@
module Salama module Builtin
class Object class Object
module ClassMethods module ClassMethods

View File

@ -1,4 +1,4 @@
module Salama module Builtin
module Kernel module Kernel
def self.putstring context def self.putstring context
function = Virtual::CompiledMethod.new(:putstring , [] ) function = Virtual::CompiledMethod.new(:putstring , [] )

View File

@ -1,4 +1,4 @@
module Salama module Builtin
module Kernel module Kernel
def self.exit context def self.exit context
function = Virtual::CompiledMethod.new(:exit , [] , Virtual::Integer) function = Virtual::CompiledMethod.new(:exit , [] , Virtual::Integer)

View File

@ -1,19 +0,0 @@
### Kernel module
As of writing Kernel is an "old style" module, aka a bunch of functions.
These functions return their code, ie a Register::Function object, which can then be called by ruby code as if it were a "normal"
function.
A normal ruby function is one that is parsed and transformed to code. But not all functionality can be written in ruby,
one of those chicken and egg things. C uses Assembler in this situation, we use Kernel function.
Slightly more here : http://salama.github.io/2014/06/10/more-clarity.html
The Kernal module is scattered into several files, but that is just so the file doesn't get too long.
PS: Old style also means the acual receiver is not used. Kernel function are more like global functions.
PPS: New style is what rails pioneered and has now called Concerns. I call them Aspects, and they not only serve to split
a big file up, but use the receiver and also super, ie the fact that a module gets inserted into the method lookup
sequence in just the same way as an superclass. This solves the old c++ and Java multiple inheritance dilemma.