~technomancy

WA, USA

https://technomancy.us

tryin' to catch the last train out of Omelas

Trackers

~technomancy/fennel

Last active a month ago

#185 [fennel-mode] flymake support a month ago

Comment by ~technomancy on ~technomancy/fennel

The functionality you're describing is already available thru eglot and fennel-ls: flymake-based linting that provides warnings instead of just errors, and continuing on even past the first error, and more.

It would be possible to add a mode to the compiler which could continue in the face of an error, but it feels a bit redundant when fennel-ls already does a much better job of this.

It would be possible to wire fennel-mode directly into fennel-ls without using eglot, but again, it's a lot of work to achieve something we already have.

So it's hard to understand what the best approach would be without understanding what you're trying to avoid from the existing implementation.

#184 each stops when nil is encountered a month ago

Comment by ~technomancy on ~technomancy/fennel

REPORTED RESOLVED CLOSED

#184 each stops when nil is encountered a month ago

Comment by ~technomancy on ~technomancy/fennel

Yes, or if you don't care about ordering, then you can use pairs instead of ipairs.

#184 each stops when nil is encountered a month ago

Comment by ~technomancy on ~technomancy/fennel

I can see how this would be confusing. The behavior you're seeing is not part of each; it's actually coming from Lua's ipairs function. The ipairs function is documented as starting at 1 and stopping at the first nil value. Fennel doesn't have any control over how that works; we get the behavior of Lua whether we want it or not.

However, the documentation for collect/icollect says that nils are omitted in a way that is analogous to filter in other languages.

Yes, but that's referring to nil values in the output rather than the values that come from the iterator.

#182 Option to retain comments when compiling/decompiling Fennel/Lua 2 months ago

Comment by ~technomancy on ~technomancy/fennel

No, I don't really trust it enough to turn it on by default yet, so See Fennel doesn't have it.

#138 REPL should have access to results from previous expressions 2 months ago

Comment by ~technomancy on ~technomancy/fennel

I needed this for another feature so I went ahead and added it.

REPORTED RESOLVED IMPLEMENTED

#182 Option to retain comments when compiling/decompiling Fennel/Lua 4 months ago

enhancement added by ~technomancy on ~technomancy/fennel

#182 Option to retain comments when compiling/decompiling Fennel/Lua 4 months ago

antifennel added by ~technomancy on ~technomancy/fennel

#182 Option to retain comments when compiling/decompiling Fennel/Lua 4 months ago

Comment by ~technomancy on ~technomancy/fennel

I've pushed out further improvements on the antifennel side on the main branch; if you use antifennel please give them a try. Note that you have to include a --comments flag in the command in order to activate the new behavior.

#182 Option to retain comments when compiling/decompiling Fennel/Lua 4 months ago

Comment by ~technomancy on ~technomancy/fennel

I've just pushed some changes to antifennel to support this on regular statement-level comments. Adding support for multi-line comments should be easy, but adding support for comments inside expression contexts (including tables) will undoubtedly be much more difficult. (I did the equivalent in fnlfmt, and it turned out to be one of the most difficult parts of the whole thing.) It is likely still possible to break antifennel now by putting a comment in an unexpected non-statement spot.

https://git.sr.ht/~technomancy/antifennel/commit/c956a25e5b3c0c3076025770aa21d377f67532ee

Doing this in fennel ... is quite hard. If you want the comments to be conveyed by the AST, then they have to take up space in the AST.

(each ; this next bit is an iterator
  [i (ipairs t)]
  (print i))

This is fine as long as all you're doing is parsing, but if the comment node exists in the AST then you'll get: "Compile error: expected binding table" because the comment node is the second element of the list.

So putting comments inside the AST will break everything. It would be necessary to find ... somewhere else for them, I guess? The metatable can't be used for this consistently across all places that comments can be, so you would need a weak table.

I have my doubts as to whether this can be done cleanly in the compiler. I would lean towards using a plugin for this.