RE: [sv-bc] Mantis 1602: task/function inout arg defaults - draft proposal

From: Alsop, Thomas R <thomas.r.alsop_at_.....>
Date: Wed Aug 15 2007 - 22:29:57 PDT
Shalom,

 

This wording is confusing to me.  

 

Each time a subroutine call using the default is made, the call is
treated as though the default had been written explicitly in the
subroutine call

 

The description goes on to say that "However, the default expression is
evaluated in the scope containing the subroutine declaration, not in the
scope containing the subroutine call"  This second sentence does make
sense to me as does the original statements "The expression is evaluated
in the scope containing the subroutine declaration each time a call
using the default is made".  The way I understand this is that the
default expression will be evaluated within the scope of the subroutine
definition/declaration.  

 

I don't understand why we have to mention anything about the subroutine
call or what you are trying to convey.  What is the implication of how
the call is "treated" by the default being written there?  

 

I am a little confused as well about when we would use a default
assignment to an output.  The only one I can think of would be a
subroutine that has an if statement in it and we are assigning to the
output within the if statement.  If the if expression was not true then
the default output assignment happens.  But then an else statement does
the same thing so not sure you buy anything here.  

 

I'd like to further ask for clarification in the following paragraph
even though it's not part of this Mantis item.  Perhaps I just need
someone to explain it to me.  

 

When the subroutine is called, arguments with default values can be
omitted from the call, and the compiler

shall insert their corresponding values. Unspecified (or empty)
arguments can be used as placeholders for

default arguments, allowing the use of nonconsecutive default arguments.
If an unspecified argument is used

for an argument that does not have a default value, a compiler error
shall be issued.

 

In the first sentence, what do we mean by omitted?  Do we mean this
where the third argument is completely missing?

 

read( , 5 ); // is equivalent to read( 0, 5, 1 );

 

Or do we mean this where we put the comma delimiter in the call?

 

read( , 5 , ); // is equivalent to read( 0, 5, 1 );

 

Which leads me to the second sentence about unspecified (or empty)
arguments.  Again, is that the first or second example above? And what
is meant by these empty arguments being a placeholder for default
arguments? An example is worth a thousand words here.  I am also
confused by the "allowing the use of nonconsecutive default arguments".
Again, another example would clarify this completely.  And finally the
last sentence can have another example like this, at least this is what
I think is meant:

 

read( 1, , 7 ); // error, k has no default

 

Thanks, -Tom

 

________________________________

From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org] On
Behalf Of Rich, Dave
Sent: Tuesday, August 14, 2007 11:33 PM
To: Bresticker, Shalom; sv-bc
Subject: RE: [sv-bc] Mantis 1602: task/function inout arg defaults -
draft proposal

 

Hi Shalom,

 

This still does not explain when the default expression is applied to an
output, or why you would want to use one. If the only purpose is to
leave the output unconnected, why don't we use something like

 

output/inout int arg = null; 

 

to say that the output may be discarded if left unconnected.

 

We probably should only allow const ref arguments, not ref arguments to
specify a default.

 

I liked the original wording about the default expression being bound to
the declaration scope. I don't like words like "as though" to describe
behavior.

 

________________________________

From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org] On
Behalf Of Bresticker, Shalom
Sent: Tuesday, August 14, 2007 10:44 PM
To: sv-bc
Subject: FW: [sv-bc] Mantis 1602: task/function inout arg defaults -
draft proposal

 

Hi,

 

I did not get any responses to this.

 

Please comment.

 

Thanks,

Shalom

 

________________________________

From: owner-sv-bc@server.eda.org [mailto:owner-sv-bc@server.eda.org] On
Behalf Of Bresticker, Shalom
Sent: Friday, August 03, 2007 6:29 PM
To: sv-bc
Subject: [sv-bc] Mantis 1602: task/function inout arg defaults - draft
proposal

<<1602_D3a.doc>> 
Hi, 

I have attached a draft proposal for Mantis 1602, clarifying the
behavior of subroutine inout argument defaults and also allowing output
defaults. It still does not cover allowing output arguments to be
unconnected. Please comment.

The phrasing about identifiers in the defaults being bound from the
scope of the subroutine declaration is the same as the original
phrasing, but I feel it is not clear enough and requires some examples
to clarify it.

Thanks, 
Shalom 

Shalom Bresticker 
Intel Jerusalem LAD DA 
+972 2 589-6852 
+972 54 721-1033 


-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 


-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 
-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Aug 15 22:30:40 2007

This archive was generated by hypermail 2.1.8 : Wed Aug 15 2007 - 22:31:18 PDT