Hacker News new | past | comments | ask | show | jobs | submit login

>You're usually better off using coroutines for this sort of asynchronous programming in Lua.

Macros and coroutines don't solve the same problem here. Macros provide wrappers that make "callbacks" implicit; coroutines provide scheduling.

>Also, Lua doesn't have macros, at least not in the sense that Lisp and Prolog do. It just has eval.

http://metalua.luaforge.net/

I object!




I wondered if you meant Metalua. That's a different dialect, like OCaml vs. SML different. Standard Lua doesn't have macros, and the packages I've seen that add them (such as Luma, http://luaforge.net/projects/luma/) do so via eval.

I haven't done that much with Metalua - I don't really feel that Lua's lacking macros is a major problem, really, though I like the author's views on metaprogramming ("Make it obvious when something interesting happens", etc.). I remember looking at it a year or so ago, but didn't get into it.

I just gave it a quick stab at porting, and I remember why - "Prerequisites - a 32 bits, little endian CPU" - I tend to switch back and forth between a couple OSs and hardware platforms, and Lua's portability is a big bonus for me. Adding a couple ML-ish features to Lua would be tempting, though.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: