Re: [flexcoders] What's this Called?
square bracket notation http://www.google.com/search?hl=en&q=square+bracket+notation&meta= array access operator http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=array+access+operator&spell=1 regards, Muzak From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson Sent: Monday, March 24, 2008 6:18 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] What's this Called? When I do this["idOfsomethingImLookingfor"] I usually do this if I have to loop something. So: for (i=0; i<10; i++){ var example:Object = this["myComponent" + i] //do some more stuff } I'm trying to do the same thing in .NET. I don't know what it's called though so I'm having a hard time googling it. Thanks, Nate -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] What's this Called?
> Kevin, why do you allege "bad practice"? What are you referring to for that matter? I 2nd bad practice. It's unreadable and less efficient. I would hate to read code where ids were named myComponent1, myComponent2, etc... It would be so much better to just reference readable names in an indexed Array. # var myComponents:Array = [ idFirstName, idLastName, idEmail ]; # # for (var i=0; i wrote: >I have seen and used the term "bracket notation". Don't know how > common it is. > > > > Kevin, why do you allege "bad practice"? What are you referring to for > that matter? > > > > Tracy > > > -- > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Kevin Aebig > *Sent:* Monday, March 24, 2008 9:47 PM > *To:* flexcoders@yahoogroups.com > *Subject:* RE: [flexcoders] What's this Called? > > > > That's called bad practice. The lookup method you're referring to is > called an associative array or dictionary. > > > > !k > > > -- > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Nate Pearson > *Sent:* Monday, March 24, 2008 6:18 PM > *To:* flexcoders@yahoogroups.com > *Subject:* [flexcoders] What's this Called? > > > > When I do this["idOfsomethingImLookingfor"] > > I usually do this if I have to loop something. > > So: > > for (i=0; i<10; i++){ > var example:Object = this["myComponent" + i] > //do some more stuff > } > > I'm trying to do the same thing in .NET. I don't know what it's > called though so I'm having a hard time googling it. > > Thanks, > > Nate > > > -- Aaron Miller Chief Technology Officer Open Base Interactive, LLC. [EMAIL PROTECTED] http://www.openbaseinteractive.com
Re: [flexcoders] What's this Called?
Looking things up in that method foo["bar"] rather than foo.bar, is slow and can cause runtime exceptions if you don't check foo.hasOwnProperty("bar"). You're better off having a foo.bar = Array(), and doing foo.bar[n] rather than foo["bar" + n] whenever possible. The only time you really want to use this sort of syntax is when you're building an assosc. array at runtime and you can't know what the key names will be (eg, it's generated from user-input, or perhaps some framework code). -J On Tue, Mar 25, 2008 at 12:38 PM, Tracy Spratt <[EMAIL PROTECTED]> wrote: >I have seen and used the term "bracket notation". Don't know how > common it is. > > > > Kevin, why do you allege "bad practice"? What are you referring to for > that matter? > > > > Tracy > > > -- > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Kevin Aebig > *Sent:* Monday, March 24, 2008 9:47 PM > *To:* flexcoders@yahoogroups.com > *Subject:* RE: [flexcoders] What's this Called? > > > > That's called bad practice. The lookup method you're referring to is > called an associative array or dictionary. > > > > !k > > > -- > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Nate Pearson > *Sent:* Monday, March 24, 2008 6:18 PM > *To:* flexcoders@yahoogroups.com > *Subject:* [flexcoders] What's this Called? > > > > When I do this["idOfsomethingImLookingfor"] > > I usually do this if I have to loop something. > > So: > > for (i=0; i<10; i++){ > var example:Object = this["myComponent" + i] > //do some more stuff > } > > I'm trying to do the same thing in .NET. I don't know what it's > called though so I'm having a hard time googling it. > > Thanks, > > Nate > > > -- "Therefore, send not to know For whom the bell tolls, It tolls for thee." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
RE: [flexcoders] What's this Called?
I have seen and used the term "bracket notation". Don't know how common it is. Kevin, why do you allege "bad practice"? What are you referring to for that matter? Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Aebig Sent: Monday, March 24, 2008 9:47 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] What's this Called? That's called bad practice. The lookup method you're referring to is called an associative array or dictionary. !k From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson Sent: Monday, March 24, 2008 6:18 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] What's this Called? When I do this["idOfsomethingImLookingfor"] I usually do this if I have to loop something. So: for (i=0; i<10; i++){ var example:Object = this["myComponent" + i] //do some more stuff } I'm trying to do the same thing in .NET. I don't know what it's called though so I'm having a hard time googling it. Thanks, Nate
RE: [flexcoders] What's this Called?
That's called bad practice. The lookup method you're referring to is called an associative array or dictionary. !k _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson Sent: Monday, March 24, 2008 6:18 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] What's this Called? When I do this["idOfsomethingImLookingfor"] I usually do this if I have to loop something. So: for (i=0; i<10; i++){ var example:Object = this["myComponent" + i] //do some more stuff } I'm trying to do the same thing in .NET. I don't know what it's called though so I'm having a hard time googling it. Thanks, Nate
RE: [flexcoders] What's this Called?
You shouldn't be doing that... it's bad practice. You should be using an Array and looking items up by integer index - rather than using an Object and looking items up by an index-containing name string -- because it's considerably more efficient. The only time you should look up properties by name is when you don't know at author time what name you'll be looking up. Gordon Smith Adobe Flex SDK Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson Sent: Monday, March 24, 2008 5:18 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] What's this Called? When I do this["idOfsomethingImLookingfor"] I usually do this if I have to loop something. So: for (i=0; i<10; i++){ var example:Object = this["myComponent" + i] //do some more stuff } I'm trying to do the same thing in .NET. I don't know what it's called though so I'm having a hard time googling it. Thanks, Nate