~technomancy/fennel

Discussion of the Fennel programming language for contributors and users

https://fennel-lang.org

1

Fennel -> Hammerspoon repl

Ag Ibragimov
Details
Message ID
<m1v9yka216.fsf@gmail.com>
Sender timestamp
1557362741
DKIM signature
pass
Download raw message
Hi, I just rewrote my entire Hammerspoon configuration using Fennel and I can't be happier. Fennel is awesome. Now I want even more out of it. I'm thinking if it would be possible to have a Fennel REPL that compiles and evals by sending forms to Hammerspoon's IPC. I doubt that anyone has ever tried that before, any hints how I can build something like this would be appreciated. Thanks!
Details
Message ID
<87mujrufwl.fsf@hagelb.org>
In-Reply-To
<m1v9yka216.fsf@gmail.com> (view parent)
Sender timestamp
1557722362
DKIM signature
missing
Download raw message
Ag Ibragimov <agzam.ibragimov@gmail.com> writes:

> Hi, I just rewrote my entire Hammerspoon configuration using Fennel
> and I can't be happier. Fennel is awesome. Now I want even more out of
> it. I'm thinking if it would be possible to have a Fennel REPL that
> compiles and evals by sending forms to Hammerspoon's IPC. I doubt that
> anyone has ever tried that before, any hints how I can build something
> like this would be appreciated. Thanks!

Sure; you can start a repl that has the read/write functions overridden
to use another function other than io.read and io.write; for instance,
something that communicates over IPC. Here is an example of how the repl
on fennel-lang.org does it; in that case the repl runs in a coroutine
which gets resumed when the enter button is pressed in the input
element, but depending on how your IPC API looks it could be simpler.

  https://github.com/technomancy/fennel-lang.org/blob/master/repl.fnl#L73

-Phil