I knew when I posted that I'd be in for it :)

Like I said I converted a gigantic app into CF that had loads of this sort of stuff in 
it.  Very complex U.S. zip code territory stuff, among other things, that relied on 
this sort of functionality and had to all be rewritten.  The original runs amazingly 
fast for its size, but then again its not a web app.  

-------------------------------------------
 Matt Robertson,     [EMAIL PROTECTED]
 MSB Designs, Inc. http://mysecretbase.com
-------------------------------------------


---------- Original Message ----------------------------------
From: "James Ang" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
date: Wed, 26 Mar 2003 15:42:09 -0800

>I think the execution time for the if/elseif/else code would be the same
>as dynamic cfcases (if the feature is introduced and used). :P
>
>The only reason cfswitch is faster than if/elseif/else is that at
>compile time, the values for the cfcases are known. The comparison
>operations would be easy (no memory lookups, and you could use labels
>and gotos in the pcode/machine code). If you have written assembly or a
>compiler, you would know what I mean. :P
>
>Nevertheless, I am not disputing that the syntactic elegance (I just
>love syntactic sugar!) of dynamic cfcase. :) Maybe MACR CAN introduce
>this feature by ONLY compiling to the "real" switch/case of the C/Java
>equivalents when ALL CFCASES are literals else convert the statement to
>a bunch of if/elseif/else. That may not be too hard to do. I am not
>sure. :) The documentation should warn the user of the performance
>impact of using dynamic cfcase though. ;)
>
>Care to comment, Mr. Sean Corfield? :P
>
>I know some hardcore programmers are probably groaning now. ;)
>
>-------------------------------
>James Ang
>Sr. Developer/Product Engineer
>MedSeek, Inc.
>[EMAIL PROTECTED]
>
>
>
>-----Original Message-----
>From: Matt Robertson [mailto:[EMAIL PROTECTED] 
>Sent: Wednesday, March 26, 2003 3:26 PM
>To: CF-Talk
>Subject: RE: Using variables in a Switch case?
>
>
>James wrote:
>>Uhm.. If..elseif..elseif..elseif..etc..else..endif
>and
>>CFMX has the same "problem".
>
>And rest assured it is a problem that is not afflicted on every
>language.  I posted a feature request for this functionality and some
>others to Macromedia and it didn't get anywhere.  My impression was the
>speed of the tag would have been degraded in this environment if such a
>feature had been added.  Shame because it is incredibly powerful.
>
>Lets say, for example, you have a chunk of code that has to branch in
>one of 50 directions, and those directions are variable depending on
>stuff that happened further up the pipe.  
>
>Compare the exercution time of hobbling thru 50 elseifs versus one case
>statement where the only code that gets executed is the case you need at
>the moment.
>
>Or wouldn't it be nice to be able to code this:
>
>select case zipcode%
>  case 93701:territory%=1
>  case is 93702 to 93750:territory%=2
>  case is 93751, 93752, 93754, 93755 to 94900:territory%=3
>  case > 94901:territory%=4
>  case else:territory%=5
>end case
>
>Can you write this some other way?  Yes.  As elegantly?  I had to
>translate an insurance company's entire rating system into CF and I
>sorely missed the ability to use variables and ranges in case
>statements.  So would you if you had the opportunity to use them.
>
>I'd like to see something like this in CF still.  Never mind the speed.
>Look at the functionality.
>
>-------------------------------------------
> Matt Robertson,     [EMAIL PROTECTED]
> MSB Designs, Inc. http://mysecretbase.com
>-------------------------------------------
>
> 
>             
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to