mirror of
https://github.com/anoma/juvix.git
synced 2025-01-08 08:39:26 +03:00
2c8a364143
- Closes #2060 - Closes #2189 - This pr adds support for the syntax described in #2189. It does not drop support for the old syntax. It is possible to automatically translate juvix files to the new syntax by using the formatter with the `--new-function-syntax` flag. E.g. ``` juvix format --in-place --new-function-syntax ``` # Syntax changes Type signatures follow this pattern: ``` f (a1 : Expr) .. (an : Expr) : Expr ``` where each `ai` is a non-empty list of symbols. Braces are used instead of parentheses when the argument is implicit. Then, we have these variants: 1. Simple body. After the signature we have `:= Expr;`. 2. Clauses. The function signature is followed by a non-empty sequence of clauses. Each clause has the form: ``` | atomPat .. atomPat := Expr ``` # Mutual recursion Now identifiers **do not need to be defined before they are used**, making it possible to define mutually recursive functions/types without any special syntax. There are some exceptions to this. We cannot forward reference a symbol `f` in some statement `s` if between `s` and the definition of `f` there is one of the following statements: 1. Local module 2. Import statement 3. Open statement I think it should be possible to drop the restriction for local modules and import statements |
||
---|---|---|
.. | ||
230 | ||
258 | ||
265 | ||
BindGroupConflict | ||
Dependencies | ||
ImportCycle | ||
Internal | ||
issue1337 | ||
issue1344 | ||
issue1700 | ||
NoDependencies | ||
StdlibConflict | ||
Termination | ||
UsingHiding | ||
AmbiguousConstructor.juvix | ||
AmbiguousExport.juvix | ||
AmbiguousModule.juvix | ||
AmbiguousSymbol.juvix | ||
AppLeftImplicit.juvix | ||
AsPatternAlias.juvix | ||
ConstructorExpectedLeftApplication.juvix | ||
DanglingJudoc.juvix | ||
DuplicateFixity.juvix | ||
DuplicateInductiveParameterName.juvix | ||
ImplicitPatternLeftApplication.juvix | ||
InfixError.juvix | ||
InfixErrorP.juvix | ||
Iterators1.juvix | ||
Iterators2.juvix | ||
Iterators3.juvix | ||
Iterators4.juvix | ||
Iterators5.juvix | ||
juvix.yaml | ||
LacksFunctionClause.juvix | ||
LacksTypeSig2.juvix | ||
LacksTypeSig.juvix | ||
LetMissingClause.juvix | ||
ModuleNotInScope.juvix | ||
MultipleDeclarations.juvix | ||
MultipleExportConflict.juvix | ||
NestedAsPatterns.juvix | ||
NestedPatternBraces.juvix | ||
NotInScope.juvix | ||
PragmasFormat.juvix | ||
PragmasYAML.juvix | ||
QualSymNotInScope.juvix | ||
Tab.juvix | ||
UnusedOperatorDef.juvix | ||
WrongModuleName.juvix |