From: Stefan.Lucks@uni-weimar.de
Subject: Re: Question about asynchronous calls
Date: Thu, 7 Nov 2013 08:46:54 +0100
Date: 2013-11-07T08:46:54+01:00 [thread overview]
Message-ID: <alpine.DEB.2.10.1311070825170.26025@debian> (raw)
In-Reply-To: <60be5eb1-85e0-43c5-8c81-d191ee805dd3@googlegroups.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1560 bytes --]
On Wed, 6 Nov 2013, mockturtle wrote:
> type Matlab_Name is new
> String
> with Dynamic_Predicate =>
> (for all I in Matlab_Name'Range =>
> Is_Alphanumeric (Matlab_Name (I)) or Matlab_Name (I) = '_')
> and
> Is_Letter (Matlab_Name (Matlab_Name'First));
I suggest to write the following.
with Dynamic_Predicate =>
( Natlab_Name'Length > 0
and then
Is_Letter (Matlab_Name (Matlab_Name'First)
and then
for all I in Matlab_Name'First+1 .. Matlab'Last =>
Is_Alphanumeric (Matlab_Name (I)) or Matlab_Name (I) = '_')
);
(Warning: not syntax checked!)
The "Natlab_Name'Length > 0 and then" part is important -- your code would
raise Constraint_Error if the Matlab_Name is the empty string.
The other modifications are a matter of taste.
For me, first checking the first character, and then checking the other
characters is more intuitive than doing it the other way. Also, I rather
avoid the redundant check for the first letter being alphanumeric or '_',
since the first character is checked for being a letter, anyway.
And I wouldn't bother to replace the second "and then" by "and", as it has
been in your code. However, mixing "and then" and "and" requires
additional brackets, which I would prefer to avoid.
------ I love the taste of Cryptanalysis in the morning! ------
<http://www.uni-weimar.de/cms/medien/mediensicherheit/home.html>
--Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universität Weimar, Germany--
next prev parent reply other threads:[~2013-11-07 7:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 11:05 Question about asynchronous calls mockturtle
2013-11-06 18:49 ` J-P. Rosen
2013-11-06 20:40 ` mockturtle
2013-11-06 19:54 ` Shark8
2013-11-06 20:49 ` mockturtle
2013-11-07 7:46 ` Stefan.Lucks [this message]
2013-11-07 10:23 ` Predicates (was: Question about asynchronous calls) Georg Bauhaus
2013-11-07 18:59 ` Question about asynchronous calls mockturtle
2013-11-07 8:18 ` Jacob Sparre Andersen
2013-11-07 19:00 ` mockturtle
2013-11-06 20:49 ` Jeffrey Carter
2013-11-06 20:58 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox