How is ABS(-7) a valid reference? It would be valid if B were call by name or 
call by value, but not for call by reference. Now some compilers would assign 
the value to a temporary variable, but I question whether that would be call by 
reference.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Assembler List <ASSEMBLER-LIST@listserv.uga.edu> on behalf 
of Ze'ev Atlas <000001774d97d104-dmarc-requ...@listserv.uga.edu>
Sent: Sunday, February 11, 2018 8:29 AM
To: ASSEMBLER-LIST@listserv.uga.edu
Subject: Re: Man or boy test

Now that I have understood the concept of call 'by name', I have a semantically 
question and I will use some pseudo code to describe it
Le's say that I have these function definition
FUNC1 (BY NAME A, BY REFERENCE B, BY VALUE C){...}
if I do
i. RESULT = FUNC1 (RAND (5), MYVARNAME1, 7)or ii. RESULT = FUNC1 (RAND (5), 
ABS(-7), MYVARNAME2)

then it is pretty clear what would happen, MYVARNAME1 would be accessible and 
open to changes by FUNC1, 7 and MYVARNAME2 would be evaluated once and a copy 
would be available to FUNC1.  And RAND(5) would always be evaluated anew when 
used.
iii. The use of ABS(-7) is more ambiguous here!
But, concentrating on the first parameter, the by name one, what would happen 
if we do something like
iv. RESULT = FUNC1 (1, MYVARNAME1, 7)or v. RESULT = FUNC1 (1+5, MYVARNAME1, 7)
orvi. RESULT = FUNC1 (MYVARNAME3, MYVARNAME1, 7)

My inclination would be that the compiler should flag cases iii through vi as 
compile time errors (or at least cases iii and vi), but I am afraid that the 
'man compiler' gang would jump on me.

Ze'ev Atlas



    On Saturday, February 10, 2018, 9:02:46 PM EST, Ze'ev Atlas 
<zatl...@yahoo.com> wrote:

Reply via email to