Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for calling golang standard library functions, via reflection. #139

Open
skx opened this issue Apr 27, 2023 · 0 comments
Open
Assignees
Labels
wontfix This will not be worked on

Comments

@skx
Copy link
Owner

skx commented Apr 27, 2023

It would be nice to call (strings.ToUpper "foo") and similar functions, for example.

This would involve a lot of massaging of types, and the use of reflection.

Doing this would allow us to replace (upper), (sin), and many other functions with their native alternatives. Though we'd probably want to setup some alias system to avoid user-visible changes.

@skx skx self-assigned this Apr 27, 2023
skx added a commit that referenced this issue Apr 28, 2023
This is a proof of concept for calling golang functions from yal,
via the use of reflection.  There's a bit of overhead in massaging
the types into suitable forms - both for arguments, and results,
but the core idea seems reasonable.

With this built and installed you can run:

```lisp
> (path.Glob "/etc/p*")
((/etc/pam.conf /etc/pam.d /etc/papersize /etc/passwd /etc/passwd- /etc/passwd.org /etc/perl /etc/pipewire /etc/pki /etc/plymouth /etc/pm /etc/pnm2ppa.conf /etc/polkit-1 /etc/ppp /etc/printcap /etc/profile /etc/profile.d /etc/protocols /etc/pulse /etc/puppet /etc/purple /etc/python /etc/python3 /etc/python3.5 /etc/python3.7 /etc/python3.9) nil)
```

Needs more work in deciding what to add, and better conversion routines.
(c.f. evalfilter).

But this updates #139.
@skx skx added the wontfix This will not be worked on label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant