Last active 4 months ago

#142 antifennel: bad code generation 11 days ago

Ticket created by ~xerool on ~technomancy/fennel

In antifennel

    local x = 4

compiles to:

(let [x 4])

which is unable to compile back into lua. I think when antifennel wants generate an empty let block, it instead put nil into the body so that the output can compile.

#133 Non-unifying pattern matching (matchless) 24 days ago

on ~technomancy/fennel

Sorry for the lack of communication on this one! Unfortunately I think we may have some conflict here since ~xerool has been working on this in his branch here: https://git.sr.ht/~xerool/fennel/commit/32d8f6f21ca0479fe57886a6bdbba7120b96bc83

#132 More general match patterns 3 months ago

Ticket created by ~xerool on ~technomancy/fennel

I propose that there be less restrictions on (where) and (or) guards in patterns.

Right now, the match macro's patterns support the following at the top level of the pattern only:

  • (where pat guard1 guard2 ...)
  • (where (or pat1 pat2 ...) guard1 guard2 ...)
  • (pat ? guard1 guard2 ...) (legacy)

I propose this could be more general. What I would like to see different:

  • (where) and (where (or)) can appear anywhere in a pattern
  • new (or pat1 pat2) form without the where, that can be placed anywhere except for inside a (where).

The new form's restriction is there to prevent the problem of combinatorial explosion, where a failing guard would need to backtrack instead of continuing on to the next pattern.

Here are some examples to help explain:

(match ["a" 5]
  ;; new (or) rule
  [(or "a" "b" "c") (or 1 2 3)]
  ;; (where) inside a pattern
  [(where x (= (type x) :string))
   (where y (= (type y) :number))]
  ;; mix and match
  [(where x (= (string.lower x) x))
   (or 1 3 (where n (= (% n 2) 0)))]

(match [[3 5] [1 5] [3 4]]
  ;; Not allowed, matching this pattern requires complex backtracking
  (where [(or [x _] [_ x]) (or [y _] [_ y]) (or [z _] [_ z])]
         (= (+ x y z) 10))

The legacy ? forms would remain the same.

#54 Don't nag the user after restart if they dismissed the IRCv3 banner 3 months ago

Comment by ~xerool on ~emersion/goguma

#100 Copy text from messages 3 months ago

Ticket created by ~xerool on ~emersion/goguma

Currently, it isn't possible to select a message and copy it to the clipboard on Android. I would enjoy if messages were selectable so that copying is possible.

#126 fennel.parser should take in a plugin list 3 months ago

Ticket created by ~xerool on ~technomancy/fennel

Fennel, when used as a library, provides a number of functions in order to call various parts of the compiler. Most of these functions accept, inside an options table, an optional list of plugins that can affect the way the compiler works. Although plugins have the :parse-error hook that affects the way parsing works, the function fennel.parser does not accept a list of plugins. This means the only way to pass an argument to affect the parser is via a function like fennel.compileString which parses and compiles in the same call (I haven't actually verified if this option works), or by calling the compiler via command line and passing a plugin filename as an argument.

Ideally, fennel.parser would be able to simply use the :plugins key from its options table.

#121 allow fennel.view inside of macro sandbox 4 months ago

Ticket created by ~xerool on ~technomancy/fennel

fennel.view is inaccessible when used through the fennel module from inside a macro module. The code fails when instantiating the macro.

(local fennel (require :fennel))
(fn PP [obj]
  `(print ,(fennel.view obj)))
{: PP}

; (import-macros {: PP} :macros)
; (PP [1 2 3]) ===> attempt to call a nil value (field 'view')

Currently, the workaround is to just use the global view, which is accessible inside of module macros, but it shouldn't hurt to add fennel.view to the sandbox.