From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-18 15:31:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.airnews.net!cabal12.airnews.net!usenet From: "John R. Strohm" Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X "left hand side" repeater. Date: Wed, 18 Jun 2003 17:13:25 -0500 Organization: Airnews.net! at Internet America Message-ID: References: <3EECA772.4B662024@adaworks.com> Xref: archiver1.google.com comp.lang.ada:39416 Date: 2003-06-18T17:13:25-05:00 List-Id: X-A-Notice: References line has been trimed due to 512 byte limitation Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library2.airnews.net NNTP-Posting-Time: Wed, 18 Jun 2003 17:30:16 -0500 (CDT) NNTP-Posting-Host: !](H71k-X>o5Ee< (Encoded at Airnews!) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 "Chad R. Meiners" wrote in message news:bcnvrr$mdg$1@msunews.cl.msu.edu... > > "Bill Findlay" wrote in message > news:BB14D345.35C8%yaldnifw@blueyonder.co.uk... > >> > > > What about using 'is' to express identity? e.g.: > > > > > > Pixel is Screen.Buffer(i) in Pixel := Pixel + 1; > > I think I like this. > > > > It's not exactly concise, though. Nor is any 'implicit renaming' > solution. > > Perhaps simplified is a better description because it allows the written > format to enhance readability. > > Pixel is Screen.Buffer(i) in > Pixel := Pixel + 1; > > It also separates the dual concerns of naming complex expression and having > clear statements while keeping the names in sight of each other. Perhaps the > above sample is too simple how about > > Pixel is Screen.Buffer(i) in > Pixel := To_Red(Get_Green(Pixel)) + To_Green(Get_Blue(Pixel)) + > To_Blue(Get_Red(Pixel)); > > versus > > declare > Pixel : Buffer_Element renames Screen.Buffer(i); > Red : constant Scale := Get_Red(Pixel); > Green : constant Scale := Get_Green(Pixel); > Blue : constant Scale := Get_Blue(Pixel); > begin > Pixel := To_Red(Green) + To_Green(Blue) + To_Blue(Red); > end; > > or > > Screen.Buffer(i) := To_Red(Get_Green(Screen.Buffer(i))) + > To_Green(Get_Blue(Screen.Buffer(i))) + > To_Blue(Get_Red(Screen.Buffer(i))); Maybe I'm just weird, but I happen to think that declare Pixel : Buffer_Element renames Screen.Buffer(i); begin Pixel := To_Red(Get_Green(Pixel)) + To_Green(Get_Blue(Pixel)) + To_Blue(Get_Red(Pixel)); end; is about right. Further, more to the point, your concept is in is unbracketed. This is explicitly contrary to Ada practice. Ada has EVERYWHERE ELSE eschewed single-statement scope limits, preferring explicitly-bracketed scope instead. In C, one writes if (condition) statement; while (condition) statement; do statement while (condition); In PASCAL, one writes: if condition then statement else statement; while condition do statement; (In PASCAL, repeat-until is the exception.) In both of these languages, one frequently gets trampled by the bugs when one needs to add a second statement to the activity. By contrast, Ada in all cases intentionally brackets the statement bodies: if condition then statement; [statement; statement;] end if; while condition loop statement; [statement; statement;] end loop; One would expect that any such construct as yours should use explicit bracketing, rather than implicitly bracket to one statement. Now consider: declare Pixel : Buffer_Element renames Screen.Buffer(i); begin Pixel.Color := To_Red(Get_Green(Pixel.Color)) + To_Green(Get_Blue(Pixel.Color)) + To_Blue(Get_Red(Pixel.Color)); Pixel.Highlight := 255 - Pixel.Highlight; end; vs. your Pixel is Screen.Buffer(i) in Pixel.Color := To_Red(Get_Green(Pixel.Color)) + To_Green(Get_Blue(Pixel.Color)) + To_Blue(Get_Red(Pixel.Color)); Pixel is Screen.Buffer(i) in Pixel.Highlight := 255 - Pixel.Highlight; This is precisely the kind of thing that Ada design specifically attempts to avoid.