Hi! I'm currently trying to write functions annotated by both docstring and metadata.
I've noticed that renaming non-varg arguments using metadata :fnl/arglist in lambda fails.
It's fine in fn on the other hand.
Versions
Fennel: main branch head: 1d38c92e
Lua: PUC Lua 5.3
Minimal examples:
Metadata only cases. No problem.
;; metadata-only.fnl
(macro p [...]
(do (print ...)
'(do :nothing)))
(fn fn-without-arglist-renamed [x]
{:fnl/docstring "docstring"
:fnl/arglist [x]}
(do :something))
(p "OK: fn without arglist renamed")
(fn fn-with-arglist-renamed [x]
{:fnl/docstring "docstring"
:fnl/arglist [y]}
(do :something))
(p "OK: fn with arglist renamed")
(lambda lambda-without-arglist-renamed [x]
{:fnl/docstring "docstring"
:fnl/arglist [x]}
(do :something))
(p "OK: lambda without arglist renamed")
(lambda lambda-with-arglist-renamed [x]
{:fnl/docstring "docstring"
:fnl/arglist [y]}
(do :something))
(p "OK: lambda with arglist renamed")
$ fennel metadata-only.fnl
OK: fn without arglist renamed
OK: fn with arglist renamed
OK: lambda without arglist renamed
OK: lambda with arglist renamed
Mixture of both. Compile error.
;; docstring-and-metadata.fnl
(macro p [...]
(do (print ...)
'(do :nothing)))
(fn fn-without-arglist-renamed [x]
"docstring"
{:fnl/arglist [x]}
(do :something))
(p "OK: fn without arglist renamed")
(fn fn-with-arglist-renamed [x]
"docstring"
{:fnl/arglist [y]}
(do :something))
(p "OK: fn with arglist renamed")
(lambda lambda-without-arglist-renamed [x]
"docstring"
{:fnl/arglist [x]}
(do :something))
(p "OK: lambda without arglist renamed")
(lambda lambda-with-arglist-renamed [x]
"docstring"
{:fnl/arglist [y]}
(do :something))
(p "OK: lambda with arglist renamed")
$ fennel docstring-and-metadata.fnl
OK: fn without arglist renamed
OK: fn with arglist renamed
OK: lambda without arglist renamed
docstring-and-metadata.fnl:27:17 Compile error: unknown identifier: y
{:fnl/arglist [y]}
* Try looking to see if there's a typo.
* Try using the _G table instead, eg. _G.y if you really want a global.
* Try moving this code to somewhere that y is in scope.
* Try binding y as a local in the scope of this code.
Hi! I'm currently trying to write functions annotated by both docstring and metadata. I've noticed that renaming non-varg arguments using metadata
:fnl/arglist
inlambda
fails. It's fine infn
on the other hand.Versions
1d38c92e
Minimal examples:
Metadata only cases. No problem.
Mixture of both. Compile error.