From nobody Thu Sep 5 14:18:17 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 4X01gD1J2lz5W7JH for ; Thu, 05 Sep 2024 14:18:32 +0000 (UTC) (envelope-from bdysonsmith@gmail.com) Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X01gC4bftz4WSB; Thu, 5 Sep 2024 14:18:31 +0000 (UTC) (envelope-from bdysonsmith@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-2055a3f80a4so6927665ad.2; Thu, 05 Sep 2024 07:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725545910; x=1726150710; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yj1DqTpswq/GzDm9DV9URKXMIzMUeRCvB9cCzLMbDZE=; b=Jy2BScXA7hNZXlWsqJ9EvG5Tfk9JhY2EW2X/SYDHZY+3z+sMY5qtlVfU5w0ycaU0LF dHxWQhNXR+w8FUu/lXr4fkCVRaSiISECrStXsVdBuxZHDbt6mfqUP4zo7OmR/BOTG6fH GoPLffAxGM1KwBDsY6C1t4X0QYvndjsrLvlieQUfj9fn0lfc7BoOetQIMpGdJnK5zVQl 2PsODVyL00M7BRZGhxEcFA5+vVQQVgw3V89KCHQOw8IuFIrRSEI01mmZun8S+or4D1Yg z3uSjxtIsOimC/PeXjvvokGGIlVQWsEphMj3w27yIh3G/i86LOJ73IOiVy9+BShf5MGh aqqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725545910; x=1726150710; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yj1DqTpswq/GzDm9DV9URKXMIzMUeRCvB9cCzLMbDZE=; b=uH/r2ToDjBjOOZH7P36FxrhM2D/p+Jh7uQylXsCKz2kQ0UZBJuApMxNMdi9JiQ+lXR 0b5ekF54FHIqo7stxDedk37S5jCOzeKkxcSijxo9Gh5luHyg/sZoFs/JzlCm/00ODqw+ AvZN2SnBvwo7hITtsCYphAniAD17VqR+2s9v/DTiH9pAhxWagIP3xNZNTBovg+ltLQXy IsB04zYpXuwMvELrwc5m7GKHhHKz9McgBqY67lu370w6bed3WwshcL6uzzUVmuhhIN92 3QXqrrXvAVxRAjr4y+D6Ib2QsFr7CLZp7ewxXpgtEBrj1iVB6ajIOhj9y/bNnerrSevP B1kA== X-Forwarded-Encrypted: i=1; AJvYcCXNf0x23/ID6j0CMBCXyx7gZxQRcchFgtNPMo/lQSYcbyRzaTOZ09qL6zOp0SPPxLOq9ycaE4gMTXBw6gy42lk=@freebsd.org X-Gm-Message-State: AOJu0Yxn87BZBtx6vJqcH+DOz+1RINppJ2ogro7JaUUYrKy75sC9t+2l o7z0Bj3s+a8lyROLHq3iaQeO14sQhdfUtDxVM9jmVIEXNFRxckRKVvFeKOUVe/hnr31IKVIrUZt kKeC5WghB/PL6PrW8uh4aABs86TdbJWWM X-Google-Smtp-Source: AGHT+IFNxuDQ//ALM1+eEnLY8oT6V13kMTwS8o4VC/cX/8Qy2Y7JCqtCpa6eMhnPyxzRBd5gFxAf4l1hJvuPU5gfvzQ= X-Received: by 2002:a17:903:22c8:b0:205:656a:efd6 with SMTP id d9443c01a7336-205656b042bmr182626235ad.53.1725545909665; Thu, 05 Sep 2024 07:18:29 -0700 (PDT) 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 References: <40836902-cb68-45e0-b4ec-623c21aa47ba@FreeBSD.org> <88AC3419-2BD0-4664-80E8-368360E143B4@freebsd.org> <20240905131543.GD1354@memo2.memo.frmug.org> In-Reply-To: <20240905131543.GD1354@memo2.memo.frmug.org> From: Bridger Dyson-Smith Date: Thu, 5 Sep 2024 14:18:17 +0000 Message-ID: Subject: Re: Suitability of Lua as a userland-programming language? To: Bertrand Petit Cc: David Chisnall , freebsd-hackers@freebsd.org Content-Type: multipart/alternative; boundary="000000000000fd4b8f06215ff6e7" 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:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4X01gC4bftz4WSB --000000000000fd4b8f06215ff6e7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Bertrand On Thu, Sep 5, 2024 at 1:19=E2=80=AFPM 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. --=20 > %!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 mu= l > 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 --000000000000fd4b8f06215ff6e7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Bertrand

On Thu, Sep 5, 2024 at 1:= 19=E2=80=AFPM Bertrand Petit <freebsd-hackers@phoe.frmug.org> wrote:
On Thu, Sep 05, 2024 at 08:25:26AM +0= 100, 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).
=C2=A0 =C2=A0 =C2=A0 =C2=A0 I made the same observation here, I must add th= at having a
funcional programming background helps greatly. The conciseness of the
reference manual is lovely even if I think it is badly organised.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 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-par= ty Lua module would be acceptable? E.g. https://github.com/lunarmodules/Penlight

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

<= /div>
--
%!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{newpat= h}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 charp= ath
pathbbox exch 4 -1 L E sub I 3 1 L sub I} D /l(bp)D 0.94 Y /Helvetica findf= ont
22 scalefont setfont l s P(x)s exch P T O l show showpage

Best,
Bridger
--000000000000fd4b8f06215ff6e7--