On Tue, 2015-08-25 at 16:14 +0300, Nikolai Kondrashov wrote:
Hi Pavel,
On 08/24/2015 11:54 AM, Pavel Březina wrote:
> On 08/21/2015 07:01 PM, Nikolai Kondrashov wrote:
>> I might be in a strange and careless mood today, but here is something I
>> wanted to suggest since the time I saw the amount of logic that goes into
>> SSSD and is implemented in C.
>>
>> What if we implement some of the complicated logic inside SSSD in Lua [1]?
>
> can you tell us what features of Lua do you like and might help simplify
> SSSD? I don't know the language, just fast scrolled over the manual and seen
> few examples. It seems to be similar to javascript.
Most of all, I like its simplicity, then flexibility. And then how easy it is
to embed. The latter comes from simplicity, first of all.
I listed the features I think will help us in the other message in this
thread, but here they are again and then some:
* exception handling
(somewhat rudimentary, but workable)
This may be interesting, but we are pretty diligent I think, thanks to
the tevent_req design pattern, at surfacing error
* automatic memory management
(incremental mark-and-sweep with good controls, customizable allocator)
This is not really interesting as we already have talloc that does a
great job at keeping track of memory allocations and cleanups (esp if we
stop using the anti-pattern of allocating on NULL as discussed a few
times already).
* easier data massaging
(string operations, built-in (limited) regexes, etc.)
We do some limited string manipulation but not really much, what other
kind of data massaging does Lua provide that makes it worth ?
* brevity
(implicit dynamic typing, syntax sugar)
brevity is good for long-winded functions indeed.
* OOP support
(there are several libraries to choose from)
This may be good or bad, it all depends on what you need to do.
How does Lua work with asynchronous operations ? We have a ton of that
and unless Lua has native support it would be a huge mismatch.
I don't know enough JavaScript to really compare, but to me
knowing that it
has two pairs of equality operators [1] is quite off-putting.
I hope it doesn't compare much because javascript is awful, especially
for anything security oriented.
There is, however, a seemingly good comparison, which should give the
general
idea:
http://stackoverflow.com/a/1022683/1161045
To be honest a Javascript to Lua comparison doesn't really help much
understanding if Lua could be an asset for SSSD or not.
See above questions.
Simo.
--
Simo Sorce * Red Hat, Inc * New York