Talk:Jensen's Device: Difference between revisions

no edit summary
(New page: It is amazing how wrong some ideas of early computing were. Fortunately none of modern languages really supports this mess. --~~~~)
 
No edit summary
 
(6 intermediate revisions by 5 users not shown)
Line 1:
It is amazing how wrong some ideas of early computing were. Fortunately none of modern languages really supports this mess. --[[User:Dmitry-kazakov|Dmitry-kazakov]] 11:53, 22 November 2008 (UTC)
 
I don't think the guys in the 1960's had a monopoly on bad ideas... take the new "\" (back slash) operator in PHP[http://news.php.net/php.internals/41374] as an example. Fortunately, every now and then, a good idea floats to the top, the trick is being able to spot the good idea early and rewind all the bad ideas even earlier. [[User:NevilleDNZ|NevilleDNZ]] 15:01, 22 November 2008 (UTC)
 
Seeing an entry on Jensen's Device just floats my boat.
 
Not knowing much about ALGOL60, I'm curious about its semantics -- why is i declared twice? When iterating over i, is that value being assigned local to sum, or is it being assigned in sum's caller? --[[User:Saccade|Saccade]] 21:50, 5 May 2011 (UTC)
 
:<code>i</code> is passed by reference to <code>sum</code>, the "first declaration" represents the declaration of the storage and the "second declaration" is the declaration of the type of the argument (much like a K&R C parameter list) in the parameters for <code>sum</code>. --[[User:Rdm|Rdm]] 21:57, 5 May 2011 (UTC)
 
:: Algol 60 actually has no call-by-reference, and <code>i</code> is passed by name (the default in Algol 60). What is shown clearly here is that in Algol 60 you can pass an L-value by name, and an assignment to that parameter will assign to whatever the caller passed. Most later languages don't have call-by-name and therefore use call-by-reference or something like it for <code>i</code>. Scala supposedly has call-by-name, but apparently does not have this L-value-passing feature of Algol 60's call-by-name, so I guess Scala's "call-by-name" is more along the lines of Algol 68's PROC parameters. [[User:Antonertl|Antonertl]] ([[User talk:Antonertl|talk]]) 08:05, 17 March 2024 (UTC)
 
This one is great for elucidating the properties of call-by-name and how one replaces call-by-name in later programming languages, very much in line with the purpose of rosettacode. I think it would have been even greater if several uses of <code>sum</code> had been given, making it harder to move functionality between caller and callee; E.g., the example <code>Sum(i, l, m, Sum(j, l, n, A[i,j]))</code> might have been instructive, but that's water down the river. [[User:Antonertl|Antonertl]] ([[User talk:Antonertl|talk]]) 08:22, 17 March 2024 (UTC)
5

edits