~technomancy/fennel

Fix IRC failure notifications.

Except it won't actually be fixed until libera stops blocking our CI service.
Makefile and documentation tweaks.
Use stablepairs in the compiler environment for pairs.

Using regular pairs in macros leads to builds which are
nondeterministic; performing a rebuild of exactly the same input can
result in different compiler output.

We take care to use stablepairs in the compiler wherever we're
emitting order-based things based on pairs, because otherwise we get
different results depending on arbitrary factors. But we still had
some macros which used pairs to emit code.

We could expose stablepairs as stablepairs and leave pairs alone,
updating the built-in macros to use stablepairs. But this would mean
that user macros would have to go out of their way to achieve
reproducible builds, whereas we want to encourage reproducible builds
by default. The stablepairs function is slower, but in the context of
macros this shouldn't make much of a difference.

The reason that pairs was made unstable in regular Lua has to do with
avoiding attacks in servers which may receive hostile input that is
used as table keys, but that rationale does not apply to the Fennel
compiler, so it's appropriate to go out of our way to achieve the old
behavior.
bugfix: Allow macros to shadowing other macros

An unintended change in 1.2.0 stopped allowing macros to overwrite or
shadow previously defined macros.

I went ahead and continued to disallow shadowing of specials, since it's
extremely difficult to do this without breaking fennel due to macros not
having access to their own full AST and it can break static analysis;
overriding specials is better achieved via a plugin.

Fixes: https://todo.sr.ht/~technomancy/fennel/134
doto doesn't rebind lone identifiers

Emitted lua is now slightly more clean, and fennel now supports the
pattern (doto ident (set ident value)) when ident is a mutable var.
Use utils.ast-source when calculating sourcemap.

Without this we would see issues where tables that just contained keys
like "line" and "filename" directly would get interpreted as line/file
source info; oops.
fix tests for added fennel.table?

Forgot there were tests for that! Also updated changelog.
add missing `table?` predicate to fennel API
60051f30 — Alys Brooks 20 days ago
Add ,compile REPL command.

Adds the basic logic to compile and print the Lua for a Fennel
expression.

Fixes https://todo.sr.ht/~technomancy/fennel/82

I'm not sure whether several of the other opts could be added somehow
without adding opts to every command function.

Generally ,command with the current set of opts behaves as I expect,
although when disabling strict global checking, the compile command
still operates in strict mode.
Fix parsing of AST nodes which immediately follow a comment.

https://todo.sr.ht/~technomancy/fennel/124

This only manifests as a problem if you parse with comments turned on,
which basically only happens in fnlfmt, but it's actually a bug with
Fennel's own parser. The dispatch function was setting
whitespace-since-dispatch to false even when the thing being
dispatched was a comment (in which case it had already parsed the newline).
tests: remove extranous custom searcher in previous line-# improvement
tests: improve line #'s in test suite's error messages
Mention antifennel from some of the documentation pages.

Also update some links to use https.
Make macros copy lists, but not symbols

In order to keep the AST intact, some macros create modified copies of
their arguments instead of operating on the arguments themselves. This
patch limits those copies to only happen on lists, and not symbols. It
doesn't affect the compiler's output, but makes it friendlier for my
fennel-ls project.

The cases where a symbol gets copied are all performing the same
operation: potentially wrap a symbol in a list if it's not already
wrapped in one, and make sure that the list is "fresh" and not the same
as the input. Previously this seems to be done in a couple ways, but
this patch switches all of them to the same idiom:

```fnl
(if (list? e) (copy e) (list e))
```

If the input is a list, create a copy, otherwise create a fresh list
with the *original* `e`. This way, when `e` is a symbol, it shows up
unchanged in the output of the macro.
Ensure (values) consistently gives zero values.
Bump version to 1.3.0-dev.
Add multi-sym? to the fennel module's public API.
Fix filename check for tables and sequences

propagate-source-info replaces bad source information with good source
information in the output of a macro. However, the check to see if the
source information is relevant assumes that node is a list, and
mistakenly misreads the filename for [] sequences and {} tables. This
means that good source information could possibly be replaced with
subpar information.

This commit changes propagate-source-info so it reads the filename
from the src information instead of directly from the node.
Explain ast quirks in macro guide.
Next