5 ms·
Using _ENV would not be that simple. * The library and template files may have different _ENVs. * The _ENV of the tempalte file could already have an
by pygy_ 16y ago
Using _ENV would not be that simple.
* The library and template files may have different _ENVs.
* The _ENV of the tempalte file could already have an __index.
You'd have to add something like `_ENV = luhtml.makeENV(_ENV)` before your template definitions to take care of this.
The only way to have a clean template file would be to emulate setfenv using the debug library.
--
My main gripe with the current syntax is that, when scanning the code, function declarations and invocations are too similar.
I'd like to have somthing like
:[x] print(x); -> x+1 end
or
:]x[ -> x+1 ]
Both are unambiguous, and would allow to pass a lambda to a function requiring a single argument without parenthesis, like you can already with strings and table litterals.
somefun :]x[ dosomething( x ) ]
I prefer the second syntax because of the initial happy smiley, although it the reversed brackets are alien and would cause an uproar if they were to be added in any popular language.
--
At last, what is discount?
- silentbicycle 16y agoDiscount (http://www.pell.portland.or.us/~orc/Code/discount/ http://www.pell.portland.or.us/~orc/Code/discount/) is a very fast, C-based implementation of Markdown (http://daringfireball.net/projects/markdown/ http://daringfireball.net/projects/markdown/). I have a Lua wrapper for it, but just noticed that I don't have it on my github page. I'll post it soonish. Somebody else has a Lua wrapper for an older version of discount, but includes the discount source in it (!), and it's been updated due to security-related bugs, so that's out. Talking about reversed brackets, look at J (http://www.jsoftware.com/ http://www.jsoftware.com/). The only language I've seen that uses ], [, {, and } as unpaired operators. Pretty serious heresy. Cool language, though.
- pygy_ 16y agoThanks for all that :)