Lua is used for many purposes - some of which I think are well suited to an
imperaive approach (or at least would be totally fine to do in an
imperative style). There are of course many cases where an imperative
approach would be a poor choice.
There are no rules that apply to all programming things equally - context
of the programming task matters.
On Thursday, December 7, 2017, mathieu stumpf guntz <
Following your message Jeroen, there it also is on
-------- Message transféré --------
Sujet : Re: [Wikidata] Imperative programming in Lua, do we
Date : Wed, 6 Dec 2017 23:53:17 +0100
De : Jeroen De Dauw <jeroendedauw(a)gmail.com>
Répondre à : Discussion list for the Wikidata project. <
Pour : Discussion list for the Wikidata project. <
While I am not up to speed with the Lua surrounding Wikidata or
support the call for avoiding overly imperative code where
Most Lua code I have seen in the past (which has nothing to do with
very imperative, procedural and statefull. Those are things
you want to avoid if you want your code to be maintainable, easy to
understand and testable. Since Lua supports OO and functional styles, the
language is not an excuse for throwing well establishes software
development practices out of the window.
If the code is currently procedural, I would recommend establishing that
should not be procedural and have automawted tests unless there is
very good reason to make an exception. If some of this code is written by
people not familiar with software development, it is also important to
create good examples for them and provide guidance so they do not
unknowingly copy and adopt poor practices/styles.
John, perhaps you can link the code that caused you to start this thread
there is something more concrete to discuss?
(This is just my personal opinion, not some official statement from
PS: I just noticed this is the Wikidata mailing list and not the
Jeroen De Dauw | https://entropywins.wtf
Software craftsmanship advocate | Developer at Wikimedia Germany
On 6 December 2017 at 23:31, John Erling Blad <jeblad(a)gmail.com <mailto:
With the current Lua environment we have ended up with an imperative
programming style in the modules. That invites to statefull objects,
which does not create easilly testable libraries.
Do we have some ideas on how to avoid this, or is it simply the way
things are in Lua? I would really like functional programming with
chainable calls, but other might want something different?
Wikidata mailing list