Criticism
Jensen's device relies on call by name, but call by name is subtle and has some problems. Consequently, call by name is not available in most languages. Knuth comments that ALGOL 60 cannot express an increment(n)
procedure that increases its argument by one; the call increment(A)
does not do the expected action if i
is a functional that changes with each access. Knuth says, "The use of 'macro' definition facilities to extend language, instead of relying solely on procedures for this purpose, results in a more satisfactory running program."
Others point out that a call by name procedure that swaps its argument can have subtle problems. An obvious swapping procedure is:
procedure swap(a, b) integer a, b; begin integer temp; temp := a; a := b; b := temp; end;The procedure does the right thing for many arguments, but the invocation of swap(i,A)
is problematic. Using the Copy Rule leads to the assignments:
The problem is the second assignment changes i
, so the A
in the third assignment probably will not be the same array element as at the start. If on the other hand the procedure were to be coded the other way around (with b being saved to temp instead of a) then the desired action would result, unless it were invoked as swap(A,i)
Read more about this topic: Jensen's Device
Famous quotes containing the word criticism:
“In criticism I will be bold, and as sternly, absolutely just with friend and foe. From this purpose nothing shall turn me.”
—Edgar Allan Poe (18091845)
“As far as criticism is concerned, we dont resent that unless it is absolutely biased, as it is in most cases.”
—John Vorster (19151983)
“A tailor can adapt to any medium, be it poetry, be it criticism. As a poet, he can mend, and with the scissors of criticism he can divide.”
—Franz Grillparzer (17911872)