mirror of
https://github.com/enso-org/enso.git
synced 2024-12-02 01:23:15 +03:00
876 B
876 B
layout | title | category | tags | order | ||
---|---|---|---|---|---|---|
developer-doc | Bindings | semantics |
|
1 |
Bindings
A "binding" is a portion of and Enso program that creates a new name and binds a value to that name.
Binding Return Value
While some expression-based languages with bindings have the binding return the value assigned to the binding, we feel that this is far too error prone. Consider the following code as a demonstration:
if x = someExprEvaluatingToBool then foo else bar
This is the perennially-discussed C++ bug where you fail to type ==
in an
if-statement.
Enso, instead, takes the approach where a binding expression returns the
singleton value of the type Nothing
, making the above-written code a type
error.