[clean-list] Some examples about the Directory library

Ronny Wichers Schreur ronny@cs.kun.nl
Fri, 19 Dec 2003 14:05:11 +0100


Erik Zuurbier writes (to the Clean Discussion list):

>This design is used all the time. See for instance the way
>opening and closing files works.
>
I don't like it there either.

>Not nice but it makes coding (with pattern matching) a little
>easier.
>
So we need pattern guards

    # (r, f)
        =   freadc f
    | Nothing <- r
        =    ...
    | Just c <- r
        =    ... c ...

and an optimisation to make sure that Nothing and Just are not
allocated if efficiency is important.

>Maybe one time Sparkle could help proving that a program
>never inspects a value that could explode. Then you have the
>best of both worlds.
>
This is something that can be expressed in Clean's current type
system, so I'd prefer that.


Cheers,

Ronny Wichers Schreur