![]() |
||
|
1. Lua is the scripting language which can be used to fully customize and easily extend functionality of SciTE and Textadept, where the last appears to me to be based on the best general concept of an customizable and extendable text editor with the only worth to mention competitor being Emacs. But Emacs suffer from big size and the underlying source code is messy to such high degree that I had been given up my two months full time taking trial to adapt it to what I would like a text editor to be (the entry point to the Operating System, comparable to Desktop applications like Xfce).
2. Lua syntax supporting function calls without using braces
allows to write Lua code which reads like a requirement of what
has to be done formulated in the spoken language. To my current
knowledge there is no other programming language there making such
use possible. The main reason why it is that way is except
function calls without using braces because Lua code parser
ignores indentation, whitespaces and newlines separating
instructions based on textual context instead of relying on and
requiring explicit separators between them.
Let me give an example of the main idea I want to convey in point
2. and prepare first some functions for later use:
> function let_x_be(val) x = tonumber(val) end
> function let_y_be(val) y = tonumber(val) end
> function let_z_be_sum_of_x_and_y () z = x + y end
With this functions defined Lua allows to write following code:
> let_x_be '0xff' _=',' let_y_be '15' _='and'
let_z_be_sum_of_x_and_y''
The result of the code above is:
> x
255
> y
15
> z
270
I suppose that making in Lua possible what is possible in Python
where it is not necessary to give a string literal a name should
not brake anything and be not that hard to implement making then
following possible:
> let_x_be '0xff' ',' let_y_be '15' 'and' let_z_be_sum_of_x_and_y''
Implementing function calls accepting beside string literals also
numbers will then allow:
> let_x_be 0xff ',' let_y_be 15 'and' let_z_be_sum_of_x_and_y''
Going a step further allowing a dot and a comma treating them as
whitespace if not in appropriate context and allowing function
calls without passing any parameter will allow:
> Let_x_be 0xff 'and' let_y_be 15 . 'With x and y values set respectively to 255 and 15', let_z_be_sum_of_x_and_y .
This would turn Lua into a programming language making it
possible to write educational code in way which reads like natural
language sentences making a very interesting programming language
out of it and the only one of this kind among all the others
programming languages out there.
Feel free to visit the repository for a bit more background of
what I would like to use Textadept and Lua for
https://github.com/oOosys/oOo and try the "magic switch" (
https://github.com/oOosys/oOo/blob/main/luaLang-magicSwitch_chooseWhichOne-ofTwoSubsequentCodeBlocks-shouldBeExecuted.oOo
) which is possible this way except in Lua to my current knowledge
only in Python using combination of triple quote literals and line
comments.
Claudio
Lua's adoption does seem lower than what one would expect. The trend in programming languages today is static typing (and sometimes, no GC). Even highly dynamic languages are moving to static type systems.
While Lua does have Teal, it's roots in the Lua ecosystem aren't as deep as TypeScript's in JS, or MyPy's in Python.
It is still a "small scripting language for embedded applications", owing to its small core standard library and package ecosystem.
I think we could introduce more people to the language by:
1) Making more high quality resources for beginners, with Interactive playgrounds and demos. (Like the rust book)
2) Write, or contribute to robust libraries in domains that are popularly demanded like image processing, databases, vector databases, protocols like WebRTC/Websockets. This will reduce the burden on developers looking to write high level applications in such domains.
3) Write Lua bindings for existing open source applications like game engines (Godot), with a focus on documentation.
I'm in agreement with most of what you said.
On Sat, 30 Sept, 2023, 2:19 pm Родион Горковенко, <rodiongork@gmail.com> wrote:
Hi Friends!
It feels a bit unjust that Lua doesn't enjoy more popularity than it
is - Tiobe index don't have it in top-20 and finding job position with
it as a prime language seems quite not easy (despite it is obviously
used in industry, ranging from embedded firmware to enormous things
like Tarantool).
What could be done? I imagined a kind of plan and invite you to
criticize or perhaps provide more guidance.
Main point I want to address (attack!) is that Lua is not used for
education, while Python is everywhere - a big mistake definitely. And
what is the plan to fix it?
I envision three kinds of resources to be created:
1. Collection of exercises or puzzles (on general programming, not on
the language itself) to be solved with Lua. People perhaps don't need
much time to learn Lua (less than Python), but they need more time to
master programming at all, debugging, algorithms etc.
2. Course, again on general programming, using Lua as a main language
for exercises and examples.
3. Pastebin or fiddle-like webpage, which allows to create, test, save
and share small sources in Lua. Perhaps like https://play.go.dev but
perhaps even better, to allow building simple interactive interface or
games. Yet to be determined.
I think I started making small progress on 1 - I run an old site with
exercises - and I began adding problems to be solved specifically in
Lua to it: https://www.codeabbey.com/index/task_list/lua - despite
some users complain a bit (normal problems here could be solved in any
language) - I'm trying to invent some entertaining elements. However
most probably at some point it needs to be a separate resource
dedicated specifically to Lua, when there is enough content. Or it
shouldn't. Hard to tell.
For the 3 I tinkered a bit with compiling Lua using EMCC and set up
small page which allows both executing Lua similar normal REPL session
- and embed small code in the url, or the link to gist github where to
fetch it from. It is not quite convenient, but the compiled "lua.js"
also could be used in some animation of the problems mentioned above
(actually used in Mandelbrot and Invaders). I'm still searching for
some better tool hoping I won't need to write it myself. So hints are
quite welcome.
Of course just collecting some exercise to popularize Lua presents a
question of how to make them themselves popular. Probably I'll go
offering small challenges with small money prizes (like write the code
which makes the best AI for playing such a game). At least I can't
invent anything better yet.
As about popularizing hypothetical programming course (2) in Lua -
this will probably envolve some process of students certification.
Well, of course they couldn't be granted by some official body (e.g.
University) but if they require some serious work, they bear some
value. Probably it should be linking 1 and 2 (students should solve
some challenges for exam).
If it happened you read that far, and are in the mood to share some
advice - on tools, on challenges nice-to-have, on resources with
similar functionality to be studied or reused - or even if you think
this won't work because this and that - please do!
sincerely yours,
Rodion