Talk:Jensen's Device: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 8:
 
:<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