Announcement

Collapse
No announcement yet.

Rust Support Is Being Worked On For The Linux Kernel's V4L2/Media Subsystem

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

  • #11
    Originally posted by ssokolow View Post
    1. The syntax you're complaining about is common in the world of functional languages, which is at at least as large as the world of languages with C-inspired syntax and, if you include the elements that were present in LISP has existed, predates C by a mile.

      You're essentially complaining that Polish isn't a Romance language when, if they'd chosen to use Cyrillic like other Slavic languages, rather than using the Latin alphabet, you would have taken for granted that it would be different.
    2. Many of those syntactic decisions have solid reasons. For example...
      • Using fn at the beginning and the return type at the end and putting types after parameter names is to simplify parsing by avoiding the need for the lexer hack. It's also very common in functional languages, either as fn, or fun, or func or function (which JavaScript borrowed), or defun (define function). (Types after parameter names, separated by a colon, is also how Wirth languages like Pascal do it.)
      • Syntactic collisions aside, |args| syntax for lambdas will be familiar to anyone who uses Ruby.
      • The postfix ! for macros is to denote that, unlike a function call, the macro call may contain control flow constructs like return which apply to the function that's calling it.


    There were actually studies done on computer programming languages syntax specifically and they do have an impact, and iirc C++ (which is where Rust borrowed its syntax from) was one of the worst when it came to visually parsing and reading the code.

    While I do love Rust, I have to say that its syntax is pretty terrible and the Rust dev's admitted that the reason Rust has its syntax (largely derived from C++) is they wanted to make it more familiar to C/C++ devs to try and win them over, not because its better.

    For me the language that has some of the nicest and also easy to follow syntax is Scala, its much more visually pleasing to the eye and also compact to read.
    Last edited by mdedetrich; 07 April 2023, 12:04 PM.

    Comment


    • #12
      Originally posted by ssokolow View Post
      [...] the world of functional languages, which is at at least as large as the world of languages with C-inspired syntax [...]
      Citation needed.
      That would be more than JavaScript, C, C++ and Java combined. I very much doubt that somehow.

      Comment


      • #13
        Originally posted by Sergey Podobry View Post
        I wish Rust had a better syntax. I know this is a matter of taste but the most popular languages share the same syntax: c, c++, java, javascript, c#. And Rust chose to be different with no reason.
        I'm not exactly a Rust fanboy (I'm more or less proficient in it, but it's not my fav language for day to day programming) but I find that the syntax is very pleasant.

        Comment


        • #14
          Originally posted by mdedetrich View Post

          There were actually studies done on computer programming languages syntax specifically and they do have an impact, and iirc C++ (which is where Rust borrowed its syntax from) was one of the worst when it came to visually parsing and reading the code.

          While I do love Rust, I have to say that its syntax is pretty terrible and the Rust dev's admitted that the reason Rust has its syntax (largely derived from C++) is they wanted to make it more familiar to C/C++ devs to try and win them over, not because its better.

          For me the language that has some of the nicest and also easy to follow syntax is Scala, its much more visually pleasing to the eye and also compact to read.
          On the other hand, people also complain that compiling Rust is slow. Can you imagine how much harder they would complain if Rust chased syntax that "nicest and also easy to follow", instead of something that's more parser friendly?
          Also, the C++ likeness wasn't arbitrary either. As a systems programming, it was expected the first programmers to do the jump would be those from the C/C++ camp.

          Bottomline, until ISO comes up with a standard that says "variable definitions must look like this, function declarations must look like this and lamdbas must look like that", languages will continue choosing from the available variants. Any choice will come with pros and cons and getting stuck on that will continue to be pointless.

          Comment


          • #15
            Originally posted by bug77 View Post

            On the other hand, people also complain that compiling Rust is slow. Can you imagine how much harder they would complain if Rust chased syntax that "nicest and also easy to follow", instead of something that's more parser friendly?
            Also, the C++ likeness wasn't arbitrary either. As a systems programming, it was expected the first programmers to do the jump would be those from the C/C++ camp.
            I don't think this is a fair example. Rust cannot do much about slow compile times, because the whole point of the language is that it is strongly typed that comes along with a type checker which aside from LLVM is the main reason behind large compiler times. If you want Rust to compile fast then its not going to be Rust anymore, instead you get something like Go.

            If we are talking purely about technicalities, nothing was stopping Rust from having a nicer syntax. It would still be Rust, just a slightly better one.

            Originally posted by bug77 View Post
            Bottomline, until ISO comes up with a standard that says "variable definitions must look like this, function declarations must look like this and lamdbas must look like that", languages will continue choosing from the available variants. Any choice will come with pros and cons and getting stuck on that will continue to be pointless.
            Of course, my point is that there was scientific studies done on what syntax is easier to read (and there is a lot of science on this because fundamentally you are reading a language) and Rust chose to copy the syntax of a language that arguably had one of the worst syntax's (thats still a mainstream language, i.e. brainfuck doesn't count).

            Comment


            • #16
              Originally posted by mdedetrich View Post
              I don't think this is a fair example. Rust cannot do much about slow compile times, because the whole point of the language is that it is strongly typed that comes along with a type checker which aside from LLVM is the main reason behind large compiler times. If you want Rust to compile fast then its not going to be Rust anymore, instead you get something like Go.

              If we are talking purely about technicalities, nothing was stopping Rust from having a nicer syntax. It would still be Rust, just a slightly better one.
              I don't disagree, but my point was: type checking + borrow checker + compiler/parser unfriendly syntax = even longer compile times.
              As a developer, I prefer longer compile times in exchange for better runtime behavior (as long as longer != you have time for a coffee while compiling a simple REST service). But it's just a preference of mine.

              Originally posted by mdedetrich View Post
              Of course, my point is that there was scientific studies done on what syntax is easier to read (and there is a lot of science on this because fundamentally you are reading a language) and Rust chose to copy the syntax of a language that arguably had one of the worst syntax's (thats still a mainstream language, i.e. brainfuck doesn't count).
              Well, as you have noted, the first language that has the balls to say "it's meant to be run, not read", not only has been with us for over half a century, but it still stands strong in its market. So perhaps syntax that's not easy on the eye isn't that bad after all?

              Comment


              • #17
                Any choice will come with pros and cons and getting stuck on that will continue to be pointless.
                Yep. And ... The day we are forced into an ISO implementation, is the day evolution of computer languages ceases and the decline begins. Rust is just another wanna-be language thrown against the wall to see if it 'sticks' so to speak. It is not the end all. Like any language over time it will overtaken by something else.... Academia will see to that . Meanwhile the rest of us will just continue to churn out solutions to problems with the language of our 'choice'.... Assembly, Python, C, C++, c#, JavaScript, Java, and yes, even Rust depending on needs and experience of personnel.

                Comment


                • #18
                  Originally posted by bug77 View Post
                  Well, as you have noted, the first language that has the balls to say "it's meant to be run, not read", not only has been with us for over half a century, but it still stands strong in its market. So perhaps syntax that's not easy on the eye isn't that bad after all?
                  Well you can also far more time is spent reading code than running/writing it (as a software developer). I would agree its on the top of the list when it comes to priorities but we should call a spade a spade.

                  Comment


                  • #19
                    Originally posted by schmidtbag View Post
                    If a language is too syntactically similar to others, then what's even the point of making it? Sure, Rust has some inherent benefits with security and threading, but sometimes there's just a better way of doing things. Some spoken languages have some inherent benefits over others, to the point that it can reshape the way you interpret things.
                    Exactly because of that. Security is a very big reason in a kernel, drivers and generally software why Rust sees adoption. Syntax is just that, syntax. A language is just a tool, just as in real life languages. You use the best tool for the job. In Spain or south America you would probably use the tool of speaking Spanish. In North America probably some sort of English.

                    In Software it's the same. Familiar syntax does not say similar features. While you probably want something like rust for memory safety, good performance and being a system language is something you require.

                    Something you wouldn't write in Go or Python. Or Java. Or C#. Or any other language, since for system programming there are only a few viable options, since it has different needs than developing a web application, API or phone app.

                    So being synthetically close has nothing to do at all with the features of the languages or why you use it. I wouldn't use Rust on small projects where I do not require the language features or performance, I still often opt for other languages since the implementation overhead and complexity (which rust has, at least for me still) does not require Rust, and are implemented easier, faster and well enough in other languages.
                    Last edited by STiAT; 07 April 2023, 06:45 PM.

                    Comment


                    • #20
                      Originally posted by Sergey Podobry View Post
                      I wish Rust had a better syntax. I know this is a matter of taste but the most popular languages share the same syntax: c, c++, java, javascript, c#. And Rust chose to be different with no reason.
                      Yeah I agree, I can't stand the type after the variable name. It make it unreadable.
                      I wish Rust was more a like safer & modernized & purified best of C/C++ to be a true C/C++ 2.0.

                      Comment

                      Working...
                      X