Imperative Notation
G.P.H. Josten
gjosten@sci.kun.nl
Tue, 09 Feb 1999 13:59:01 +0100
# > Start world
# > # (_,mbListener,world) = openTCP_Listener 1888 world
# > (mbTCPDuplexChan, listener, world)= receive (fromJust
# > mbListener) world
# > (_,{sChan,rChan}) = fromJust mbTCPDuplexChan
# > world = closeChan listener world
# > (receivedData, rChan, world) = receive rChan world
# > (sChan, world) = send sChan receivedData world
# > world = closeChan sChan world
# > world = closeChan rChan world
# > = world
#
# I can't be the only person whom this strikes as horrible. Dare I bring up
# the topic of a "do" notation?
#
Hi there,
I must agree, that for a functional language, this notation is at least a bit
inappropriate. It's not really clear to me what you mean by a 'do' notation,
but with opening, writing and closing files, I find myself faced with likewise
notations...
To make this readible, I would suggest a notation like:
Start world = OpenDuplex 1888 <&> sendThroughData <&> CloseDuplex
It would be nice to be able to define an operator <&> that could work for both
or even more cases, but I haven't tried this actually...
Any notation that is like the above, sequential on one line, read from left to
right, should be easy to understand. As an example, I have to mention how much
the beauty of the Writer Combinator class struck me...
[class (<<<) infixl a :: !*File !a -> *File]
Anybody suggestions to the Clean-team?
Greetings,
Geert