|
|
|
|
|
by rasterman
3547 days ago
|
|
well we already did the integration. it doesn't need exposing. it's meant to be handled by the bindings for that runtime environment specifically or is just always available. so it merges currently with glib mainloop and with libuv so if you run the ecore mainloop you ALSO have (optionally as long as efl is compiled with these) a glib and a libuv loop too merged together as one, so they all are then compatible and work at the same time. yes - it requires the app spin up the ecore mainloop (it actually is the efl.loop now) instead of another, but existing code that uses the 'native mainloop' for that runtime will continue to happily work just as it was working before in that runtime env, but as lua never provided a mainloop, then we're it along with glib if you want and/or libuv. the integration is done down in the c code for the efl loop. for lua there IS not native mainloop as there is no native lua runtime (beyond a sample lua cmdline), and by this i contrast it to something like node.js. we provide one (elua) that will load in the bindings stubs for you and thus work. we do this because lua itself unlike something like node.js or python doesn't push the idea of "a single lua executable to run all lua runtimes". it has demo/sample/test executors, but it is built as a library primarily to then be embedded into another runtime. we happen to provide a guaranteed runtime binary too. there are very good reasons for this for the future, like being able to package up applications into archives (like .apk for android, .jar or java etc.) as we already have a whole archive library (eet) that handles random access read (and decompress), so this would allow for lua apps to be shipped as single file archives with all script AND data files (images, theme data, videos, icons and more) in a single file just dropped into a directory with no extra dependencies or tools needed. to do this we need something like elua. our whole intent is to actually become a portable cross-platform toolkit where you do not need external plugins, binaries, libraries and can build a portable application that "just works" on multiple OS's without needing to instruct people on how to install 3rd party dependencies. also so far we've supported both luajit and puc lua (and intend to drop puc lua because of ffi and a few other niggles) so this is a big problem as to which executable then gets used? different names. lua va luajit. how do you run things "by default" and know it will work and which one will be installed? part of our build uses elua and lua scripts to generate documentation so how could we run our doc generator when we don't know what executor is there on the host? we'd have to add more detection and have file.lua.in files where #!/bin/whatever is replaced with the correct lua etc. ... not pretty where now #!/bin/env elua will do fine. |
|
In lua it is customary to bring along your own main loop.
People often start with one based on select, but later move to libevent, libev, cqueues, luv (libuv), glib or others.
> for lua there IS not native mainloop
Neither is there for C.
> as there is no native lua runtime (beyond a sample lua cmdline)
The 'sample' lua application is quite often used as a runtime; if your library can't be used from it, it won't be useful for the majority of developers.
> we provide one (elua) that will load in the bindings stubs for you and thus work
In elua you still have to load in the bindings yourself (via require).
> there are very good reasons for this for the future, like being able to package up applications into archives (like .apk for android, .jar or java etc.)
I have no idea how this is related. lua already has tools to pack resources into one executable (e.g. srlua). but you can use any tool/method you want. This doesn't dictate the main loop used in any way.
> how do you run things "by default" and know it will work and which one will be installed?
you just use #!/usr/bin/env lua. Which will pick up whatever the user/distro has picked (e.g. a user might use debian update-alternatives). If you need a particular version of lua, use `#!/usr/bin/env lua5.1` which is the generally accepted shebang.