🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6091

Re: Bondage and Discipline Languages

#6091
From: David Gudeman
Date: Wed, 04 Jan 1989 04:43
45 lines
2547 bytes
In article  <2608@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
>In article <8527@megaron.arizona.edu>, gudeman@arizona.edu (David Gudeman) writes:
>
>> Ahem.  I hate to nit-pick, but my understanding of dataflow languages
>> is that they are non-procedural languages based on something similar
>> to circuit diagrams.
>
>The multiple-result feature of Icon is a non-procedural dataflow capability
>built on top of the procedural kernel. It's very well integrated, so it's
>easy to ignore, but it's really an amazing capability.

I guess my understanding of "dataflow" is different from yours (and
since I've never studied the subject, I'm willing to admit ignorance),
but Icon's multiple-result feature is definitely procedural in nature.
At least it is if you would call co-routines procedural.  Icon has a
subset of co-routines built in to every expression in such a way that
you can ignore them if you want, or you can often pretend that they
are declarative.  But the bottom line is that when you resume an
expression for another result, that expression gets control and it can
do anything it wants, from changing the value of a variable to exiting
a loop to quiting the program.

Example:

	while line := read() do {
		res := parse(line) | break
		       -------------------
		write(res)
		}

The underlined portion is a generator, an expression that can produce
multiple results.  If the function parse() produces a result, then
that result is assigned to res.  However the | operator says that if
the first argument does not produce a result (the function parse() may
fail), then the result is the result of the second argument.  If break
were a value, then this value would be assigned to res.  But break is
a control structure that exits the loop.  The net effect is that you
will keep reading lines, parsing them and printing the result until
end of file or you get a failure in parsing, then you will exit the
loop.

BTW: this is an example of a common Icon idiom: using failure as a
simple exception-handling mechanism.  Sort of like 0 is used in C or
nil is used in Lisp, but it can't be confused with any legitimate
value.
Technical Details
Message-ID: <8540@megaron.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!tut.cis.ohio-state.edu!rutgers!noao!arizona!gudeman

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!tut.cis.ohio-state.edu!rutgers!noao!arizona!gudeman
From: gudeman@arizona.edu (David Gudeman)
Newsgroups: comp.lang.misc
Subject: Re: Bondage and Discipline Languages
Message-ID: <8540@megaron.arizona.edu>
Date: 4 Jan 89 04:43:30 GMT
Organization: U of Arizona CS Dept, Tucson
Lines: 45