RE: [sv-bc] Constant method calls

From: Steven Sharp <sharp_at_.....>
Date: Tue Feb 12 2008 - 11:16:22 PST
Presumably there are two options for enumval.next(N) when enumval has an
invalid value:

1. Return the default initial value, regardless of what N is.

2. Treat enumval.next(N) as being equivalent to enumval.next.next(N-1)
for a value of N > 1.  In this case, the first application of next would
produce the default initial value.  If that is an invalid enum value,
then the result is the same as the first option, since each additional
application returns that same invalid value.  However, if it is a valid
enum value, then the result would be the same as applying next(N-1) to
that value.

The second option is more mathematically elegant.

Note that similar reasoning would define enumval.next(0) as being enumval,
since that is the result of applying next 0 times.

Suppose we accept that enumval.next(0) is the same as enumval when
enumval is a valid value.  If enumval is not a valid value, then the
way to extend each of the options above seems obvious.  In the first
option, enumval.next(0) would return the default initial value, since
it does that regardless of what N is.  In the second option, it would
return enumval, since that is the result of applying next o times.


>X-Authentication-Warning: server.eda.org: majordom set sender to 
owner-sv-bc@eda.org using -f
>X-ExtLoop1: 1
>X-IronPort-AV: E=Sophos;i="4.25,334,1199692800";  d="scan'208";a="516746266"
>X-MimeOLE: Produced By Microsoft Exchange V6.5
>Content-class: urn:content-classes:message
>MIME-Version: 1.0
>Subject: RE: [sv-bc] Constant method calls
>Date: Mon, 11 Feb 2008 21:45:53 +0200
>X-MS-Has-Attach: 
>X-MS-TNEF-Correlator: 
>Thread-Topic: [sv-bc] Constant method calls
>Thread-Index: Achs5A+ZHCh63J9ES1u+vhc2WrQMMAAAOJAg
>From: "Bresticker, Shalom" <shalom.bresticker@intel.com>
>To: "Greg Jaxon" <Greg.Jaxon@synopsys.com>, "Surya Pratik Saha" 
<spsaha@cal.interrasystems.com>, <sv-bc@eda.org>
>Cc: <sarani@cal.interrasystems.com>
>X-OriginalArrivalTime: 11 Feb 2008 19:46:22.0266 (UTC) 
FILETIME=[C75651A0:01C86CE6]
>X-eda.org-MailScanner: Found to be clean, Found to be clean
>X-Spam-Status: No, No
>Content-Transfer-Encoding: 8bit
>X-MIME-Autoconverted: from quoted-printable to 8bit by server.eda.org id 
m1BKvXaM019686
>X-eda.org-MailScanner-Information: Please contact the ISP for more information
>X-eda.org-MailScanner-From: owner-sv-bc@server.eda.org
>X-pstn-neptune: 0/0/0.00/0
>X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 R:95.9108 P:95.9108 M:97.0282 
C:98.6951 )
>X-Received: By mx-sanjose2.Cadence.COM as m1BLIBWG008195 at Mon Feb 11 13:18:11 
2008
>
>Greg,
>
>> The special case of 
>> Next() for an out-of-range enum value is also not clear - is 
>> the answer the same as .First() for /all/ values of N, or 
>> only for N=1 (the default)?
>
>The LRM says,
>"If the given value is not a member of the enumeration, the next()
>method returns the
>default initial value for the enumeration."
>
>You seem to assume that the 'default initial value for the enumeration'
>means .first().
>
>I don't think that is necessarily so. I think it refers to Table 6-1.
>Otherwise, it would have said, "the first member of the enumeration".
>That default initial value is not necessarily a member of the
>enumeration.
>
>Your question is still valid though.
>
>Regards,
>Shalom
>---------------------------------------------------------------------
>Intel Israel (74) Limited
>
>This e-mail and any attachments may contain confidential material for
>the sole use of the intended recipient(s). Any review or distribution
>by others is strictly prohibited. If you are not the intended
>recipient, please contact the sender and delete all copies.
>
>
>-- 
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.
>
>

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Feb 12 11:16:58 2008

This archive was generated by hypermail 2.1.8 : Tue Feb 12 2008 - 11:17:15 PST