Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macros applied on types run first #1383

Closed
Jooseppi12 opened this issue Feb 1, 2024 · 1 comment
Closed

Macros applied on types run first #1383

Jooseppi12 opened this issue Feb 1, 2024 · 1 comment

Comments

@Jooseppi12
Copy link
Member

Jooseppi12 commented Feb 1, 2024

Given a scenario like this:

[<Macro(typeof<...>, true)>]
type X =
    abstract Y: int -> int
    abstract Z: string -> string

We need a way to ensure our Macro is able to be applied to all members on the interface. The idea is to add an extra flag for the Macro type to enable this behavior, as Macros are used as fallback implementations in certain scenarios.

@Jand42
Copy link
Member

Jand42 commented Feb 1, 2024

@Jooseppi12 The only macros that WS.Core uses on types for which the proxies are also using explicit members are for numerics and tuples. I don't think many other people/libraries would use macros on classes. I think it's better to have a breaking change for a somewhat obscure use case than introducing more complexity.

So I would rather: have macros defined for types execute always, for any calls to members on that type. Within the macro itself, if you don't want to handle the call, it can return MacroFallback (this is how multiple macros can be chained, or fall back to inline or JS implementation etc.)

@Jand42 Jand42 changed the title Add parameter for Macro to enable macroing all members on a given type. Macros applied on types run first Feb 1, 2024
Jand42 added a commit that referenced this issue Feb 1, 2024
@github-project-automation github-project-automation bot moved this to v7.0 in Releases Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: v7.0
Development

No branches or pull requests

2 participants