Closed Papipo closed 2 months ago
@Papipo i was planning on supporting this via a sigil modifier, e.g.
~LUA"foo()"c
What do you think?
Mmm, the only problem I see is that if there are functions that can receive both a string and a chunk you might forget to add the modifier and just carry strings instead of chunks.
Well, the reason why I didn't do this to start is that the sigil would need to return a tuple of the chunk and the Lua state, similar to Luerl.do
Given that the shape of the return value is much different, I'm not sure it's so much of a concern
Ah, true. I was thinking about luerl_comp.string
, which doesn't need state. It might not be considered public API, though, but I think it's pretty slick to be able to carry portable chunks around.
There is also the option of making chunk the default and string the modifier. But that only makes sense if you can get the chunk without state (via the function stated above).
I think that given that chunks are portable and don't need a state, it might be interesting to use luerl to turn ~LUA usages into Lua chunks. After all, it's inevitable that they will be loaded at some point, so why not have them converted to chunks already?