Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
private を追加する
Browse files Browse the repository at this point in the history
  • Loading branch information
Seasawher committed Apr 20, 2024
1 parent a18715a commit 247fb28
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Src/Private.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/- # private
`private` は,その定義があるファイルの中でだけ参照可能になるようにする修飾子です.
不安定なAPIなど,外部に公開したくないものに対して使うのが主な用途です.
なお `private` コマンドでセクションや名前空間にスコープを制限することはできません.
-/

namespace Hoge
section
-- private とマークした定義
private def addOne (n : Nat) : Nat := n + 1
end
end Hoge

open Hoge

-- アクセスできる
#check addOne
2 changes: 1 addition & 1 deletion md/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* [instance: インスタンスを定義する]()
* [namespace: 定義を階層化する](./build/Namespace.md)
* [open: 名前空間を開く](./build/Open.md)
* [private: 定義を不可視にする]()
* [private: 定義を不可視にする](./build/Private.md)
* [protected: フルネームを強制する](./build/Protected.md)
* [section: 引数のスコープを区切る](./build/Section.md)
* [structure: 構造体を定義する](./build/Structure.md)
Expand Down

0 comments on commit 247fb28

Please sign in to comment.