[Oberon] Functional programming and Oberon
Richard Hable
informujo at aon.at
Thu Dec 15 22:41:12 CET 2016
Am 2016-12-14 um 18:47 schrieb Srinivas Nayak:
> But only thing we need is: a way to preserve dynamic state of a
> procedure and unnamed procedures!
In other words: closures. And the syntax better be concise, because
functional programmers use them a lot.
> What else?
Some other important features are missing for (pure / value oriented)
functional programming:
- conditional expressions
x: Integer := IF some condition THEN 42 ELSE 4711;
Conditional expressions in Oberon can not return values, so we need
mutable state (variables) for even the simplest calculations.
- local definitions of values and functions
LET x := ... IN <some expression using x>
Otherwise, we end up with a lot of very small procedure definitions or
very complex expressions.
- generics
Linked List [T] = RECORD head: T; tail: List [T] END;
Without generics (i.e. type parameters for functions, types, and values)
it is not possible to define reusable persistent collections. We can't
just build and manipulate aribitrary pointer structures.
As I have already mentioned on this list, my own attempt at creating
such a programming language can be seen here: http://trankvila.org
Richard
More information about the Oberon
mailing list