Announcement

Collapse
No announcement yet.

April Fools' Or Should Wayland Switch Away From Using C?

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

  • #11
    Originally posted by Xorg View Post
    Ha ha. What if I told you my favorite language is ASM? I'm joking, I prefer C.

    A skilled C developer runs his program with Valgrind, and admires absence of errors and memory leaks.
    Heartbleed was also caused by a "skilled c developer".

    cipri

    Comment


    • #12
      All Haskell programs are bug-free because nobody ever runs them.

      Comment


      • #13
        Originally posted by cipri View Post

        Heartbleed was also caused by a "skilled c developer".

        cipri
        LLVM's LibFuzzer can detect Heartbleed in under 1 second.

        Comment


        • #14
          Haskell is a good way to alienate developers. It is rarely used outside academia. Most programmers are not familiar with it.

          Comment


          • #15
            Originally posted by cipri View Post
            This is like I do my c++17 gui framework. The wayland part I hide in a "unsafe class". It's very sad, that wayland is forcing me to use "reinterpet_cast", which is something like a little time-bomb. At least I found a way to put the unsafe stuff more tightly together instead of spreading it all over the framework.
            It means if something goes wrong (likes leaks and crashes) it will be because of the framework, and not because of the user of the framework.
            With c++ you can have the same speed (or faster!) and having at the same time more safety.

            The c example of wayland clients/servers could look in c++ easier to follow with less code, better structured....
            There is a good reason why you barely find applications based on wayland directly! Gnome and KDE are working since years on wayland support and it's still not ready. If lib-wayland would be done with c++14 and being well designed, writing wayland clients would be a triviality! It would be easier than using QT [since QT has old style c++ api].

            cipri
            Age old false problem.

            Write X using a higher level programming language, people will complain it's not flexible and interoperable enough. Write X using a lower level programming language, people will complain of the learning curve and the effort it takes to develop for it.

            And here comes the shocking newsflash: this is what engineering is all about, trying to come up with a solution that will please a sufficient number of people, knowing fully well you can't please everybody no matter what. If there was a way to reliably order the quality of solutions, an algorithm would have been made by now to do it, rendering most engineers jobless.

            And even shorter: there's no "best" solution. There's a best solution within some given constraints. When the constraints change, so does the solution. (now let's see debianxfce wrap his head around that)

            Comment


            • #16
              Originally posted by bug77 View Post

              Age old false problem.

              Write X using a higher level programming language, people will complain it's not flexible and interoperable enough. Write X using a lower level programming language, people will complain of the learning curve and the effort it takes to develop for it.

              And here comes the shocking newsflash: this is what engineering is all about, trying to come up with a solution that will please a sufficient number of people, knowing fully well you can't please everybody no matter what. If there was a way to reliably order the quality of solutions, an algorithm would have been made by now to do it, rendering most engineers jobless.

              And even shorter: there's no "best" solution. There's a best solution within some given constraints. When the constraints change, so does the solution. (now let's see debianxfce wrap his head around that)
              Using SWIG, Cython etc. one can write bindings for many languages on top of C++.

              Comment


              • #17
                If they really want to make Wayland perfect they should just copy and paste all of the X.org code.

                Comment


                • #18
                  Originally posted by bug77 View Post

                  Age old false problem.

                  Write X using a higher level programming language, people will complain it's not flexible and interoperable enough. Write X using a lower level programming language, people will complain of the learning curve and the effort it takes to develop for it.

                  And here comes the shocking newsflash: this is what engineering is all about, trying to come up with a solution that will please a sufficient number of people, knowing fully well you can't please everybody no matter what. If there was a way to reliably order the quality of solutions, an algorithm would have been made by now to do it, rendering most engineers jobless.

                  And even shorter: there's no "best" solution. There's a best solution within some given constraints. When the constraints change, so does the solution. (now let's see debianxfce wrap his head around that)
                  This is clear to me that this was "one" of the (pseudo-) reasons why c was chosen, but I think the real/main reason was that the "wayland" developers grew up with c ! There is so much software in the unix world that is written in c that should have been written with c++ from the beginning. As far as I understand mir is based on c++ [I didn't check it closer since I don't like their license].
                  Check how many microcontrollers are written in c, and how horrible the code looks.
                  I have written a framework in c++14, that let's me write beautiful code that is very short (compared to c code), very expressive, easy to maintain.
                  Why nearly all use c? I guess because they were (like me) teached like this [and then these guys are also writing tutorials also in c, and the new generation is also used to write c code. It take some thinking to notice: why, c++ works in that case even better, I have code generation at compile time, I can use constexpr to have also evaluation at compile time - means, I can getter faster code than with c, etc...... Imagine also the benefits of c++17.....

                  I would like to see that the linux world starts to rewrite old code - so that we can build on safer libraries. Let's stop with c, and use it just in very specific places. You even don't need c for writing the kernel: check out for example this: http://okmij.org/ftp/cpp-digest/toy_OS.txt

                  cipri

                  Comment


                  • #19
                    Originally posted by Xorg View Post
                    Ha ha. What if I told you my favorite language is ASM? I'm joking, I prefer C.

                    A skilled C developer runs his program with Valgrind, and admires absence of errors and memory leaks.
                    Like how they caught that that OpenSSL hole?

                    Comment


                    • #20
                      Oh no, definitely no rewriting. I want to be still alive when Wayland becomes mainstream and experience what it brings to the end users. Software devs and hardware vendors claim it will make things for Linux a lot more awesome.

                      Comment

                      Working...
                      X