S 33.0 and 'foreign' functions

36 views
Skip to first unread message

Mark Tarver

unread,
Aug 17, 2022, 1:47:28 PM8/17/22
to Shen
The S series kernels are less friendly than the pre-S to the introduction of functions that are not defined within a Shen session.  The S series copes more rigorously with undefined functions than the pre-S (see https://shenlanguage.org/TBoS/tbos_87.html)
and polices the role of partial applications more effectively.  But one casualty is the ability to easily import functions that are part of the native platform.

S 33.0 copes with this by introducing a foreign declaration that usurps the usual S series
protocols and declares the function to be defined outside the session.

e.g. 32.03

Shen, copyright (C) 2010-2020 Mark Tarver
www.shenlanguage.org, Shen Professional Edition 32.03
running under Common Lisp, implementation: SBCL
port 3.2 ported by Mark Tarver
commercially licensed to Mark Tarver

(0-) (foo 1 2 3)
fn: foo is undefined

(1-) (APPEND [1 2 3] [4 5 6])
The value
  (1 2 3)
is not of type
  (OR FUNCTION SYMBOL)
(2-) (cl.kl-to-lisp [f a b])
fn: cl.kl-to-lisp is undefined


cl.kl-to-lisp exists but is buried inside the image.
____________________________________________________________________
Shen, www.shenlanguage.org, copyright (C) 2010-2022, Mark Tarver
version: S33.0, language: Common Lisp, platform: SBCL 2.0.0
port 3.2, ported by Mark Tarver


(0-)  (APPEND [1 2 3] [4 5 6])
The value
  (1 2 3)
is not of type
  (OR FUNCTION SYMBOL)
when binding FUNCTION
(1-) ((foreign APPEND) [1 2 3] [4 5 6])
[1 2 3 4 5 6]

(2-) (cl.kl-to-lisp [f a b])
fn: cl.kl-to-lisp is undefined

(3-) ((foreign cl.kl-to-lisp) [f a b])
[f [QUOTE a] [QUOTE b]]

This is useful in simplifying Yggdrasil which actually needs 'foreign' code to work wrt Lisp.  It seems useful enough to incorporate in a new kernel release.

Expect as a cloud patch in SP and in a kernel release later.

Mark

Mark Tarver

unread,
Aug 19, 2022, 5:50:12 AM8/19/22
to Shen
This is now patched into SP.

Mark

Reply all
Reply to author
Forward
0 new messages