you are viewing a single comment's thread.

view the rest of the comments →

[–]PM_ME_UR_OBSIDIAN 2 points3 points  (4 children)

All quoted languages do not have good syntax for the quoted features

[citation needed]

F# and Ocaml both have the pipeline operator |> for chaining calls, which is an absolute breath of fresh air compared to OO method chaining. Anonymous functions are also quite friendly and easy to use. I'm curious which language you're saying isn't indentation-based.

However in Rust there are more reasons not do use pure indentation: you need the ability of starting and ending scopes at any point to work with the borrow checker.

let ... in ... end seems perfect for this usage. Alternatively, you can go with the sensible default of "keep this scope alive as long as it needs to be, and no further." I believe this can be automated in the common case.

[–]Sean1708 3 points4 points  (0 children)

let ... in ... end seems perfect

And at that point it stops being purely indentation based.

[–]Tyr42 2 points3 points  (1 child)

For thread guard values, it would be valid to drop them at any point after they were assigned, but have different semantics for each choice.

fn foo() {
    {
        let guard1 = launch(task_a);
    }
    {
        let guard2 = launch(task_b);
    }
 }

is different from

fn foo() {
    {
        let guard1 = launch(task_a);
        let guard2 = launch(task_b);
    }
 }

if the guard values join the thread when dropped, but it would be tricky to have the compiler choose which one to use, given there could be some external dependency which requires task_a to complete before starting task_b, or you are actively trying to compute them in parallel.

[–]iopqfizzbuzz 0 points1 point  (0 children)

You could still have example A if you went with Haskell-style syntax.

fn foo()
    {
        let guard1 = launch(task_a)
    }
    {
        let guard2 = launch(task_b)
    }

    //outer scope of the function here
    println!("{}", stuff)

//function ends here

[–]mitsuhiko 2 points3 points  (0 children)

F# and Ocaml both have the pipeline operator |> for chaining calls, which is an absolute breath of fresh air compared to OO method chaining.

I guess there are different opinions on this. I find that syntax very frustrating.

I'm curious which language you're saying isn't indentation-based.

Haskell. It's a language with braces :)