~lattis/muon

implement automatic array conversion of even more args v1 SUPERSEDED

Eli Schwartz: 1
 implement automatic array conversion of even more args

 1 files changed, 8 insertions(+), 8 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~lattis/muon/patches/25035/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] implement automatic array conversion of even more args Export this patch

---
 src/functions/default.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/functions/default.c b/src/functions/default.c
index 18219d5..26017fe 100644
--- a/src/functions/default.c
+++ b/src/functions/default.c
@@ -87,7 +87,7 @@ func_project(struct workspace *wk, uint32_t _, uint32_t args_node, uint32_t *obj
		kw_version
	};
	struct args_kw akw[] = {
		[kw_default_options] = { "default_options", obj_array },
		[kw_default_options] = { "default_options", ARG_TYPE_ARRAY_OF | obj_any },
		[kw_license] = { "license" },
		[kw_meson_version] = { "meson_version", obj_string },
		[kw_subproject_dir] = { "subproject_dir", obj_string },
@@ -324,8 +324,8 @@ func_declare_dependency(struct workspace *wk, uint32_t _, uint32_t args_node, ui
		kw_include_directories,
	};
	struct args_kw akw[] = {
		[kw_link_with] = { "link_with", obj_array },
		[kw_include_directories] = { "include_directories", obj_any },
		[kw_link_with] = { "link_with", ARG_TYPE_ARRAY_OF | obj_any },
		[kw_include_directories] = { "include_directories", ARG_TYPE_ARRAY_OF | obj_any },
		0
	};

@@ -382,7 +382,7 @@ tgt_common(struct workspace *wk, uint32_t args_node, uint32_t *obj, enum tgt_typ
	struct args_kw akw[] = {
		[kw_sources] = { "sources", ARG_TYPE_ARRAY_OF | obj_any },
		[kw_include_directories] = { "include_directories", ARG_TYPE_ARRAY_OF | obj_any },
		[kw_dependencies] = { "dependencies", obj_array },
		[kw_dependencies] = { "dependencies", ARG_TYPE_ARRAY_OF | obj_any },
		[kw_install] = { "install", obj_bool },
		[kw_install_dir] = { "install_dir", obj_string },
		[kw_link_with] = { "link_with", ARG_TYPE_ARRAY_OF | obj_any },
@@ -391,9 +391,9 @@ tgt_common(struct workspace *wk, uint32_t args_node, uint32_t *obj, enum tgt_typ
		[kw_extra_files] = { "extra_files", obj_any }, // ignored
		[kw_target_type] = { "target_type", obj_string },
		/* lang args */
		[kw_c_args] = { "c_args", obj_array },
		[kw_cpp_args] = { "cpp_args", obj_array },
		[kw_objc_args] = { "objc_args", obj_array },
		[kw_c_args] = { "c_args", ARG_TYPE_ARRAY_OF | obj_any },
		[kw_cpp_args] = { "cpp_args", ARG_TYPE_ARRAY_OF | obj_any },
		[kw_objc_args] = { "objc_args", ARG_TYPE_ARRAY_OF | obj_any },
		[kw_link_args] = { "link_args", ARG_TYPE_ARRAY_OF | obj_string },
		0
	};
@@ -621,7 +621,7 @@ func_subproject(struct workspace *wk, uint32_t rcvr, uint32_t args_node, uint32_
		kw_default_options,
	};
	struct args_kw akw[] = {
		[kw_default_options] = { "default_options", obj_array },
		[kw_default_options] = { "default_options", ARG_TYPE_ARRAY_OF | obj_any },
		0
	};

-- 
2.33.0
Thanks for this!  Overall, I think (hope) we can be a little more strict
with some of these.  Basically using obj_any means that we have to write
some sort of custom type checking logic, so to the extent possible we
should let interp_args handle it.  Perhaps the meaning of
ARG_TYPE_ARRAY_OF is a little unclear; `ARG_TYPE_ARRAY_OF | obj_string`
for instance means this:

'hello' # gets coerced to ['hello']

or

['hello', 'there']

but not

['hello', 'there', false]

So it can provide even more type checking than plain old obj_array did.
I have made a few suggestions, but maybe I am to optimistic.  My plan so
far has been to implement the strictest possible checking, and slowly
loosen it until an acceptable portion of meson projects can be built
with muon.