Rust with indents (Python, CoffeeScript, Haskell, F# style)


#41

I don’t mind whitespace dependent syntax, and i don’t think that blocks are a significant problem (macros might be).

But having different syntaxes für rust would has the potential to be extremly damaging to the language as a whole. I’m sure we would be better served by a cannocial rustformat tool.

Edit: Just an idea: Change the style convention that closing braces are put on the end of a line LISP-style. That way, code becomes as terse as with a python-like syntax, but auto-formatting still works and no changes in the languages are required.

Example:

fn main() {
    for _ in 0..4 {
        println!("hello world");}}

vs.

fn main() {
    for _ in 0..4 {
        println!("hello world");
    }
}

#42
fn main()                                  {
    for _ in 0..4                          {
        println!("hello world")            ;}}

it’s Python!


#43

XD

Thinking about it while not sleep deprived the idea looks a lot less good.


#44

-1 I don’t see must point in introducing meaningful indents. I’m okay with braces as long as we have ways to write concise code inside them. I think having meaningful indents and curly braces would be confusing for new users reading the tutorials. I think it would put certain people off too, like those with C++, C# and Java backgrounds who weren’t won over by Python or Ruby.


#45

Although I haven’t read all this thread, I do think it would be an interesting project to transpile a whitespace-sensitive dialect of Rust to ‘real Rust’ with full fidelity. Rust itself won’t do it though.


#46

This thread is no longer appropriate for internals. If you wish to continue discussion or coordinate project development, you should start a new thread on the user forum. I’d be interested in seeing how such a tool turns out!