mirror of
https://github.com/enso-org/enso.git
synced 2024-12-25 03:43:41 +03:00
ae66087bb9
This change brings by-type pattern matching to Enso. One can pattern match on Enso types as well as on polyglot types. For example, ``` case x of _ : Integer -> ... _ : Text -> ... _ -> ... ``` as well as Java's types ``` case y of _ : ArrayList -> ... _ : List -> ... _ : AbstractList -> ... _ -> .. ``` It is no longer possible to match a value with a corresponding type constructor. For example ``` case Date.now of Date -> ... ``` will no longer match and one should match on the type (`_ : Date`) instead. ``` case Date of Date -> ... ``` is fine though, as requested in the ticket. The change required further changes to `type_of` logic which wasn't dealing well with polyglot values. Implements https://www.pivotaltracker.com/story/show/183188846 # Important Notes ~I discovered late in the game that nested patterns involving type patterns, such as `Const (f : Foo) tail -> ...` are not possible due to the old parser logic. I would prefer to add it in a separate PR because this one is already getting quite large.~ This is now supported! |
||
---|---|---|
.. | ||
language-server | ||
launcher/src | ||
polyglot-api/src | ||
runner | ||
runner-native/src | ||
runtime | ||
runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument | ||
runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument | ||
runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument | ||
runtime-language-epb/src/main/java/org/enso/interpreter/epb | ||
runtime-with-instruments/src/test | ||
README.md |
The Enso Engine
The Enso engine is the codebase responsible for compiling and executing Enso code, as well as providing language server functionality to users of the language. It is subdivided into two major components:
- Language Server: The Enso language service.
- Polyglot API: The truffle-boundary safe API for communication between the language server and the runtime.
- Runner: The command-line interface for Enso.
- Runtime: The compiler and interpreter for Enso.