if (int x=..) but no while(int x=..) ?

charles admin at tdjonline.com
Tue May 2 09:32:08 PDT 2006


The only reason if ( ) is allowed assignment is for support for RegEx.

Hmm after some tests assignment is only allowed if there is a declared type
in their also, so the '=  / ==' bug is no longer a concern, I vote we add
it.

Charlie

"Kyle Furlong" <kylefurlong at gmail.com> wrote in message
news:e378qo$2n1c$1 at digitaldaemon.com...
> Lionello Lunesu wrote:
> > Lionello Lunesu wrote:
> >> I like the fact that we can do
> >>
> >> # if (int recvd = ts.receive(buffer)) {...}
> >>
> >> but is there any reason why this shouldn't apply to "while" also?
> >>
> >> # while (int recvd = ts.receive(buffer)) {...}
> >>
> >> main.d(26): found 'recvd' when expecting '.' following 'int'
> >> main.d(26): found '=' when expecting identifier following 'int.'
> >> main.d(26): found 'ts' when expecting ')'
> >> main.d(26): found ')' when expecting ';' following 'statement'
> >
> > *BUMP*
> >
> > What's the status on this issue? Is there any reason why the syntax of
> > "while" is different from the syntax of "if" ?
> >
> > According to tests done by Kelly Wilson it's trivial to support.
> >
> > Sorry for the bump, but this seems like a forgotten issue.
> >
> > L.
>
> This needs implementing.





More information about the Digitalmars-d mailing list