Wrap all native functions in slisp wrappers#177
Merged
Merged
Conversation
We have two kinds of primitives:
* Those written in assembly-language.
* Those written in slisp.
The latter kind have argument checking, so if you call a function
that requires two arguments with 0, 1, or 3+, you get an error at
compilation time.
However the compiler doesn't know about argument information for
primitives in assembly language - it just blindly converts a call
such as "(car xs)" into:
.. argument setup ..
call fn_car
(There are some transformations applied to change characters in
function-names so "?" becomes QUESTION, etc. But in short a
call to "(xx)" becomes "call fn_xx" at compilation time.)
This pull-request updates 100% of our assembly language
primitives to rename them from "fn_XXX" to "fn_sys_XXX". Then
introduces wrappers such as:
(defun car (xs)
(sys_car xs))
A user might choose to call `(sys_car ..)` directly if they wish,
but mostly they will call `(car ..)` like a normal person - and
now that call will have argument checking.
This closes #169.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have two kinds of primitives:
The latter kind have argument checking, so if you call a function that requires two arguments with 0, 1, or 3+, you get an error at compilation time.
However the compiler doesn't know about argument information for primitives in assembly language - it just blindly converts a call such as "(car xs)" into:
(There are some transformations applied to change characters in function-names so "?" becomes QUESTION, etc. But in short a call to "(xx)" becomes "call fn_xx" at compilation time.)
This pull-request updates 100% of our assembly language primitives to rename them from "fn_XXX" to "fn_sys_XXX". Then introduces wrappers such as:
A user might choose to call
(sys_car ..)directly if they wish, but mostly they will call(car ..)like a normal person - and now that call will have argument checking.This closes #169.