~technomancy

WA, USA

https://technomancy.us

tryin' to catch the last train out of Omelas

~technomancy/fennel

Last active a day ago
View more

Recent activity

[ANN] Fennel 0.9.2 released 9 days ago

From Phil Hagelberg to ~technomancy/fennel

Hello Fennelers!

I'm happy to announce the release of Fennel 0.9.2. All the changes here
were pretty minor bug fixes, but they add up.

## 0.9.2 / 2021-05-17

* Add Fennel for Clojure Users guide
* Never treat `_ENV` as an unknown global
* Fix multi-value destructuring in pattern matches that use `where`
* Fix a bug around disambiguating parens in method calls
* Improve behavior of `?.` when used directly on nil
* Fix a bug where line number correlation was thrown off in macros
* Fix a bug where `--use-bit-lib` was not propagating to the REPL

Re: [PATCH] compiler: allow strings at call position 10 days ago

From Phil Hagelberg to ~technomancy/fennel

Andrey Listopadov <andreyorst@gmail.com> writes:

> Strings can possibly have a __call metamethod, and it's actually
> possible to call strings in Lua with the following notation:
> `("str")(...)`.  This patch adds a check if AST element at call
> position is a string, and if it is, it is wrapped in parentheses to
> ensure correct Lua syntax.

Thanks; applied and pushed.

-Phil

[PATCH] Don't double-uniquify gensyms. 12 days ago

From Phil Hagelberg to ~technomancy/fennel

Gensyms already have uniqueness checks, so they can skip the extra
uniqueness checks from declare-local.

This should fix https://todo.sr.ht/~technomancy/fennel/54
---
 src/fennel/compiler.fnl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/fennel/compiler.fnl b/src/fennel/compiler.fnl
index 023d63b..349f270 100644
--- a/src/fennel/compiler.fnl
+++ b/src/fennel/compiler.fnl
@@ -24,7 +24,8 @@ implement nesting. "
     :specials (setmetatable [] {:__index (and parent parent.specials)})
[message trimmed]

Re: [PATCH] Support short version flag (-v) 13 days ago

From Phil Hagelberg to ~technomancy/fennel

Jack Hill <jackhill@jackhill.us> writes:

> * src/launcher.fnl: Match on -v in addition to --version to print the
> version information.

Thanks but it looks like someone beat you to this; sorry!

-Phil

Re: Minetest 25 days ago

From Phil Hagelberg to ~technomancy/fennel

vapnik spaknik <vapniks@yahoo.com> writes:

> I came here looking for a way to create minetest mods using lisp; I'm
> not sure how to access all the minetest functions from within fennel.
> I notice there is a link to the minetest website on
> https://fennel-lang.org, but I can't find any other information about
> minetest on that website, or the wiki, or the mailing list archives.
> Was it just a nice hypothetical idea, or has someone actually
> succeeded in doing this (using fennel to write minetest mods).

I've written a proof of concept minetest mod but nothing significant yet.
It was a while ago now tho, and I can't find the source. But it worked fine.

The Minetest API is just like any other Lua API. You can call its

[ANN] Fennel 0.9.1 released a month ago

From Phil Hagelberg to ~technomancy/fennel

Hello folks!

Just wanted to let you know that Fennel 0.9.1 has been released. It
contains one single bugfix:

## 0.9.1 / 2021-04-10

* Fix a bug in compiled output for statement separators in LuaJIT

You can read more about it here: https://todo.sr.ht/~technomancy/fennel/52

Basically the previous version could emit code that would be rejected by
LuaJIT (but not PUC Lua) in certain cases where you had a method call as
the first thing in a function.

[ANN] Fennel 0.9.0 released a month ago

From Phil Hagelberg to ~technomancy/fennel

Greetings everyone!

I'm happy to announce the release of Fennel 0.9.0. We've racked up quite
a few changes, but none of them are particularly major or groundbreaking:

* Add `--use-bit-lib` flag to allow bitwise operations to work in LuaJIT
* Add `macro-searchers` table for finding macros similarly to `package.searchers`
* Support `&as` inside pattern matches
* Include stack trace for errors during macroexpansion
* The `sym` function in compile scope now takes a source table second argument
* Support `:until` clauses for early termination in all loops
* Support `:escape-newlines?` and `:prefer-colon?` options in fennel.view
* Add nil-safe table access operator `?.`
* Add support for guards using `where`/`or` clauses in `match`

[PATCH] Add support for fennel.macro-searchers. a month ago

From Phil Hagelberg to ~technomancy/fennel

We now have a fennel.macro-searchers table which functions as a
compile-time equivalent to the package.searchers table; anyone can
insert their own searcher functions to change how macros can be found.

The main thing I don't like about this is that it exposes our little
internal trick of passing :env :_COMPILER in the options table to load
things in compiler scope. We have supported this for the environment
for internal reasons for a while, but now we both expand it (to also
affect :scope) and document it as part of the interface, in order to
simplify the implementation of the default macro searcher function.

I don't love that trick; it was originally added in order to allow us
to load plugins in compiler scope without reaching into the guts of
the compiler module, but it feels like a bit of a hack.
[message trimmed]

Chained failure handling a month ago

From Phil Hagelberg to ~technomancy/fennel

One common problem in the Lua ecosystem is composing together successive
calls to functions which may fail and use the "return nil, msg" idiom to
indicate failure. One easy solution is to wrap all these calls in `assert`
to turn them into errors, but that's not always appropriate. Without
assert, in Lua you often see cases like this:

```lua
local ok, val = might_fail(a, b)
if not ok then
  return nil, val
end

local ok2, val2 = pcall(also_might_fail, val, c)
if not ok2 then

Re: [PATCH] Propagate error messages in -?> and -??> macros. a month ago

From Phil Hagelberg to ~technomancy/fennel

Phil Hagelberg <phil@hagelb.org> writes:

> This changes the nil-safe threading macros to be more useful in chains
> involving functions which use the nil,msg pattern to indicate an
> error. For instance, previously this would have only printed nil, but
> now it prints nil along with the error message.

Talking this thru a little more, I think the limitation of only
returning two values here is a mistake. In particular there are certain
libraries that return nil, msg, error-code when there is a problem. The
existing implementation could just bump it to hard-coding three values,
but that seems tacky.

We can't support an arbitrary number of values without performance