Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

13
  • 3
    Even in your grandfather's FORTRAN, the fact that a constant must be passed by reference does not imply that the reference has to be "the one and only" instance of that value. Load the constant into a scratch location (on the stack if you have a stack) and set the argument to point to it.
    – dave
    Commented May 26, 2021 at 23:31
  • 4
    And therefore, I regard passing a reference to a writeable "one and only" instance of a constant as a compiler bug - understandable in the context of the times, and who am I to criticize the pioneers, giants that they were, but nevertheless, it's still an implementation decision that does not match language semantics.
    – dave
    Commented May 26, 2021 at 23:48
  • 2
    @texdr.aft - kalgol reports "FAIL 001 IN SECT.4.7.5.2." at run time. As should be perfectly obvious :-), this means an invalid use of an expression called by name. 'SECT.4.7.5.2' is a fixed part of this error message, it does not refer to anything in the original program. Compiler module? Design spec? Documentation reference? No idea. Kalgol always was a little opaque.
    – dave
    Commented May 28, 2021 at 1:59
  • 2
    @another-dave Section 4.7.5.2 of the Algol 60 report: “A formal parameter which occurs as a left part variable in an assignment statement within the procedure body and which is not called by value can only correspond to an actual parameter which is a variable (special case of expression).” I missed this when looking through the report yesterday, but it nicely answers your original inquiry about whether a constant called by name can be assigned to.
    – texdr.aft
    Commented May 28, 2021 at 2:27
  • 2
    @texdr.aft - Oh, duh: it's a reference to the Report. That's actually useful for an error message,
    – dave
    Commented May 28, 2021 at 3:00