ALGOL68-like union type switches?

NevilleDNZ NevilleD.digitalmars at sgr-a.net
Sat Apr 21 21:21:22 PDT 2007


Question: Does this type union in Algol-68 make the language a "strong-dynamically
typed" language?

After all this type union gives a68 the data security of Pascal, but still allows
dynamically typed variables to be checked at compile time.

Here is an extract from the Algol 68 specs (aka Algol 68 Final Report) which gives
a hint of the mind set during design.

0.1.3 Security
ALGOL 68 has been designed in such a way that most syntactical and many other
errors can be detected easily before they lead to calamitous results. Furthermore,
the opportunities for making such errors are greatly restricted.

On this subject, it seems that Algol-68 even tried to extend "Security" & type
checking into the formating of output.  for example in C you can write:

int i=666; fprint("DCLXVI=%5.2f\n");

This probably wont produce a compiler message, nor a useful result.

Whereas in a68:

INT i=666; printf(($"DCLXVI="g(5,2)$,i))

This intention will be picked up by the compiler and a cast/coersion can be
inserted in the code.

Fortunately c++ manages to side-step the issue: eg

int i=666; cout << "DCLXVI=" << i << "\n";

Cheers
NevilleDNZ



More information about the Digitalmars-d mailing list