Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 06, 2004 assoc-arrays; "not in" syntax | ||||
---|---|---|---|---|
| ||||
if(file1 in map2) { } else { printf(" %.*s\n", file1); } works ok, but if(file1 not in map2) { printf(" %.*s\n", file1); } fails, as does if(not file1 in map2) { printf(" %.*s\n", file1); } the only other one that works is if(!(file1 in map2)) { printf(" %.*s\n", file1); } I like the second form. Can we have that? Matthew |
February 06, 2004 Re: assoc-arrays; "not in" syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | While it was 6/2/04 7:14 am throughout the UK, Matthew Wilson sprinkled little black dots on a white screen, and they fell thus: <snip> > if(file1 not in map2) > { > printf(" %.*s\n", file1); > } > > fails <snip> > I like the second form. Can we have that? I guess that's really a matter if whether the syntactic sugar of such compound operators is worth implementing. If we're going to allow this, then we might as well allow such expressions as qwert not == yuiop asdfg not || hjkl etc. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. |
February 06, 2004 Re: assoc-arrays; "not in" syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Stewart Gordon wrote:
>> if(file1 not in map2)
>> I like the second form. Can we have that?
>
>
> I guess that's really a matter if whether the syntactic sugar of such compound operators is worth implementing. If we're going to allow this, then we might as well allow such expressions as
>
> qwert not == yuiop
> asdfg not || hjkl
Hmmm. Somehow, this doesn't quite fit into the language.
Why not using the "normal" way for C-based languages? I.e.
if(a !in b)
Hauke
|
February 06, 2004 Re: assoc-arrays; "not in" syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:c00bc1$12jt$1@digitaldaemon.com... > While it was 6/2/04 7:14 am throughout the UK, Matthew Wilson sprinkled little black dots on a white screen, and they fell thus: > > <snip> > > if(file1 not in map2) > > { > > printf(" %.*s\n", file1); > > } > > > > fails > <snip> > > I like the second form. Can we have that? > > I guess that's really a matter if whether the syntactic sugar of such compound operators is worth implementing. If we're going to allow this, then we might as well allow such expressions as > > qwert not == yuiop > asdfg not || hjkl I don't see that that follows. What has == got to do with the "in" operator? |
February 06, 2004 Re: assoc-arrays; "not in" syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hauke Duden | "Hauke Duden" <H.NS.Duden@gmx.net> wrote in message news:c00eoq$1870$1@digitaldaemon.com... > Stewart Gordon wrote: > >> if(file1 not in map2) > >> I like the second form. Can we have that? > > > > > > I guess that's really a matter if whether the syntactic sugar of such compound operators is worth implementing. If we're going to allow this, then we might as well allow such expressions as > > > > qwert not == yuiop > > asdfg not || hjkl > > Hmmm. Somehow, this doesn't quite fit into the language. > > Why not using the "normal" way for C-based languages? I.e. > > if(a !in b) That would be fine. |
February 09, 2004 Re: assoc-arrays; "not in" syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | While it was 6/2/04 8:59 pm throughout the UK, Matthew sprinkled little black dots on a white screen, and they fell thus: <snip> >> qwert not == yuiop >> asdfg not || hjkl > > > I don't see that that follows. What has == got to do with the "in" > operator? Comparatively little. But plenty in common: - both are binary operators - both evaluate to a boolean value Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. |
Copyright © 1999-2021 by the D Language Foundation