Revamping associative arrays

Leandro Lucarella llucax at gmail.com
Mon Oct 19 15:52:59 PDT 2009


Bill Baxter, el 19 de octubre a las 14:18 me escribiste:
> On Mon, Oct 19, 2009 at 1:58 PM, KennyTM~ <kennytm at gmail.com> wrote:
> > On Oct 20, 09 03:40, Piotrek wrote:
> >>
> >> Bill Baxter pisze:
> >>>>>
> >>>>> Just get rid of the the one-argument foreach over AAs altogether and
> >>>>> force
> >>>>> the user to be
> >>>>> explicit about it.
> >>>>
> >>>> I wouldn't do so. Would anybody do an error by thinking that foreach
> >>>> (elem,table) should iterate over keys?
> >>>
> >>> Bearophile. And anyone coming from python, at the least. And anyone
> >>> who agrees with the logic of connecting 'in' with what gets iterated.
> >>>
> >>
> >> And only python that I am aware of. Java,C#,PHP (which hold most of all
> >> programmers) are defaulting to values unless explicitly stated.
> >>
> >
> > and Javascript. and Objective-C.
> 
> I took a look at C# yesterday, and I don't think it is true there.
> As far as I can tell IDictionary is the closest thing to AA in C#, and
> for it default iteration yields Key,Value pairs called
> DictionaryEntry.  MSDN Says: "Since each element of the IDictionary
> object is a key/value pair, the element type is not the type of the
> key or the type of the value. Instead, the element type is
> DictionaryEntry."

I guess everybody knows, but this is what C++ does =P

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Did you know the originally a Danish guy invented the burglar-alarm
unfortunately, it got stolen



More information about the Digitalmars-d mailing list