Looking at C.H.Lindsey's "Modals" in https://archive.computerhistory.org/resources/text/algol/algol_bulletin/A37/P43.HTM
It seems this is basically describing generic types and functions.
For example,
MODE LINK = (MODE X) STRUCT ( REF X name, REF LINK(X) next);
So LINK is a modal while LINK(INT) would be a mode, right?
Was this ever implemented or considered seriously for one?
How would have they handled operations on variables of such
mode? That is, if a function body uses, for example, +, then
only modes that have + defined on them can be used as a mode
"parameter". In particular comparison operators would be
needed for a generic sort procedure!
On 21/12/2021 18:43, Bakul Shah wrote:
Looking at C.H.Lindsey's "Modals" in
https://archive.computerhistory.org/resources/text/algol/algol_bulletin/A37/P43.HTM
It seems this is basically describing generic types and functions.
For example,
MODE LINK = (MODE X) STRUCT ( REF X name, REF LINK(X) next);
So LINK is a modal while LINK(INT) would be a mode, right?
That's my understanding [but based almost entirely on the
article you mention].
Was this ever implemented or considered seriously for one?
As Charles says, it is believed to have been implemented
in Mary. I don't have the Mary book, and Wiki is silent on the
matter. I "invited" Marcel to implement it for A68G, but he
didn't bite; I didn't push him as to whether this was because it
was too difficult, or too uninteresting [to him]. So, AFAIK, it
has never been implemented in an A68 dialect. Charles may well
know more.
How would have they handled operations on variables of such
mode? That is, if a function body uses, for example, +, then
only modes that have + defined on them can be used as a mode
"parameter". In particular comparison operators would be
needed for a generic sort procedure!
Note that the modal is only ever used as a reference.
So you can implement generic queues and similar, but [as per
the example in AB] a generic sort procedure needs a handler
routine to do the comparisons. IOW, it's quite a limited
facility, but "interesting" and occasionally useful. As
noted in Charles's paper, the limitations need exploration;
I'm not aware of any more advanced proposal. For the AB
proposal, you have to imagine that any code using a modal
has been pre-compiled, and so knows nothing about how it is
to be used in your program. That seems to resolve most
questions. [The point about references is that, in most
implementations, the compiler may have no idea how big an
array or a structure will be (in code yet to be written),
but it's likely that it knows how big a pointer to them
will be, so that's what can be compiled.]
On 12/21/21 1:21 PM, Andy Walker wrote:
On 21/12/2021 18:43, Bakul Shah wrote:
Looking at C.H.Lindsey's "Modals" in
https://archive.computerhistory.org/resources/text/algol/algol_bulletin/A37/P43.HTM
It seems this is basically describing generic types and functions.
For example,
MODE LINK = (MODE X) STRUCT ( REF X name, REF LINK(X) next);
So LINK is a modal while LINK(INT) would be a mode, right?
That's my understanding [but based almost entirely on the
article you mention].
Was this ever implemented or considered seriously for one?
As Charles says, it is believed to have been implemented
in Mary. I don't have the Mary book, and Wiki is silent on the
matter. I "invited" Marcel to implement it for A68G, but he
didn't bite; I didn't push him as to whether this was because it
was too difficult, or too uninteresting [to him]. So, AFAIK, it
has never been implemented in an A68 dialect. Charles may well
know more.
Thanks! As it happens, a few years ago I came to know one of the
people involved in the Mary language design so I have asked him.
On 21/12/2021 23:06, Bakul Shah wrote:
On 12/21/21 1:21 PM, Andy Walker wrote:
On 21/12/2021 18:43, Bakul Shah wrote:
Looking at C.H.Lindsey's "Modals" in
https://archive.computerhistory.org/resources/text/algol/algol_bulletin/A37/P43.HTM
It seems this is basically describing generic types and functions.
For example,
MODE LINK = (MODE X) STRUCT ( REF X name, REF LINK(X) next);
So LINK is a modal while LINK(INT) would be a mode, right?
That's my understanding [but based almost entirely on the
article you mention].
Was this ever implemented or considered seriously for one?
As Charles says, it is believed to have been implemented
in Mary. I don't have the Mary book, and Wiki is silent on the
matter. I "invited" Marcel to implement it for A68G, but he
didn't bite; I didn't push him as to whether this was because it
was too difficult, or too uninteresting [to him]. So, AFAIK, it
has never been implemented in an A68 dialect. Charles may well
know more.
No, I have heard or done nothing concerning modals since the paper was written, and the posts in this thread have already covered most of the issues. Essentially modals in Algol 68 are equivalent to templates in
C++, which we have discussed here several times.
I had the Mary book at one time, but if you want to read it you will
have to go to California since all my papers have been donated to the Computer History Museum.
Thanks! As it happens, a few years ago I came to know one of the
people involved in the Mary language design so I have asked him.
Was that Mark Rains? Let us know if anything comes back from that source.
My chief memory of Mark Rains is his very quotable remark:
"Algol 68 is Complex;
PL/1 is Complicated."
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 292 |
Nodes: | 16 (2 / 14) |
Uptime: | 185:23:16 |
Calls: | 6,616 |
Files: | 12,165 |
Messages: | 5,314,808 |