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 @for, @if etc. #233

Closed
hhaensel opened this issue Oct 26, 2023 · 4 comments
Closed

macros @for, @if etc. #233

hhaensel opened this issue Oct 26, 2023 · 4 comments

Comments

@hhaensel
Copy link
Member

hhaensel commented Oct 26, 2023

Today I found out, that it is indeed possible to define macros @if, @for etc.

So shouldn't we rename our strange macros which seem very unintuitive and difficult to remember for me.

julia> macro var"for"(expr)
         Expr(:kw, Symbol("v-for"), esc_expr(expr))
       end

julia> list(@recur("fruit in fruits"), "{{ fruit }}")
"<q-list v-for=\"fruit in fruits\">{{ fruit }}</q-list>"
@essenciary
Copy link
Member

Yes! We came up with @recur as I didn't know how to define conflicting-named macros with var"...".

@hhaensel
Copy link
Member Author

I'll do it then and keep the old ones as deprecated

@hhaensel
Copy link
Member Author

hhaensel commented Oct 26, 2023

Just had to learn that only from julia 1.10 on this syntax is supported :-(

Update, I found a different solution by aliasing thanks to https://stackoverflow.com/questions/50084877/how-to-alias-a-macro-in-julia

const var"@if" = var"@iif"

@hhaensel
Copy link
Member Author

hhaensel commented Nov 3, 2023

Solved by #234

@hhaensel hhaensel closed this as completed Nov 3, 2023
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

2 participants