Comparing Multiple Values (the story so far/summary)

okibi spam at ratedo.com
Wed Mar 12 02:58:54 PDT 2008


Bill Baxter Wrote:

> downs wrote:
> > Bill Baxter wrote:
> >> BCS wrote:
> >>> Reply to Downs,
> >>>
> >>>> Bill Baxter wrote:
> >>>>
> >>>>> downs wrote:
> >>>>>
> >>>>>> `in` already is an infix operator :)
> >>>>>>
> >>>>>> --downs
> >>>>>>
> >>>>> Yes, but it doesn't work!
> >>>>>
> >>>>> --bb
> >>>>>
> >>>> Curious.
> >>>>
> >>>> Works here, GDC 1.028 / 4.1.2
> >>>>
> >>>> What are you using?
> >>>>
> >>>> --downs
> >>>>
> >>> I think he was saying the "in" operator dosn't work / works wrong. 
> >> Right, as in "a in [1,2,3]"  is an error, rather than doing what the
> >> poster who started this thread expected it to do.
> >>
> > 
> > To give an example of W's stance ..
> > 
> > Say you have a book with four pages.
> > 
> > The first page contains the number 15, the second page 16 the third 23 and the fourth 42.
> > 
> > Now, if I ask "3 in book", do I mean "is the page 3 in the book" (index) or "is the number 3 in the book" (value)?
> > 
> > There's precedence in the D language for the first case, because `in` for AAs also checks against index (key) and not value.
> > 
> > However, checking against value would arguably be more useful :)
> > 
> > In the absence of a consensus, and because a case could be made for both possibilities, it was decided to leave it out for now.
> > 
> > That should about sum it up.
> 
> Yes, that sums it up quite nicely.
> 
> --bb

Thanks for clearing up why it's not in there. I was really expecting it to work as I thought, however it's no big deal. Thanks everyone!


More information about the Digitalmars-d-learn mailing list