For a notation, I'm curious, what's needed beyond traditional Unix |
and tee with variables and/or files for buffers? I'm certainly not
proposing bash or whatever as the language (bit too ugly!) but don't
shells have all the necessary constructs for describing flows?
I'm not sure, but presumably a precursor of optimization would be
monitoring, so you'd want to be able to attach some kind of hook to
the | or whatever to see how it was using resources.
re. operating transparently over different types of data - I agree
self-describing objects are probably the best way to go to support
polymorphism while staying loosely-coupled. (I've some HTTP-related
thoughts on this, will post later in a fresh thread)
Cheers,
Danny.
> For a notation, I'm curious, what's needed beyond traditional Unix |
> and tee with variables and/or files for buffers? I'm certainly not
> proposing bash or whatever as the language (bit too ugly!) but don't
> shells have all the necessary constructs for describing flows?
Technically, if you make use of /dev/fdn, you can construct all the
loops you want. You need some conventions about components that aren't
one-input/one-output, though, and someone has to write those components,
like a program that writes some inputs to fd 1 (standard output) and
the others to fd 3 (fd 2 is standard error) depending on some criterion
expressed in the arguments.
The art of shell programming is slowly dying, partly because bash is such
a terrible programming language. I have a design in mind for a new shell
based on rc (the Plan 9 shell) and Lua, called plwsh (pronounced "ploosh",
meaning Powerful LightWeight SHell or Processes+Lua+Wiring SHell, take
your pick). Lua is a powerful dynamically typed programming language
with coroutines, with a small implementation designed to be embedded
in C programs, and rc ("run commands", the same origin as .bashrc,
.mailrc, etc.) breaks Posix compatibility (but not basic usage) to get
a shell right.
Put these two together and I think you'd really have something powerful,
with low enough overhead to run scads of them on a modest modern Unix
(Windows would work, but it would be an issue because Windows processes
are incredibly slow to start.) I haven't got any further than fiddling
about with unifying the grammar of the two languages, though. Eventually,
when I get time (or some help with the project) ....
--
John Cowan http://www.ccil.org/~cowan co...@ccil.org
Please leave your values Check your assumptions. In fact,
at the front desk. check your assumptions at the door.
--sign in Paris hotel --Cordelia Vorkosigan
tee is one-input, two-output, no? And couldn't you do two input with x
| somewhere; y | somewhere (though that might not be the convention
you'd want :)
and someone has to write those components,
> like a program that writes some inputs to fd 1 (standard output) and
> the others to fd 3 (fd 2 is standard error) depending on some criterion
> expressed in the arguments.
>
> The art of shell programming is slowly dying, partly because bash is such
> a terrible programming language.
But how much is just due to the horrible syntax? Joining commands
together seems a pretty powerful approach (essentially flow-based).
I have a design in mind for a new shell
> based on rc (the Plan 9 shell) and Lua, called plwsh (pronounced "ploosh",
> meaning Powerful LightWeight SHell or Processes+Lua+Wiring SHell, take
> your pick). Lua is a powerful dynamically typed programming language
> with coroutines, with a small implementation designed to be embedded
> in C programs, and rc ("run commands", the same origin as .bashrc,
> .mailrc, etc.) breaks Posix compatibility (but not basic usage) to get
> a shell right.
interesting, all new to me
> Put these two together and I think you'd really have something powerful,
> with low enough overhead to run scads of them on a modest modern Unix
> (Windows would work, but it would be an issue because Windows processes
> are incredibly slow to start.) I haven't got any further than fiddling
> about with unifying the grammar of the two languages, though. Eventually,
> when I get time (or some help with the project) ....
Good luck!
> tee is one-input, two-output, no?
Well, yes, if you use a named pipe or a non-bash shell that can pipe
stuff using descriptors other than 0 or 1, as rc can.
> And couldn't you do two input with x
>
> | somewhere; y | somewhere (though that might not be the convention
>
> you'd want :)
That would give you two separate instantiations of "somewhere".
> But how much is just due to the horrible syntax? Joining commands
> together seems a pretty powerful approach (essentially flow-based).
There was also the problem of knowing what components would be available
on a random system. Posix.2 and the GNU core-utils package help there.
> Good luck!
That's what everyone says, as in "good luck finding anyone to help". :-)
> By the way, I am assuming here that we are just talking about the
> language(s) for components - I don't see a need for a connection
> language, as the network is just a list of connections.
Well, that works if you always use a graphical layout tool. But a nice
pipeline like "ls | wc -l" is a lot more perspicuous than
comp1 = new ls
comp2 = new wc
connect(comp1.out, comp2.in)
connect("-l", comp2.options)
run
And the difference only gets more drastic as the pipeline gets longer
and hairier.
--
You're a brave man! Go and break through the John Cowan
lines, and remember while you're out there co...@ccil.org
risking life and limb through shot and shell, http://ccil.org/~cowan
we'll be in here thinking what a sucker you are!
--Rufus T. Firefly
It certainly would. Here are my current stabs at it:
NoFlo graph API:
graph = noflo.graph.createGraph "My new flow"
graph.addNode "read", "ReadFile"
graph.addNode "show", "Output"
graph.addEdge "read", "out", "show", "in"
graph.addInitial "somefile.txt", "read", "source"
NoFlo interactive shell:
$ noflo -i
NoFlo>> new My new flow
My new flow>> add read ReadFile
My new flow>> add show Output
My new flow>> connect read out show in
My new flow>> send read source somefile.txt
I'm not entirely happy with either. Maybe switching from component and
port as separate arguments to component:port syntax would help?
--
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/
Jabber: henri....@gmail.com
Microblogs: @bergie
> I don't think that any FBP language should contain any "connect"
> calls or code like:
> graph = noflo.graph.createGraph "My new flow"
> graph.addNode "read", "ReadFile"
> graph.addNode "show", "Output"
> graph.addEdge "read", "out", "show", "in"
[snip]
> FBP is declarative programming not imperative and also not functional.
The language above *is* declarative: don't be fooled by its form.
It makes no provision for dynamic connections or disconnections.
It just defines a specific graph for the engine to execute.
> The "functions" should be used only in the mathematical sense, never >
as they are used in imperative programming (i.e. using "calls").
That's what it means to be a (pure) functional language.
> By the way: who does the calls? A special parent component? A
> component does not call anything and if it does when it calls and what?
The initialization phase of the overall engine: in shell programming,
the shell. Posix shell language is not declarative/functional as a whole,
but the subset of it excluding assignments and backquotes (but including
conditionals and loops) is.
--
I now introduce Professor Smullyan, John Cowan
who will prove to you that either co...@ccil.org
he doesn't exist or you don't exist, http://www.ccil.org/~cowan
but you won't know which. --Melvin Fitting
> You only need to relate "ports" to each other. Which port of a process
> is connected to which other port?
You also have to name processes, because a process may appear more than
once in a pipeline or flow graph.
--
Samuel Johnson on playing the violin: John Cowan
"Difficult do you call it, Sir? co...@ccil.org
I wish it were impossible." http://www.ccil.org/~cowan
, DFDM, used the
following notation:
'data.fil'->OPT Reader(THFILERD) OUT -> IN Selector(THSPLIT) MATCH -
> ...,
Selector NOMATCH -> ...
> I don't see why people keep talking about turning text into diagrams.
> It's so much easier to go the other way.
It's a matter of taste: some of us prefer to write things down (textually)
and present them to others as pictures.
> > Or you take this as an execution plan: an interpreter can go over
> > these mappings and pull processes from a container to schedule them
> > for execution. That�s what I�m working on right now.
>
> Isn't that what JavaFBP and C#FBP do already? John, what am I
> missing?
The point is that an FBP mini-language can be read two ways: as a description
of the flow graph, or as a set of instructions to a flow graph interpreter.
In some cases, it is possible to replace the interpreter with a compiler:
the Faust comnpiler renders the whole graph as a single-threaded C++
program, because Faust is synchronous.
--
Do I contradict myself? John Cowan
Very well then, I contradict myself. co...@ccil.org
I am large, I contain multitudes. http://www.ccil.org/~cowan
--Walt Whitman, Leaves of Grass
On Tue, Sep 6, 2011 at 4:38 PM, Paul Morrison <paul.m...@rogers.com> wrote:
> Exactly, Ralf. You can take a really simple notation - linear or
> tables - and generate the "connect" calls. The only FBP
> implementation by IBM that ever got on the market, DFDM, used the
> following notation:
>
> 'data.fil'->OPT Reader(THFILERD) OUT -> IN Selector(THSPLIT) MATCH -
I like it. Very concise description of a FBP graph. Last night I wrote
a quick-and-dirty parser for this format, and now NoFlo can run it.
For example:
https://github.com/bergie/noflo/blob/master/examples/linecount/count.fbp
Can be run with:
$ noflo examples/linecount/count.fbp
Note that I "standardized" on the .fbp file suffix for this language.
Is that OK?
There is also a bit of documentation on the format in the NoFlo README:
https://github.com/bergie/noflo#readme
This is the graph definition API that NoFlo has. It is used internally
when loading graphs from JSON or FBP files, but Node.js developers can
also use it to "embed" flow-based parts into their traditional
JavaScript applications.
What this code does is building a FBP graph, that can then be run by
turning it to a network and sending it some initial data. The graph
(and the components inside it) will not have any interfaces with the
external world, except by the means of input and output ports.
I think having a reasonably simple API that allows embedding FBP into
regular programs is an important step for adoption of the paradigm.
This way users can turn to FBP when they have tricky concurrency or
flow control problems to solve without having to reimplement their
whole application first. Later they can then expand the use of FBP,
until optimally the whole application is flowing.
> Dan
/Henri
On Wed, Sep 7, 2011 at 4:46 AM, Paul Morrison <paul.m...@rogers.com> wrote:
> I don't see why people keep talking about turning text into diagrams.
> It's so much easier to go the other way. The text has less info than
> the diagram, so it makes sense to work with the diagrams. Of course,
> you have to have an FBP-friendly diagramming tool, which is what I am
> trying to do with DrawFBP.
Agreed that a graphical tool is much clearer for making sense of
complicated flows. And depending how the tool is done, it may even be
a more efficient way of defining them than text. But lacking these
tools for now means we should also focus on a nice textual flow
format, which the syntax you described earlier gets very close to.
And even if we had a nice graphical editor that everybody could use,
there would still be situations where text is just more convenient. So
I think a good editor would allow you to seamlessly jump between the
graphical representation and the textual representation.
One aspect that hasn't been mentioned yet is that a graphical FBP tool
might be just the key needed for making tablets useful for developers.
Instead of using a mouse you'd just touch and drag the components you
want to connect or rearrange, and you could easily pinch-zoom to see
details of a subgraph. This is why I'm making the editor in NoFlo
web-based, as then it would work also on all these iPads and Androids.
> Consider the diagram in http:www.jpaulmorrison.com/fbp/image010.jpg -
> this is about 1/3 of a long-running batch program, which was running
> every day for at least 35 years (and may still be)... You certainly
> can generate a text-type network description from this, but I
> challenge you to write a diagram-generator program that can go the
> other way, unless you code up the x-y coordinates of every block,
> arrow and bend.
There are some algorithms for automatically positioning graphs. For
example, GraphViz seems to do a fine job of visualizing my existing
FBP graphs.
Other than that, we also need a clear and standardized text format for
graphs for version control and such.
>> Last but not least I´m planning to stop the execution for changing the
>> flow and/or the processes at runtime.
> IMO that one's dangerous, but there are some special cases which have
> turned out to be useful... See http://www.jpaulmorrison.com/fbp/compos.shtml
NoFlo also allows disconnecting ports, and adding or removing nodes at
runtime. But for now you either have to use the NoFlo interactive
shell for this, or start NoFlo together with its web-based API server.
> Start with DrawFBP, and enhance it :-) It's all open source!
Unfortunately it doesn't run on Linux, or the tablets I'm hoping to target :-(
> > > Or you take this as an execution plan: an interpreter can go over
> > > these mappings and pull processes from a container to schedule
> > > them for execution. That�s what I�m working on right now.
> >
> > Isn't that what JavaFBP and C#FBP do already? �John, what am I
> > missing?
>
> I thought all the processes used their own threads.
Yes (the simplest possible execution plan). When writing JavaFBP, I
considered checking for a "last process" (a unique process that does
not output to any other process) and running it in the main thread, but
in the end decided that the extra work was not worth it. This is the
pipeline equivalent of tail-recursion optimization.
If it's important to reduce the number of threads, any number of
optimizations can be undertaken; as I mentioned, the Faust compiler only
uses the main thread. Threads are cheap nowadays, however.
--
John Cowan http://ccil.org/~cowan co...@ccil.org
[T]here is a Darwinian explanation for the refusal to accept Darwin.
Given the very pessimistic conclusions about moral purpose to which his
theory drives us, and given the importance of a sense of moral purpose
in helping us cope with life, a refusal to believe Darwin's theory may
have important survival value. --Ian Johnston
Here is a bit more complicated example of extracting data from spreadsheets:
https://github.com/bergie/noflo/blob/master/examples/spreadsheet/parse.fbp
To help explaining this I added support for comments. Anything on a
line after a # gets ignored.
Also, my fork of Docco adds support for generating documentation from
these files:
https://github.com/bergie/docco
You'll need the associated Pygments lexer as well:
https://bitbucket.org/birkenfeld/pygments-main/issue/698/add-lexer-for-fbp-workflows
Looks pretty nice!
http://static.qaiku.com/b7b/ef5/16d/b7bef516dae311e09ada75210ed4998a998a.png
> For your interest, it took me 10 minutes to draw the picture with just
> the process names, plus another 15 to add in the IIP values, and
> pretty it up a bit (including adding in one process that I had
> missed). I suspect keying in text isn't *that* much faster...?
25 minutes? I should hope I could do better than that.
> I was talking to an ex-colleague recently, and he suggested that the
> majority of application developers probably prefer the visual
> notation, but that the members of this group (at least the ones who
> participate in these discussions) are in fact the ones who don't seem
> to mind writing text!
Inevitably so, since you have to "not mind writing text" to participate
in the group at all.
--
A rabbi whose congregation doesn't want John Cowan
to drive him out of town isn't a rabbi, http://www.ccil.org/~cowan
and a rabbi who lets them do it co...@ccil.org
isn't a man. --Jewish saying