Hello

Gotos are considered harmful for a reason. They allow you to bypass every
static block scope rules. Rust is a language with many static analysis
concerning typing and scope rules. I don't think goto statements integrate
well in such languages.

On the other hand, I never felt gotos missing when writing FSM simulation
code, but we do have a very nice syntax for jumping out of nested loops :

g: for i in foo.iter() {
    // ...
    h: loop {
        if foo { break g; }
        continue h;
    }
}

This syntax only allows to jump at the beginning of a lexical block, and
only to an larger scope, thus not infriging any static lexical rule.

Leo

Le 23 mars 2014 16:59, "Clark Gaebel" <cg.wowus...@gmail.com> a écrit :
>
> Use tail call recursion for your FSMs.
>
> On Mar 23, 2014 11:57 AM, "Jérôme Bartand" <moije...@gmail.com> wrote:
>>
>> Hello fellow Rustians,
>>
>> I noticed that there is no goto statement in Rust yet. Gotos are very
useful e.g. for writing FSMs or for code generation and can, if used
sensibly, often make code more readable than code with traditional control
structures and temporary variables.
>> Can we please have a goto statement in Rust?
>>
>> Please no stupid remarks like "goto fail" or "go to statement considered
harmful" or similar (the Apple bug was not caused by the goto and Rust has
unreachable code detection).
>>
>> Thanks
>>
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev@mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
>>
>
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to