Live data from Hacker News

FLI: A binary interface to let Scheme use Python, Lua, Ruby etc's Library

github.com

11–17 of 17 posts

Re: FLI: A binary interface to let Scheme use Python, Lua, Ruby etc's Library

#11
post #6

Racket has this for C-based APIs. My mind is kind of wondering how this would ever be stable/maintainable to use for Python, but Lua seems possible but I would rather do my scripting in Racket then Lua and use the C APIs directly. https://docs.racket-lang.org/foreign/index.html Looking at Julia (Which has a no "boiler plate" philosophy when using C or Fortan) the function is just called. Interesting to look at for co…

I am researching julia's code.

https://github.com/JuliaPy/PyCall.jl/blob/master/src/PyCall....

I guess it is like this: Importing the pycall library is to turn on the python interpreter thread and not interrupt it. Then you can call any python library you want.

Re: FLI: A binary interface to let Scheme use Python, Lua, Ruby etc's Library

#13
post #6

Racket has this for C-based APIs. My mind is kind of wondering how this would ever be stable/maintainable to use for Python, but Lua seems possible but I would rather do my scripting in Racket then Lua and use the C APIs directly. https://docs.racket-lang.org/foreign/index.html Looking at Julia (Which has a no "boiler plate" philosophy when using C or Fortan) the function is just called. Interesting to look at for co…

> My mind is kind of wondering how this would ever be stable/maintainable to use for Python

CPython has a stable C API for interacting with the interpreter and Python objects. Presumably FLI goes through this API to interoperate with Python, just like any C/C++ application embedding CPython would.

Edit: Yep, https://github.com/guenchi/FLI/blob/master/pycall.sc

Re: FLI: A binary interface to let Scheme use Python, Lua, Ruby etc's Library

#14
post #11
post #6

Racket has this for C-based APIs. My mind is kind of wondering how this would ever be stable/maintainable to use for Python, but Lua seems possible but I would rather do my scripting in Racket then Lua and use the C APIs directly. https://docs.racket-lang.org/foreign/index.html Looking at Julia (Which has a no "boiler plate" philosophy when using C or Fortan) the function is just called. Interesting to look at for co…

I am researching julia's code. https://github.com/JuliaPy/PyCall.jl/blob/master/src/PyCall.... I guess it is like this: Importing the pycall library is to turn on the python interpreter thread and not interrupt it. Then you can call any python library you want.

The GIL is mostly managed by CPython and the host application doesn't touch it directly. Host extension modules may use PyEval_SaveThread et al. just like regular extension modules to release the GIL during blocking operations when called by CPython. There is a separate API for fondling the GIL when you're in a host-created thread (not created by CPython) and want to call CPython. Those are orthogonal (called by CPython vs. calling CPython).

Re: FLI: A binary interface to let Scheme use Python, Lua, Ruby etc's Library

#15
post #12

Can anybody explain how this works ? Is it only works for interpreted languages ?

Every language with FFI has the same ABI. Because they use C Language's ABI to port another language.

Looking at it from another perspective, any language can call another language through this ABI.

So any language with FFI can call any compiled binary code. For interpreted languages, you must embed the runtime (or interpreter).

Re: FLI: A binary interface to let Scheme use Python, Lua, Ruby etc's Library

#16
post #6

Racket has this for C-based APIs. My mind is kind of wondering how this would ever be stable/maintainable to use for Python, but Lua seems possible but I would rather do my scripting in Racket then Lua and use the C APIs directly. https://docs.racket-lang.org/foreign/index.html Looking at Julia (Which has a no "boiler plate" philosophy when using C or Fortan) the function is just called. Interesting to look at for co…

> My mind is kind of wondering how this would ever be stable/maintainable to use for Python CPython has a stable C API for interacting with the interpreter and Python objects. Presumably FLI goes through this API to interoperate with Python, just like any C/C++ application embedding CPython would. Edit: Yep, https://github.com/guenchi/FLI/blob/master/pycall.sc

Yes, it embeds the python interpreter into Scheme via C-api.

Re: FLI: A binary interface to let Scheme use Python, Lua, Ruby etc's Library

#17
post #7

How does Chez Scheme compare vs. CHICKEN Scheme? For a layman, they both seem to compile to binary; Chicken via C, Chez maybe not? Which one has a bigget community? Also, do you know of any static typing extension for Chez?

Chez is by far the fastest of all, similar to LuaJIT. Chicken has more libs.

Static? no, maybe Stalin works on Chez

Post reply on HN