[bitc-dev] Iterator syntax
Michal Suchanek
hramrach at centrum.cz
Tue Mar 30 07:02:19 PDT 2010
On 24 March 2010 21:52, Jonathan S. Shapiro <shap at eros-os.org> wrote:
> On Wed, Mar 24, 2010 at 1:11 PM, Michal Suchanek <hramrach at centrum.cz> wrote:
>>
>> I would say that foreach cycle and while cycle are fundamentally
>> different and while you can make them use the same keyword and similar
>> syntax it does not change that.
>
> I agree. I made an unfortunate choice of subject line. The cases I'm
> actually concerned about here are the "while" and "do" loop cases. The
> "do" loop is easier.
>
You mean the C
while() {}
and
{} while();
loops?
I would expect that for(;;) would not be needed when constructs like
foreach or map are available so you can just have a syntax which
allows the condition to be at the beginning or the end like
loop {} while()
and
loop while() {}
Since this is last resort for cases when cleaner solutions fail I
don't think that the requirement of two keywords is too much.
The two keyword syntax is also reasonably unambiguous and makes it
possible to detect incomplete loops that lack the condition or the
command during compilation.
Thanks
Michal
More information about the bitc-dev
mailing list