Revamp private/public functions

Problem: having public as the default makes it very easy to accidentally
export local function by forgetting the `private` modifier.

Solution: functions are private by default and must be declared as `entrypoint`s
to be exported. So `entrypoint foo() = ...` instead of `function foo() = ...`.

We still accept the `private` modifier although it is redundant.
This commit is contained in:
Ulf Norell
2019-06-27 12:10:25 +02:00
parent dd5fc17554
commit 79137e058e
7 changed files with 110 additions and 24 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ lexer() ->
, {"[^/*]+|[/*]", skip()} ],
Keywords = ["contract", "include", "let", "switch", "type", "record", "datatype", "if", "elif", "else", "function",
"stateful", "true", "false", "mod", "public", "private", "indexed", "internal", "namespace"],
"stateful", "true", "false", "mod", "public", "entrypoint", "private", "indexed", "namespace"],
KW = string:join(Keywords, "|"),
Rules =