Skip to content

Wrap all native functions in slisp wrappers#177

Merged
skx merged 1 commit into
mainfrom
169-slisp-wrappers
Jul 13, 2026
Merged

Wrap all native functions in slisp wrappers#177
skx merged 1 commit into
mainfrom
169-slisp-wrappers

Conversation

@skx

@skx skx commented Jul 13, 2026

Copy link
Copy Markdown
Owner

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.

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.
@skx skx merged commit 595d219 into main Jul 13, 2026
1 check passed
@skx skx deleted the 169-slisp-wrappers branch July 13, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrap all native functions in slisp

1 participant