You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
elab "private section" ppLine cmd:command* ppLine "end private section": command => do
34
-
let old ← get
35
-
try
36
-
for cmd in cmd do
37
-
elabCommandTopLevel cmd
38
-
throwAbortCommand
39
-
finally
40
-
set old
37
+
deffoo := "world"
41
38
42
-
privatesection
43
-
deffoo := "hello!!"
39
+
-- 名前が private かどうか判定する関数
40
+
#check (Lean.isPrivateName : Lean.Name → Bool)
44
41
45
-
-- セクションの中なら当然アクセスできる
46
-
#check foo
47
-
endprivatesection
42
+
#guard Lean.isPrivateName ``hoge
48
43
49
-
-- `foo` にアクセスできない
50
-
#check_failure foo
44
+
#guard Lean.isPrivateName ``foo = false
51
45
52
-
/- [^private]: Alex J. Best さんによる [Zulip Chat/lean4/private section](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/private.20section/near/418114975) での投稿を元にした例です. -/
0 commit comments