|
I developed in used Algol68, C, C++ and Python. Maybe I can step in heer and make a few comments.
Thunking is basically allowing you to pass argument to a procedure WITHOUT any procedure type declarations. Kind of like a #define func() in C and a Template in C++.
However... thunking was allowed to be RECURSIVE and TYPELESS!!! (Try a recursive #define in C?? ;-)
Algol68 did not have ANY thunking because it was just too tough. Indeed Buroughs has to implement Thunking in special Hardware op codes for Algol60.
Algol68 was picky about coercing (known as casting in C) and had a hierarchy of coercing/casting rules:
soft-weak-meek-firm-strong as follows:
Context strength Allowed coercions
soft deproceduring
weak dereferencing or deproceduring, yielding a name
meek dereferencing or deproceduring
firm meek, followed by uniting
strong firm, followed by widening, rowing or voiding
The reason for this was to avoid having to specifically/manually coercing/cast with a type operator. eg in C you sometimes need to for a type change with something like (float)1, or *str to get a type char, or funct() to yield the return value.
C was nice because you had to do most casting manually, and so you knew exactly what type you were dealing with type coercing/casting. C++ is nice because you can define your own coercing/casting rules on classes.
In a strange sort of way Algol68 was kind of the "missing link" between C and and C++. For example, in Algol68 the coercing/casting rule for REAL to COMPLex could not be defined by the programmer, it was build into the compiler. In C++ the programmer has (almost) total freedom to define this casting rules, and even some context/syntax checking. In C, even to this day the coercing/casting from REAL to COMPLex must be done manually.
Python pains me because it is like Algol60 thunking all over again, but interpreted, not compiled. I dont want to be cruel, but it is kind of like turning the clock back 45 years to 1960. In python the "compiler" is impotent to pick up many "type" bugs at compile time (that in other languages would be simple syntax errors)
BTW: Python DOES have some nice stuff that I won't cover here... :-)
NevilleDNZ
BTW: Microsoft reinvented the word Thunking to describe running win16 programs on a Win32 subsystem. Stand by for Thunk64s on Itanium.
|