osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tutor] beginning to code


On Sun, 24 Sep 2017 12:37 pm, Bill wrote:

>> For example, if I made "Pass-By-Reference Python" where all argument passing
>> was done by reference, my language would differ from real Python:
>>
>>
>> function(x, y)  # allowed
>> function(namespace.x, module.y)  # allowed
>> function(x + 1, 2)  # FORBIDDEN: can't pass expressions or constants
> 
> This would be okay as long as x + 1 evaluates to an object, no?

Not in Pascal, no.

(Pascal pre-dated objects, but by the 80s there were various forms of Pascal
with objects.)

Pascal requires that the actual argument passed to the var parameter be an
actual variable, not a constant or expression. Technically, it must be
a "L-value", something which can appear on the left hand side of an assignment
and therefore something that has an address.



-- 
Steve
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.