Skip to content

W_MetaArgs for args_m.loc, args_m.types and STATIC_TYPE(args_m[0]) == MetaArg - #729

Open
paugier wants to merge 2 commits into
spylang:mainfrom
paugier:args_m-loc-types
Open

paugier wants to merge 2 commits into
spylang:mainfrom
paugier:args_m-loc-types

Conversation

@paugier

@paugier paugier commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

I propose that args_m be a W_MetaArgs (a subtype of W_InterpTuple).

This has two advantages:

  • STATIC_TYPE(args_m[0]) == MetaArg so that tup = (args_m[0], args_m[1]) just works.

  • we can add helper attributes specific to args_m, like:

    • args_m.loc (useful for metafunc similar to Rust macros todo!(), unimplemented!(), file!() and line!()) and

    • args_m.types, which should be useful for metaprog, typically:

        @blue.metafunc
        def __new__(*args_m):

            def new(*args: *args_m.types) -> cls:  # PEP 646
                self = cls.__make__(gc_alloc[Data](1))
                self.__init__(*args)
                return self

            return OpSpec(new)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant