From nobody Thu Sep 05 13:15:43 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X00Ll5WWcz5W2W9 for ; Thu, 05 Sep 2024 13:19:11 +0000 (UTC) (envelope-from freebsd-hackers@phoe.frmug.org) Received: from frmug.org (enterprise.frmug.org [213.36.253.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4X00Ll3cldz4Ltj; Thu, 5 Sep 2024 13:19:11 +0000 (UTC) (envelope-from freebsd-hackers@phoe.frmug.org) Authentication-Results: mx1.freebsd.org; none Received: by frmug.org (Postfix, from userid 66) id 6D94312B4AE; Thu, 5 Sep 2024 15:19:03 +0200 (CEST) Received: by memo2.memo.frmug.org (Postfix, from userid 1001) id 9C2B717A09; Thu, 5 Sep 2024 15:15:43 +0200 (CEST) Date: Thu, 5 Sep 2024 15:15:43 +0200 From: Bertrand Petit To: David Chisnall , freebsd-hackers@freebsd.org Subject: Suitability of Lua as a userland-programming language? Message-ID: <20240905131543.GD1354@memo2.memo.frmug.org> References: <40836902-cb68-45e0-b4ec-623c21aa47ba@FreeBSD.org> <88AC3419-2BD0-4664-80E8-368360E143B4@freebsd.org> List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <88AC3419-2BD0-4664-80E8-368360E143B4@freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:12322, ipnet:213.36.0.0/16, country:FR] X-Rspamd-Queue-Id: 4X00Ll3cldz4Ltj 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? -- %!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