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

How does @forward handle abstract type? #131

Open
Azzaare opened this issue Jan 19, 2021 · 0 comments
Open

How does @forward handle abstract type? #131

Azzaare opened this issue Jan 19, 2021 · 0 comments

Comments

@Azzaare
Copy link

Azzaare commented Jan 19, 2021

I am sorry for the basic question, but I am not good at reading meta-programming (yet?!).

I can use the @forward macro to generate methods (let's say mylazy here) that applies to a field of all the subtypes of an abstract type. However, how is the method generated? In the following code, the second and third options are definitely better.

function mylazy(lazystruct::AbstractLazyStruct) 
# method body
end

function mylazy(lazystruct::S) where {S <: AbstractLazyStruct}
# method body
end

function mylazy(lazystruct)
# method body
end
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

No branches or pull requests

1 participant