[E-Dev-Day-US-2015][9/9] High Level Application Development with Elua (Daniel Kolesa)
at Enlightenment Developers Day North America 2015
https://phab.enlightenment.org/w/events/enlightenment_developer_day_us_2015/
A Secure and Reliable Document Management System is Essential.docx
[E-Dev-Day-US-2015][9/9] High Level Application Development with Elua (Daniel Kolesa)
1. High Level Application Development
with Elua
... or what happens when C sucks too much
Daniel Kolesa
Samsung Open Source Group
d.kolesa@samsung.com
@octaforge
EFL Developer Day US 2015
10. Why do most scripting languages suck?
Slow
Lack of a proper type system
11. Why do most scripting languages suck?
Slow
Lack of a proper type system
Tons of useless bloat we don’t need
12. Why do most scripting languages suck?
Slow
Lack of a proper type system
Tons of useless bloat we don’t need
Inherently sucky to bind
13. Why do most scripting languages suck?
Slow
Lack of a proper type system
Tons of useless bloat we don’t need
Inherently sucky to bind
Resource heavy
14. Why do most scripting languages suck?
Slow
Lack of a proper type system
Tons of useless bloat we don’t need
Inherently sucky to bind
Resource heavy
Battery eating
15. Why do most scripting languages suck?
Slow
Lack of a proper type system
Tons of useless bloat we don’t need
Inherently sucky to bind
Resource heavy
Battery eating
Let’s still give them a shot
45. JavaScript
Popular these days
Fairly decent quality JIT implementations
Weird APIs
Language is pretty bad
But probably a better choice than the above
49. Io, Self, Squirrel etc.
Many different choices
Mostly slow interpreters
Some are decent-ish languages
50. Io, Self, Squirrel etc.
Many different choices
Mostly slow interpreters
Some are decent-ish languages
Mostly fairly light on resources
51. Io, Self, Squirrel etc.
Many different choices
Mostly slow interpreters
Some are decent-ish languages
Mostly fairly light on resources
Not good enough
52. Io, Self, Squirrel etc.
Many different choices
Mostly slow interpreters
Some are decent-ish languages
Mostly fairly light on resources
Not good enough
People would look at us weird
57. Lua
A popular scripting language
Fairly good language with a few quirks
Light on resources
Great embedding API
58. Lua
A popular scripting language
Fairly good language with a few quirks
Light on resources
Great embedding API
Interpreted... :(
59. Lua
A popular scripting language
Fairly good language with a few quirks
Light on resources
Great embedding API
Interpreted... :(
LuaJIT saves the day
61. Why is LuaJIT awesome?
One of the fastest JIT compilers around
62. Why is LuaJIT awesome?
One of the fastest JIT compilers around
Very light on resources
63. Why is LuaJIT awesome?
One of the fastest JIT compilers around
Very light on resources
Performance close to C for real world scenarios
64. Why is LuaJIT awesome?
One of the fastest JIT compilers around
Very light on resources
Performance close to C for real world scenarios
The exact same API as Lua!
65. Why is LuaJIT awesome?
One of the fastest JIT compilers around
Very light on resources
Performance close to C for real world scenarios
The exact same API as Lua!
API and ABI compatible with Lua 5.1
66. Why is LuaJIT awesome?
One of the fastest JIT compilers around
Very light on resources
Performance close to C for real world scenarios
The exact same API as Lua!
API and ABI compatible with Lua 5.1
Portable bytecode
67. Why is LuaJIT awesome?
One of the fastest JIT compilers around
Very light on resources
Performance close to C for real world scenarios
The exact same API as Lua!
API and ABI compatible with Lua 5.1
Portable bytecode
We have a winner
70. Why LuaJIT sucks
VM written in assembly - only a handful of architectures
OTOH, it’s good enough
71. Why LuaJIT sucks
VM written in assembly - only a handful of architectures
OTOH, it’s good enough
Classic Lua C API is not JITed
72. Why LuaJIT sucks
VM written in assembly - only a handful of architectures
OTOH, it’s good enough
Classic Lua C API is not JITed
A handful of other things not JITed
73. Why LuaJIT sucks
VM written in assembly - only a handful of architectures
OTOH, it’s good enough
Classic Lua C API is not JITed
A handful of other things not JITed
No multithreading support
74. Why LuaJIT sucks
VM written in assembly - only a handful of architectures
OTOH, it’s good enough
Classic Lua C API is not JITed
A handful of other things not JITed
No multithreading support
LuaJIT 2.1 significantly improves the situation
82. What is it supposed to achieve?
Rapid application development
83. What is it supposed to achieve?
Rapid application development
Clean, high level code
84. What is it supposed to achieve?
Rapid application development
Clean, high level code
Lightweight, good performance
85. What is it supposed to achieve?
Rapid application development
Clean, high level code
Lightweight, good performance
Easier app distribution (app store model)
86. What is it supposed to achieve?
Rapid application development
Clean, high level code
Lightweight, good performance
Easier app distribution (app store model)
More safety (memory etc.)
89. How does it work?
Elua library and binary
Library provides Elua-related C utilities for the Lua state
90. How does it work?
Elua library and binary
Library provides Elua-related C utilities for the Lua state
Binary is a minimal application launcher
91. How does it work?
Elua library and binary
Library provides Elua-related C utilities for the Lua state
Binary is a minimal application launcher
Together they set up Lua state + ecore main loop
92. How does it work?
Elua library and binary
Library provides Elua-related C utilities for the Lua state
Binary is a minimal application launcher
Together they set up Lua state + ecore main loop
Most of Elua is written in Lua itself
100. Eolian
Eolian parses our API definitions
We can reuse Eolian data to generate correct Lua bindings
101. Eolian
Eolian parses our API definitions
We can reuse Eolian data to generate correct Lua bindings
No maintenance burden except the generator itself
105. Lualian
Lualian is the Elua binding generator
Itself a Lua application powered by Elua
Easy to maintain and high level
106. Lualian
Lualian is the Elua binding generator
Itself a Lua application powered by Elua
Easy to maintain and high level
Bindings generated at EFL build time
113. Eo
We have a Lua Eo layer
This provides a native-feeling Eo Lua core
114. Eo
We have a Lua Eo layer
This provides a native-feeling Eo Lua core
Handles callbacks, method resolution and other things
115. Eo
We have a Lua Eo layer
This provides a native-feeling Eo Lua core
Handles callbacks, method resolution and other things
Generated bindings properly register bound classes with this
116. Eo
We have a Lua Eo layer
This provides a native-feeling Eo Lua core
Handles callbacks, method resolution and other things
Generated bindings properly register bound classes with this
Native-feeling APIs!
119. Other Elua APIs
Elua also provides a collection of Lua utilities
This includes a Lua-side object system
120. Other Elua APIs
Elua also provides a collection of Lua utilities
This includes a Lua-side object system
Also bindings to most relevant Eina components
121. Other Elua APIs
Elua also provides a collection of Lua utilities
This includes a Lua-side object system
Also bindings to most relevant Eina components
Used by bindings
122. Other Elua APIs
Elua also provides a collection of Lua utilities
This includes a Lua-side object system
Also bindings to most relevant Eina components
Used by bindings
Eo interacts with our Lua-side object system
123. Other Elua APIs
Elua also provides a collection of Lua utilities
This includes a Lua-side object system
Also bindings to most relevant Eina components
Used by bindings
Eo interacts with our Lua-side object system
Completely transparent
127. Distribution
Bundled with EFL → always available
App store to promote development and distribution of apps
Well supported - encouraging people to write apps
128. Distribution
Bundled with EFL → always available
App store to promote development and distribution of apps
Well supported - encouraging people to write apps
Closely matching EFL APIs → free documentation
129. Distribution
Bundled with EFL → always available
App store to promote development and distribution of apps
Well supported - encouraging people to write apps
Closely matching EFL APIs → free documentation
Needs self-contained package format (use eet?)
130. Distribution
Bundled with EFL → always available
App store to promote development and distribution of apps
Well supported - encouraging people to write apps
Closely matching EFL APIs → free documentation
Needs self-contained package format (use eet?)
Make it possible to run Elua apps on Tizen?
144. Eo files
Our current Eo files are not complete
Missing enum definitions, structs etc.
145. Eo files
Our current Eo files are not complete
Missing enum definitions, structs etc.
Complete Eo files → validation is possible
146. Eo files
Our current Eo files are not complete
Missing enum definitions, structs etc.
Complete Eo files → validation is possible
Guaranteed definitions for types etc.
147. Eo files
Our current Eo files are not complete
Missing enum definitions, structs etc.
Complete Eo files → validation is possible
Guaranteed definitions for types etc.
Allows for proper binding generation
149. What does this all mean?
Our bindings are currently not fully functional
150. What does this all mean?
Our bindings are currently not fully functional
Many will fail to load because of missing type definitions
151. What does this all mean?
Our bindings are currently not fully functional
Many will fail to load because of missing type definitions
Dependencies are not correctly handled
152. What does this all mean?
Our bindings are currently not fully functional
Many will fail to load because of missing type definitions
Dependencies are not correctly handled
Elementary is not handled at all
153. What does this all mean?
Our bindings are currently not fully functional
Many will fail to load because of missing type definitions
Dependencies are not correctly handled
Elementary is not handled at all
Our demos work with what we have + manually adjusted
bindings
159. Other issues
Internationalization and localization
Loading files from VFS/Eet and seamless API for that
Sandboxing
Startup time minimization
Portable bytecode loading
168. EFL 1.15
Correctly working bindings without manual modifications
Maybe just wishful thinking
Gotta get as close as possible
169. EFL 1.15
Correctly working bindings without manual modifications
Maybe just wishful thinking
Gotta get as close as possible
EFL interfaces should be mostly designed
170. EFL 1.15
Correctly working bindings without manual modifications
Maybe just wishful thinking
Gotta get as close as possible
EFL interfaces should be mostly designed
Properly validating Eo files
179. EFL 1.17
Further Bob work
Bob should start matching Edje in functionality
Deprecation of non-luajit EFL builds
180. EFL 1.17
Further Bob work
Bob should start matching Edje in functionality
Deprecation of non-luajit EFL builds
Wider testing of Elua/Bob
181. EFL 1.17
Further Bob work
Bob should start matching Edje in functionality
Deprecation of non-luajit EFL builds
Wider testing of Elua/Bob
Initial Elua based applications!
184. EFL 2.0
Will take a while (several 1.x releases before that)
Things have to be rock solid by then
185. EFL 2.0
Will take a while (several 1.x releases before that)
Things have to be rock solid by then
A lot of work
186. EFL 2.0
Will take a while (several 1.x releases before that)
Things have to be rock solid by then
A lot of work
Bob will be a thing
187. EFL 2.0
Will take a while (several 1.x releases before that)
Things have to be rock solid by then
A lot of work
Bob will be a thing
Deprecation of Edje
192. Entry point
Everything starts in the Elua launcher
Lua state gets initialized
Elua supports application lookup path
193. Entry point
Everything starts in the Elua launcher
Lua state gets initialized
Elua supports application lookup path
Apps get executed
194. Entry point
Everything starts in the Elua launcher
Lua state gets initialized
Elua supports application lookup path
Apps get executed
Ecore main loop is started
198. Module system
Elua provides a custom module system that works outside of
Lua’s
Seamless (replaces require)
Modules support init/shutdown callbacks
199. Module system
Elua provides a custom module system that works outside of
Lua’s
Seamless (replaces require)
Modules support init/shutdown callbacks
Those take care of opening and closing the appropriate libs
202. Library system
C libraries are opened and initialized as necessary
Opened C libraries are cached and reference counted
203. Library system
C libraries are opened and initialized as necessary
Opened C libraries are cached and reference counted
Eolian-generated bindings use this
204. Library system
C libraries are opened and initialized as necessary
Opened C libraries are cached and reference counted
Eolian-generated bindings use this
Symbols are retrieved and bound using C FFI
205. Library system
C libraries are opened and initialized as necessary
Opened C libraries are cached and reference counted
Eolian-generated bindings use this
Symbols are retrieved and bound using C FFI
This is wrapped in high level API (no FFI exposed to apps)
209. Eina bindings
Elua provides hand-bound APIs from Eina
Containers are read only
Provides APIs to convert them to Lua values
210. Eina bindings
Elua provides hand-bound APIs from Eina
Containers are read only
Provides APIs to convert them to Lua values
Various modules like accessor, iterator, list, log, file etc.
211. Eina bindings
Elua provides hand-bound APIs from Eina
Containers are read only
Provides APIs to convert them to Lua values
Various modules like accessor, iterator, list, log, file etc.
Will be further expanded as necessary
214. Other modules
Elua includes a benchmarking module in core
Also features a powerful command line argument parser
215. Other modules
Elua includes a benchmarking module in core
Also features a powerful command line argument parser
Lualian is included
216. Other modules
Elua includes a benchmarking module in core
Also features a powerful command line argument parser
Lualian is included
A custom module system implementation
217. Other modules
Elua includes a benchmarking module in core
Also features a powerful command line argument parser
Lualian is included
A custom module system implementation
Util module provides an object system, library system, string
buffer implementation and other utils