~technomancy/fennel#49: 
dofile args are not propagated to ... in compile scope

In file t.fnl do:

(import-macros {: m} (.. ... :m))

And in file m.fnl:

{:m #nil}

Then in REPL:

>> (local fennel (require :fennel))
>> (fennel.dofile "t.fnl" {} "t")
Compile error in t.fnl:1
  [string "t.fnl"]:1: attempt to concatenate a nil value

(import-macros {: m} (.. ... :m))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This also happens with require-macros special.

Status
REPORTED
Submitter
~andreyorst
Assigned to
No-one
Submitted
3 years ago
Updated
3 years ago
Labels
bug macros

~technomancy 3 years ago*

The extra args to fennel.dofile are passed in at runtime as ... for the module, but not at compile time.

Right now at compile time, ... is always bound to the module name and the filename. This matches the runtime behavior of modules that are loaded by fennel.searcher, which is good, but it does not match the runtime behavior of fennel.dofile. We would have to do some kind of extra tracking to propagate these arguments specifically for modules that are not loaded by the searcher.

~rktjmp referenced this from #118 2 years ago

Register here or Log in to comment, or comment via email.