Comments (5)
The error you're seeing is coming from the Fennel compiler; it's saying that you're trying to reference a global that doesn't exist. In fact, interleave
is not a global; the only place it's defined in the Luakit source is inside the label_styles
table here: https://github.com/luakit/luakit/blob/develop/lib/select_wm.lua#L67
But when you run the Lua, it turns out the Lua is able to resolve it somehow. They are probably using a metatable on the _G
globals table to magically resolve it at runtime. This is a weird technique that ends up causing a lot of problems and is best avoided, but in this case it's outside your control to fix.
The simplest way to work around this is to just turn off global checking altogether, but that would make it so the compiler couldn't catch typos, so I don't recommend this. If you try replacing interleave
with _G.interleave
you can bypass the strict global checks just for this one call but still benefit from its checks in the rest of your code; I think that's probably the best workaround for you.
But the best fix is for Luakit to stop doing this provide the function in a module for you to use normally.
Unrelatedly, the last line would be better as this instead: (fn select.label_maker [] (_G.interleave "arst" "neio"))
from fennel.
Thank you! Yes I suspected they were up to some internal funny business.
By prefixing interleave
by _G
the browser actually starts now, but the resetting of label_maker
fails (without crashing the browser). I'm told:
Lua error: attempt to index global '_G' (a nil value)
Nevertheless:
But the best fix is for Luakit to stop doing this provide the function in a module for you to use normally.
I agree.
Unrelatedly, the last line would be better as this instead
Ah so instead of explicitly using tset
, the above form is equivalent to overwriting the function defined with that name in that table?
from fennel.
Oh dear, if they've removed _G altogether then that's probably a lost cause and you'll need to turn off strict global checks altogether. You can do that with: require("fennel").install({allowedGlobals=false}).dofile("/home/colin/.config/luakit/config.fnl")
That goof might be enough to report to them as a bug; they really shouldn't be leaving the globals table out altogether.
from fennel.
It shall be done, that's for the feedback.
Update: Oops... even with allowsGlobals=false
it's still failing, claiming interleave
doesn't exist. Either way I'll still report this upstream.
from fennel.
Mysteriously fixed by following this example: luakit/luakit#782 (comment)
It looks like the lambda label_maker
has multi-arity, and can accept an arg. The arg is a table containing the missing symbols, like interleave
. This is otherwise undocumented but is hinted at in the code.
EDIT: It is technically documented, just very vaguely:
This function is executed on the web process, with a custom environment that provides access to the label composer functions.
from fennel.
Related Issues (20)
- Table literals modified by macros don't get all their fields emitted HOT 2
- Inconsistent handling of commandline arguments HOT 3
- Macro question: Multiple value binding for `local` HOT 5
- Typo in the Wiki page HOT 1
- Official logo/devicon HOT 7
- Strict globals forbid correct code HOT 5
- No --add-package-cpath option HOT 2
- Surprising `match` result on Sequential Table HOT 7
- Emacs: reloading `require` lines HOT 9
- Strange compile error occurred when iterating a table generated by macro in another macro HOT 3
- The require("foo").setup() idiom seems hard to translate to fennel HOT 8
- Key/value table order doesn't seem deterministic HOT 3
- Issue when strings containing @ are simplified HOT 3
- Is 'utf8' module required now? HOT 1
- `comment` macro can leak some code HOT 2
- Incomplete `for` binding table results in bad code generated HOT 1
- Macro treat vararg as first parameter... Unless quoted and unqoted. HOT 5
- Compatibility with Pluto HOT 6
- Cannot use &as with a rest parameter. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fennel.