On Wednesday 22 November 2006 18:51, Christopher Jordan wrote:

> >> You say that you don't like CF because of the code? That's absolute
> >> nonsense...I'm all for coding, I really enjoy it too, but WHY write an
> >> extra ten lines (or more) of code when you don't have to? Do you rewrite
> >> your Replace function every time you use it?
> >
> > It's just personal preference. foreach($array as $key => $value){...}
> > just makes more sense to me.  It's that simple.
>
> I agree that it's a matter of opinion. But I've gotta say that I *LOVE*
> being able to treat *any* arbitrary string of text as a list (read:
> array). Let me give you an example:
>
> <cfset TheList = ListRest(CGI.HTTP_REFERRER,"?")>
> <cfloop index="i" from="1" to="#ListLen(TheList,"&")#">
>      <cfset ThisItem = ListGetAt(TheList,i,"&")>
>      <cfif ListFirst(ThisItem,"=") EQ "numPageID">
>         <cfset MyNumPageID = ListLast(ThisItem,"=")>
>      </cfif>
>  </cfloop>
>
> This code allows me to treat one string of characters (the http_referrer
> in this case) as three different arrays. I didn't have to create an
> array out of any of it. The very powerful "List" functions allow me to
> accomplish this, and CF handles the conversion to arrays eternally. This
> is *not* to say that I can't create and manipulate arrays directly, and
> that I *have to* use lists instead of arrays, that's just not true. I
> can use the ArrayNew() or StructNew() functions to create arrays and
> structures that I can easily reference and manipulate.

Er, you are aware that you can reference strings as arrays in PHP, or if 
needed convert a string to a real array in one line, right?

for ($i=0; $i < strlen($string); ++$i) {
 print $string[$i] . "\n";
}
foreach (explode($string) as $char) {
 print $char . "\n";
}

You're correct that there is a lot of personal preference involved in choosing 
a language (I write PHP for a living, so I'm biased <g>), but every language 
has its own strengths and weaknesses when you get into it deeply enough.  
Right tool for the right job and all that.  (Perl is all about strings and 
regexes, PHP is all about arrays, Java's all about pointlessly complex object 
hierarchies, oops did I say that aloud? <g>)  

There's also the question of what is supposed on servers other than the one 
you yourself run.  And then in any language, odds are you'll also be using 
various libraries on top of the base language, default ones and 3rd party 
ones and those you write yourself, to do anything actually useful in the real 
world.  The quality and availability of those varies widely across and within 
languages.  

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to