Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
girvel
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
girvel
2mo ago
I like writing by hand, but I don’t agree with the logic that it’s good because it recruits more areas of the brain. The less effective the medium is, the more of the brain it will recruit; chiseling on a stone tablet is probably a more com
2.
▲
by
girvel
2mo ago
I did not get this argument. Diagrams are nice, and I probably missed something in lisp code (not used to lisp syntax), but I see no argument that Emacs has more service-like interaction with other apps or its plugins than say vim or vscode
3.
▲
by
girvel
2y ago
For example, you want to keep a set of objects -- then the objects themselves would be keys, and values would be true/nil. Or there is a good example in one of ldump's recent issues: https://github.com/girvel/
4.
▲
by
girvel
2y ago
This is fascinating. I wonder if this issue exists in Lua5.2+, where there is no jit and `load` is able to restrict used environment.
5.
▲
by
girvel
2y ago
I looked into it, and Lua allows limiting the environment when `load`ing -- through `env` argument since 5.2 or through setfenv before. I will add a helper function to produce a minimal needed environment for safe loading and a documentatio
6.
▲
by
girvel
2y ago
LOVE2D is a great gamedev framework, I can not recommend it enough. It is so pleasant to work with.
7.
▲
by
girvel
2y ago
I actually thought the comment was about ldump implementation: it uses %q to serialize strings, and it may not be a reliable way.
8.
▲
by
girvel
2y ago
It is intended to be used in cases where you need to store data on a disk or transfer it to another machine -- like in a video game save or a network data exchange
9.
▲
by
girvel
2y ago
On my machine it produces an equivalent string, although differently formatted. It seems that ldump preserves all special characters (`"\a\b\f\n\r\t\v\\\"\'"`), although I will need to test in on all supported versions.
10.
▲
by
girvel
2y ago
Oh wow, didn't expect to meet the author, thank you!
11.
▲
by
girvel
2y ago
Thank you, it is really nice to hear. Though, I have to give credit to Lua's standard library -- the basic function serialization (without upvalues) is implemented there as `string.dump`.
12.
▲
by
girvel
2y ago
This is an interesting thought. Currently, it is unsafe and intended to load only the files you trust. I should definitely include a warning into README. Overall, it would be nice to make it safer. I don't think switching to non-Lua fo
13.
▲
by
girvel
2y ago
Yep, that is correct. I think ldump is able to preserve all upvalues, even on edge cases such as "_ENV" and joined upvalues (multiple functions referencing one upvalue). A closure is basically an object with a single method and up
14.
▲
by
girvel
2y ago
The function (even a closure) would be fully recreated on deserialization, it is fully safe to save it to disk. It wouldn't preserve reference equality -- it would be a new function -- but the behaviour and the state (if using closures
15.
▲
by
girvel
2y ago
Damn, it really would
16.
▲
Show HN: Ldump – serialize any Lua data
(github.com)
96 points
by
girvel
2y ago
|
41 comments