From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Francois Perrad <fperrad@gmail.com>
Cc: buildroot@busybox.net
Subject: Re: [Buildroot] [PATCH v2] package/lua: add options for coercion between number and string
Date: Wed, 18 Jan 2023 22:23:46 +0100 [thread overview]
Message-ID: <20230118212346.GN2770@scaer> (raw)
In-Reply-To: <20230118154614.2103-1-francois.perrad@gadz.org>
François, All,
On 2023-01-18 16:46 +0100, Francois Perrad spake thusly:
> the default behavior of Lua 5.3/5.4 interperter
> (and the only way with Lua 5.1) is the automatic coercion.
Then we should make that obvious by eother hiding the options when lua
5.1 is seelected, of to make lua 5.1 forcibly enable those options, no?
Otherwise, a package that depends on automatic coercion, and has no lua
version requirement, would not be selectable on lua 5.1, because such a
package would be defined with something like:
config BR2_PKG_LUA_FOO
bool "lua-foo"
depends on BR2_PACKAGE_LUA_CVT_S2N && BR2_PACKAGE_LUA_CVT_S2N
Since both BR2_PACKAGE_LUA_CVT_S2N and BR2_PACKAGE_LUA_CVT_N2S are only
selectable for 5.3 or 5.4, they would forcibly never be set for lua 5.1,
even though that is actually what lua 5.1 does.
So, I moved the options out of the 5.3||5.4 condition, and made lua 5.1
forcibly select them.
Applied to master, thanks.
Regards,
Yann E. MORIN.
> this default behavior could change in future version (ie. Lua 5.5).
>
> disabling automatic coercion increases the performance of the interpreter.
>
> currently, using automatic coercion is not a good/recommended practice,
> but there are no way (expect testing) to say if a Lua module relies on it.
>
> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
> ---
> package/lua/Config.in | 14 ++++++++++++++
> package/lua/lua.mk | 8 ++++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/package/lua/Config.in b/package/lua/Config.in
> index 309dd6eec..ac30cfdde 100644
> --- a/package/lua/Config.in
> +++ b/package/lua/Config.in
> @@ -41,6 +41,20 @@ config BR2_PACKAGE_LUA_32BITS
> default 64 bit type. This option is particularly attractive
> for small machines and embedded systems.
>
> +config BR2_PACKAGE_LUA_CVT_N2S
> + bool "automatic coercion from number to string"
> + default y
> + help
> + If unsure, say y, this is the default behavior of the Lua
> + interpreter. See LUA_NOCVTN2S in luaconf.h
> +
> +config BR2_PACKAGE_LUA_CVT_S2N
> + bool "automatic coercion from string to number"
> + default y
> + help
> + If unsure, say y, this is the default behavior of the Lua
> + interpreter. See LUA_NOCVTN2S in luaconf.h
> +
> endif
>
> choice
> diff --git a/package/lua/lua.mk b/package/lua/lua.mk
> index 01b554eb6..16086e7bf 100644
> --- a/package/lua/lua.mk
> +++ b/package/lua/lua.mk
> @@ -31,6 +31,14 @@ else ifeq ($(BR2_PACKAGE_LUA_5_3),y)
> LUA_CFLAGS += -DLUA_COMPAT_5_2
> endif
>
> +ifeq ($(BR2_PACKAGE_LUA_CVT_N2S),)
> +LUA_CFLAGS += -DLUA_NOCVTN2S
> +endif
> +
> +ifeq ($(BR2_PACKAGE_LUA_CVT_S2N),)
> +LUA_CFLAGS += -DLUA_NOCVTS2N
> +endif
> +
> ifeq ($(BR2_STATIC_LIBS),y)
> LUA_BUILDMODE = static
> else
> --
> 2.37.2
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2023-01-18 21:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 15:46 [Buildroot] [PATCH v2] package/lua: add options for coercion between number and string Francois Perrad
2023-01-18 21:23 ` Yann E. MORIN [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230118212346.GN2770@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
--cc=fperrad@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.