* [Buildroot] [PATCH] package/lua: add options for coercion between number and string
@ 2023-01-14 19:46 Francois Perrad
2023-01-14 21:56 ` Yann E. MORIN
0 siblings, 1 reply; 2+ messages in thread
From: Francois Perrad @ 2023-01-14 19:46 UTC (permalink / raw)
To: buildroot
note: not available with Lua 5.1
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
package/lua/Config.in | 12 ++++++++++++
package/lua/lua.mk | 8 ++++++++
2 files changed, 20 insertions(+)
diff --git a/package/lua/Config.in b/package/lua/Config.in
index 309dd6eec..903031e50 100644
--- a/package/lua/Config.in
+++ b/package/lua/Config.in
@@ -41,6 +41,18 @@ 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
+ See LUA_NOCVTN2S in luaconf.h
+
+config BR2_PACKAGE_LUA_CVT_S2N
+ bool "automatic coercion from string to number"
+ default y
+ help
+ See LUA_NOCVTS2N 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH] package/lua: add options for coercion between number and string
2023-01-14 19:46 [Buildroot] [PATCH] package/lua: add options for coercion between number and string Francois Perrad
@ 2023-01-14 21:56 ` Yann E. MORIN
0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2023-01-14 21:56 UTC (permalink / raw)
To: Francois Perrad; +Cc: buildroot
François, All,
On 2023-01-14 20:46 +0100, Francois Perrad spake thusly:
> note: not available with Lua 5.1
OK, so I think this means a bit more explanations.
First, it should be mentioned that coercion defaults to 'y' for elgacy
reason: unless told not to, the buildsystem for lua enables coercion.
Then, it would be nice to explain why one might want/need to disable
coercion.
Finally, I'd like to read how packages may be impacted by such options.
For example, could there be packages that explicitly expect coercion?
How would they behave without coercion? Conversely, are there packages
that explicitly want no coercion?
I've read a bit about it in the manual [0], and the only nit that seems
relevant was "These coercions exist mainly for compatibility and may be
removed in future versions of the language". Still, this does not
explain why we need that i Buildroot.
Could you respin with a better commit log, please?
[0] https://www.lua.org/manual/5.4/manual.html#3.4.3
Regards,
Yann E. MORIN.
> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
> ---
> package/lua/Config.in | 12 ++++++++++++
> package/lua/lua.mk | 8 ++++++++
> 2 files changed, 20 insertions(+)
>
> diff --git a/package/lua/Config.in b/package/lua/Config.in
> index 309dd6eec..903031e50 100644
> --- a/package/lua/Config.in
> +++ b/package/lua/Config.in
> @@ -41,6 +41,18 @@ 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
> + See LUA_NOCVTN2S in luaconf.h
> +
> +config BR2_PACKAGE_LUA_CVT_S2N
> + bool "automatic coercion from string to number"
> + default y
> + help
> + See LUA_NOCVTS2N 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-14 21:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-14 19:46 [Buildroot] [PATCH] package/lua: add options for coercion between number and string Francois Perrad
2023-01-14 21:56 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox