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

hygine というオプションを紹介する #558

Closed
Seasawher opened this issue Aug 1, 2024 · 0 comments · Fixed by #935
Closed

hygine というオプションを紹介する #558

Seasawher opened this issue Aug 1, 2024 · 0 comments · Fixed by #935
Assignees

Comments

@Seasawher
Copy link
Member

Seasawher commented Aug 1, 2024

-- マクロ衛生とはなんぞやという例
section

macro "const" e:term : term => `(fun x => $e)

def x : Nat := 42
def y : Nat := 42

#guard (const x) 0 = 42
#guard (const y) 0 = 42

-- マクロ衛生を保つ機能を無効にする
set_option hygiene false

macro "const'" e:term : term => `(fun x => $e)

-- 引数の値が同じでも、識別子の名前によって値が変わるようになる
#guard (const' x) 0 = 0
#guard (const' y) 0 = 42

end
@Seasawher Seasawher modified the milestones: メタプログラミングとタクティク, メタプログラミングとタクティク作成、カスタマイズ Sep 10, 2024
@Seasawher Seasawher self-assigned this Oct 3, 2024
Seasawher added a commit that referenced this issue Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant