[Oberon] Functional programming and Oberon

Richard Hable informujo at aon.at
Thu Dec 15 22:58:36 CET 2016


Am 2016-12-15 um 12:11 schrieb Lars:

> First set the oven to 350 degrees.
> Mix the flour with the baking soda.
> Add water.
> Put cake in oven.
> 
> No clever tricks... just a set of simple instructions from top to bottom...

Wouldn't it be better to just describe the result (declarative
programming) instead of specifying the step-by-step creation process
(imperative programming)?

I find it actually easier to read a (well structured, pure) functional
program than a procedural program: you do not have to go through all the
steps in your head and remember previous state changes to understand
what the end result will be; you just look at one declaration at a time
independently.

And, of course, because you avoid side effects, you do not actually bake
the cake--you leave that to the environment. So you can have your cake
and eat it too, without even cooking. ;)

> I watched some youtube videos of a guy doing Game Programming in Haskell,
> and I kept asking the same question as Wirth did in his article. Why? What
> problem is actually being solved? Is it pure mental masturbation?

Advantages of Haskell compared to other programming languages are that
programs tend to be very concise and the sophisticated type system
catches many errors already at compile time. But IMO it's just too
complicated for most programmers (including me).

Richard



More information about the Oberon mailing list