On Tue, Sep 11, 2012 at 6:37 AM, Gareth Smith
<garethdanielsm...@gmail.com> wrote:
> Hi James,
>
> The pattern matching syntax is pretty consistent with Haskell, Ocaml, SML
> and similar-ish statically typed functional languages. I like it because it
> is concise and because a pattern is syntactically identical or at least
> similar to the the value literals that produce the types that it matches.

Hi Gareth,

Thanks for your reply.

I understand that a lot of Rust is strongly influenced by Haskell and
OCaml (which, speaking as someone who has often felt guilty that he's
never been able to give these languages the attention they deserve,
I'm very happy about  :)  ).

If these parts of the syntax were stumbling blocks to me (a C-family
programmer with some, but not a lot, of non-C-family familiarity),
it seems likely to me that they will be stumbling blocks to others in
the same situation.

It's also very interesting to me that you specifically like the syntax
because it's very similar to the value literals.

Part of my reasoning for inserting a keyword is precisely because I
think the syntax is *too* similar.  Firstly, when I'm expecting
(at least, naively) just to match literals, there's now this implicit,
completely un-marked binding of variables -- unexpected behaviour.
The "let" keyword both describes the behaviour and makes it stand out.

Further, as the previous mailing list thread on this topic discussed,
this has the potential to clash with enum identifiers which are being
used in place of literals.

Finally, in the struct destructuring examples in particular, the
minimal and very unobtrusive syntax made it difficult for me to
determine (without some significant attention and deduction) what was
a new binding and what was a field name.

So in fact, I'm proposing the syntax changes for reasons that directly
counter your reasons for liking the current syntax.  Sorry...  :)

jb
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to