Re: Suitability of Lua as a userland-programming language?

From: Bridger Dyson-Smith <bdysonsmith_at_gmail.com>
Date: Thu, 05 Sep 2024 14:18:17 UTC
Hi Bertrand

On Thu, Sep 5, 2024 at 1:19 PM Bertrand Petit <
freebsd-hackers@phoe.frmug.org> wrote:

> On Thu, Sep 05, 2024 at 08:25:26AM +0100, David Chisnall wrote:
> >
> > It took me about an hour to go from never having written any Lua to
> > writing some Lua code that actually worked (and that we still use).
>
>         I made the same observation here, I must add that having a
> funcional programming background helps greatly. The conciseness of the
> reference manual is lovely even if I think it is badly organised.
>
>         I regret the "any variable name is assumed to be global unless
> explicitly declared as a local" concept which preclude users from
> writing large programs easily. 1-indexed strings is... peculiar by
> modern times. I see the language libraries as very limited and
> unsuitable for system programming---I was frustrated to not find map
> nor reduce. If Lua is to be integrated into base for public
> consumption we should beforehand write an extensive library of tool
> functions that would include at least strings and tables
> manipulations, functional abstractions, a sanctioned object system and
> a complete set of system interfaces. By extensive I mean
> Python-scale. That is a large project, do we have sufficient
> ressources to conduct it from design to documentation?
>
>
Do you think incorporating a third-party Lua module would be acceptable?
E.g. https://github.com/lunarmodules/Penlight

I see map, reduce, string manipulation, and more.

-- 
> %!PS -- Bertrand Petit
> /D{def}def/E{exch}D/G{get}D/I{2
> div}D/U{dup}D/L{roll}D/Y{setgray}D/N{newpath}D
> /O{N 0 0 moveto}D/P{pop}D/T{translate}D currentpagedevice/PageSize G U 0
> G/w E
> D 1 G /h E D w I h I T 0 Y 1 setlinewidth 0 1 2 { P 120 rotate 2 4 w U mul
> h U
> mul add sqrt I 50 add {N 50 0 3 2 L 0 360 arc stroke}for}for/s{O true
> charpath
> pathbbox exch 4 -1 L E sub I 3 1 L sub I} D /l(bp)D 0.94 Y /Helvetica
> findfont
> 22 scalefont setfont l s P(x)s exch P T O l show showpage
>
> Best,
Bridger