Announcement

Collapse
No announcement yet.

Mozilla's Servo Still On Track For 2015 Alpha Release

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    Originally posted by bitman View Post
    Readability os one thing that weirds me out on rust too. As if designers said "Code readability? We dont need no stinkin readablity! \o/ We are geeks and like it dirty!". Seriously this front was explored a lot already by lots of other languages but they decided to just ignore it. I suspect it will be biting them in the ass in the long run. Maybe bites wont be as big to notice immediately but programmers can cope with nicely looking code much better/faster.
    Personally I really like Rust's syntax and find it a lot nicer to read and write than C and C++, or even Java and sometimes C#. The developers have actually paid a lot of attention to readability, so it's a lot better than it was once.

    Some things I like about it:
    - declarations always have a keyword right before the name, rather than a type, so grep/ctrl+f work way better
    - full type inference within functions, not just Go's or C++11's where it looks only at the initializer
    - expression based syntax, so there is a lot less noise from "return" or extra variable assignment. even {} blocks are expressions
    - pattern matching in function arguments, let bindings, if/while conditions, and switch statements
    - not entirely syntactical, but variables are immutable by default, which encourages code that is much simpler to read

    Some of these might be relatively new features to someone coming from other mainstream languages, so it might take a bit of getting used to before it's easy to read, but once you're there it's quite nice.

    Comment


    • #12
      Originally posted by balouba View Post
      It turns out, however, that most Go programmers are Python programmers.
      I didn't know that, but it kinda makes sense when you look at the new typing hinting proposal for Python.
      It looks like it borrows syntax from Go.

      Comment


      • #13
        Originally posted by codensity View Post
        I don't like or dislike Rust's syntax so I'm curious what folks in this thread dislike about it. Are there some specific parts that would be better changed? It clearly has a strong ml feel to it but I'd (maybe unjustly) assumed imperative programmers would be partial to its C-esque bracyness.
        In general I am a big fan of minimalism. Have a small orthogonal set of symbols, implement fancy stuff as libraries.

        One thing I found really bad was the "pointer" type zoo, which has been fortunately addressed by moving garbage collection into std lib.


        Some nitpicks (feel free to disagree ):

        From pure readability pov, I find using _, |, ! symbols not so optimal. Yes, the last two are used in boolean logic and that is fine. It gets weird when they are used in other places.

        Operators (traits) seem to be different from functions. To implement operator+ you have to iplement the trait Add etc.

        Then there is the -> used for function return types. The mathematicians might rejoice. But from consistency pov, you already have the colon for type designation why not using it for the return type.


        This does not mean that I don't like the language. There is some really cool stuff in there: ownership semantic, type inference, traits, generics.

        A syntax is something one gets used to very quick, at least from my experience.

        Comment


        • #14
          Originally posted by oleid View Post

          There is a (toy) kernel written in rust and somebody even used it for micro controllers.


          This goes a bit into detail about how Rust performs as a systems language.

          Comment


          • #15
            Originally posted by Delgarde View Post
            But it's not intended to compete with languages like C#... doesn't include garbage collection
            Actually, you can do garbage collection in rust, if you want to. You can box any type.

            Originally posted by Delgarde View Post
            doesn't do full OO
            True, the traits are a different, but quite interesting Ansatz.

            Originally posted by Delgarde View Post
            doesn't provide comprehensive APIs for everything the user could ever want to do (although the standard library is pretty good, heavily inspired by higher-level languages instead of the likes of POSIX)
            That's why crates are for: https://crates.io/crates
            You'll find *a lot* of stuff there.

            Comment

            Working...
            X