[armedbear-devel] 0.18 and beyond

logicmoo at gmail.com logicmoo at gmail.com
Fri Nov 6 15:37:47 UTC 2009


> 2009/11/6  <logicmoo at gmail.com>:
>>> This also takes SubLObjects, much like our find takes LispObjects. How do
>>> you
>>> wrap the primitive into a SubLObject?
>> You are allowed to pass Primitives into places that take LispObject
>
> Yes, unless you modify the Primitives so that they are static
> functions. That's the
> whole point of all these questions of mine.

Yes something that would be need done to ABCL:  is every primitive would need to be converted to a set of static functions
Then those primitives would then need to wrap the newly created static functions.. A java AST tool is the easiest method.



Here is what is expected to be gained by this very painful process:



Take the case of wanting to pass a Test function as an argument
 (position #\b  "baobab" :test #'CHAR<)    ==>   2
---------------------------------------------------------------------------------------------

A function like #'POSITION that takes a Test argument that receives a Primitive..

So first in ABCL:

In  ABCL Primitive has a _set_ legal execute(),execute(a),execute(a,b),execute(a,b,c), etc
So the implemntation in ABCL defines in java's 'CHAR_LESS_THAN' Primtive a function with
a signature execute(a,b) that is called from the implementation of position.

When #'POSITION is called: the code for position eventually calls  CHAR_LESS_THAN.execute(first,second); for the testing proceedure.

In CYC A Primtive is done the same way
The differnce though is the Primtive intially has no code implementation in it.
Instead a primiivie is a "by-string-reference" pointing to a  _set_ of static implementations that have various method signatures.

// It must select the best static function implmemtation that meets the needs of the caller
 BinaryFunction testFunction = extractBinaryFunc(test);

testFunction object has a .execute(first,second);
     The same way the   CHAR_LESS_THAN.execute(first,second)  works.


By now one asks.. why is this any better than how ABCL does it?
Couldn't they have just passed the Primitive which already implmented the execute(a,b)  right there in code?

The important part first is the simularity. .. both ways perform basically equally in the above example.

ABCL says: "No problem, this is how we normally do things.. we implmenented a primitive.. the primitive has the code. .. #'position 
code calls our primitive over each element in the sequence"

CYC says:  "This is our worse scenario.. we are forced to implemenent a primitive.. the primitive has the code. .. #'position code 
calls our primitive over each element in the sequence"

Both perform equally as well.



-----------------------------------------
Now here is the BIG difference: take this form .. lets say its the users entire program:

(#'CHAR< #\b #\o)


In ABCL we decide to compile it:

 Lisp.intern("CHAR<").getSymbolFunction().evaluate(new LispCharacter('b'),new LispCharacter('o'));

In Cyc we compile as:

CharacterFunctions.primtive_CHAR_LESS_THAN_2_0_false(new LispCharacter('b'),new LispCharacter('o'));

-----------------------------------------

CYC says: "This is our bestcase scenerio.. no late defined symbol function or Primitive objects had to be instanced"

ABCL says: "No problem, this is how we normally do things.. we implmenented a primitive.. the primitive has the code.. now we will 
find the symbol.. create the needed objects.. and run the code".









More information about the armedbear-devel mailing list