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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,92c39a3be0a7f17d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-12 00:14:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.online.be!newsgate.cistron.nl!psiuk-p2!psiuk-p3!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Future with Ada Date: Mon, 11 Mar 2002 18:56:06 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: References: <3C7B0B13.3080003@worldnet.att.net> <3C7D1C89.2000803@home.com> <3C7E7CAD.7070504@mail.com> <3C7FB9D2.D9C6E055@boeing.com> <3C81DF1F.9000503@mail.com> <3C83A112.6080302@mail.com> <3C84223C.A356F466@adaworks.com> <3C853A04.34826F39@despammed.com> <3C8D0D70.BB09F3DA@despammed.com> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 1015890969 18892 136.170.200.133 (11 Mar 2002 23:56:09 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 11 Mar 2002 23:56:09 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:21098 Date: 2002-03-11T23:56:09+00:00 List-Id: I *think* we're on the same wavelength. I was trying to say I don't object to something like: case (Var) is when Enum_01 => Something_01 ; when Enum_02 => Something_02 ; when Enum_03 => Something_03 ; when Enum_04 => Something_04 ; when Enum_05 => Something_05 ; when Enum_06 => Something_06 ; when Enum_etc => Something_etc ; when others => Something_Others ; end case ; And I would find attempts to go through gyrations to make this shorter just to fit some kind of "Don't make a case statement longer than twentysomething lines" rule a bit silly. My original illustration was to show a stupid-code-trick needed to bust up the case statement to make it shorter. Can you think of a way to make a case statement like this shorter that doesn't look silly? (Assuming you've got 20 or so enumerals for some reason - op-codes maybe? Lexical elements of some language you're parsing? Reserved words in Ada? Not hard to imagine a fairly long list of enumerals, eh?) Once that case statement gets longer than a screen, I'd find it handy to have a name at the end of it reminding me of what I'm ending. Of course, one could always encase the case in a procedure that did nothing more than provide the name for the check - and I'd think that was a good thing. But would you try to make that procedure into three procedures if the case was 75 lines long just to shorten it up into 25 line segments? Maybe I've run into similar things with if statements or nesting of structures and didn't want to start making subprograms that had no identifiable function other than to encapsulate some arbitrary chunk of code & avoid some arbitrary nesting or line length limit. If I can write a subprogram name like: "Is_Device_Ready" or "Check_Employee_Payroll_Deductions" then I'm more than fine about taking that nested if or long stream of code and hiding it in there. If I have a hard time writing a good name for it and start resorting to "Run_Some_Long_Block_Of_Code_To_Avoid_The_Nesting_Police", then I know I'm better off leaving it the way it was. :-) (It reminds me of stunts pulled to get subroutines under some arbitrary line limit - divide the routine you have by the number of lines in the arbitrary limit and just find convenient places to cut along those breaks. One 400 line subroutine becomes four 100 line routines with a "main" to call each in sequence, eh? :-) MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Wes Groleau" wrote in message news:3C8D0D70.BB09F3DA@despammed.com... > > > when others => > > Do_Another_Case_In_A_Procedure (var) ; -- I *would* object to this. > > I would, too. But I would probably NOT object to > > when others => > Default_Var_Handling (voo); > > Matter of fact, whether by nesting or by calling, > I would object to a case choice on a variable that > dispatches to a case on the same variable. > > -- > Wes Groleau > http://freepages.rootsweb.com/~wgroleau