On 29 =AC=D1=AC=E1=AC=E2, 23:48, torb...@[EMAIL PROTECTED]
(Torben =A8=A1gidius
=
Mogensen)
wrote:
> I'm not exactly sure what you mean. Do you mean that a0 takes b0 as
> an extra argument and vice versa?
Exactly.
> I don't see what this would
> accomplish, except as a kind of comment reminding readers that they
> are linked.
Not only. Database objects are linked with no direction and with no
order.
These features should be defined in the program only.
> And the important linkage isn't really in the functions
> you use, but in the objects they access. For example, a function that
> reads from a file may be used on many different files, and what the
> write-to-file function needs is not knowing that a read-from-file
> function exists (or the identity of this), but what files are
> currently open for reading.
We can write this code in imperative manner :
FileWrite(data, FileOpen('text.txt'));
It means, that the file should be opened before it's written. In other
words we define dependence FileWrite() upon FileOpen().
Next case is when we have double dependence:
FileRead(FileWrite(data, FileOpen('text.txt')) ,
FileOpen('text.txt') );
It means, that we want to be sure that we read data just after they
are written to the file, and also, we need that the file is open.
In imperative language FileOpen('text.txt') will be called twice. I
hope, that functional compiler is able to understand the idea about
declaring dependence and to call (and then to save result)
FileOpen('text.txt') once.
> Besides, making a function require a specific other function as
> argument requires some trickery with types, essentially inventing a
> type unique to that specific function. Also, this becomes more
> complicated if you have more than two functions that interact with the
> same stateful object. For example, to interact with a file, you need
> functions to open, close, read from and write to the file and,
> possibly, move the read or write focus.
I am not familiar with functional languages yet (I am just walking
around). That's why I don't know what formal methods or syntax can be
used to convey the idea about function's dependences to the compiler.
Only new type definition? It's really inconveniently. A special
operator would be good for use, if it not exists yet, I think.


|