Announcement

Collapse
No announcement yet.

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

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

  • #51
    Originally posted by Electric-Gecko View Post
    I have not attempted either C or Haskell. I have barely any programming skills, and I have barely managed to add anything to C++ projects.
    I found at some point a nice way to learn basics of a new language: just solve a couple of tasks from Google Codejam. They're small, and cover the basics, like reading from/to a file, parsing; and if you're a beginner you'd need to print statements, debug the code a bit.

    Originally posted by Electric-Gecko View Post
    So tell me, does Haskell have everything it needs to replace C for systems programming, particularly the examples of Wayland and Linux kernel we're discussing? Does it have any serious issues compared to C (in systems programming), or is it just the inertia of people to switch over (like the inertia of regular computer users to switch from Windows to Linux)? Is Haskell fundamentally harder to program in than C?
    It does have a problem with regard to systems programming, it's called garbage-collector.

    That said, Haskell is a language worth knowing even if you're not intending to ever use it. If your coding skills are in stage where you can embody simple algorithms in code, but struggle to architect apps the right way, e.g. your code is full of global variables, awkward error handling, race conditions, and you struggle to see the time to break a function — it's time to learn some Haskell. The language forces you into better design, it teaches you some generic style that you can later apply in any language.

    For example, from just C/C++ background, function pointers was always looking like odd beasts to me, I'd hardly ever use them, except as if the algorithm jumped at me screaming "use a function pointer FFS!" (well, it was 2-3 years ago, I didn't know about C++14 closures back then). But in Haskell they're as natural as they can be, so after you get back from Haskell to C/C++, you'd just start seeing patterns where function pointer can make your life much easier. (that said, back then I didn't even hear about Haskell, and learned the same thing from elisp, but both langs treating functions in alike manner, so it doesn't really matter)

    Comment


    • #52
      Originally posted by Electric-Gecko View Post
      I have not attempted either C or Haskell. I have barely any programming skills, and I have barely managed to add anything to C++ projects.

      So tell me, does Haskell have everything it needs to replace C for systems programming, particularly the examples of Wayland and Linux kernel we're discussing? Does it have any serious issues compared to C (in systems programming), or is it just the inertia of people to switch over (like the inertia of regular computer users to switch from Windows to Linux)? Is Haskell fundamentally harder to program in than C?
      Haskell is a different paradigm which people are familiar with.
      Most programmers are familiar with imperative object-oriented languages. Haskell is functional programming, so it is different.

      Originally posted by Electric-Gecko View Post
      I do agree that there are some projects that would be worth changing to a different language, but don't rewrite C as C++. C++ is also problematic, and should actually be replaced by better newer languages. Please don't treat C++ as the modern way which everything should switch to.
      Also, C is more compatible. D is fully compatible with C, but not compatible with all C++ projects. I'm not an expert, so I don't really understand how it works. I read that OGRE is not compatible with D because it uses multiple inheritance (which D does not support). But then, doesn't Qt use multiple inheritance? Qt is also C++, but has bindings for D.

      D was actually written as an alternate continuation of C rather than a continuation of C++. It's goal is to better implement the functionality of C++.

      I think there are some C++ projects worth rewriting in D. It would be easier for newbies like me to contribute, but also make development faster in general.
      D have existed for a long time but failed to get any traction.
      Instead there is Rust which is the new cool kid on the block.

      Is D less relevant nowadays with C11?
      Is there any successor to C11?

      Comment

      Working...
      X