Community
    • Login

    C Language vs Rust

    Scheduled Pinned Locked Moved General Discussion
    13 Posts 8 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Murray Sobol 1M
      Murray Sobol 1
      last edited by

      This is (probably) a message for Don Ho.
      Have you given any consideration to moving Notepad++ to Rust programming language?
      Rust appears to have much better memory management and reuse capabilities.
      C and C++ (and probably several other languages) rely on the programmer to use “garbage collection” to "“clean up things”. However, this can be problematic in determining how often and when to do this.
      Just some thoughts…

      PeterJonesP gstaviG 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Murray Sobol 1
        last edited by

        @Murray-Sobol-1 ,

        I highly doubt it would ever happen: Rewriting it in a new language is essentially creating a brand new application, and doesn’t seem to be what Don has indicated his interests are in. (And honestly, I doubt the most difficult technical challenges in Notepad++ are the memory management/garbage collection. So doing an entire rewrite just for the sake of fixing something that ain’t broken seems unnecessary, at best.)

        I would personally prefer he continue to spend his time on adding new features and fixing/improving old ones, rather than rewriting everything.

        1 Reply Last reply Reply Quote 2
        • Alan KilbornA
          Alan Kilborn
          last edited by

          Yea, let’s just toss two decades of software development and maintenance in the garbage heap, makes sense. :-(

          Murray Sobol 1M 1 Reply Last reply Reply Quote 0
          • Murray Sobol 1M
            Murray Sobol 1 @Alan Kilborn
            last edited by

            @Alan-Kilborn Obviously, Alan, you are NOT open to new ideas / improvements in new programming languages. We all know the limitations of C and c-based programming languages.
            My suggestion would be to incorporate the Rust language in the development of drivers, etc as a first and learning step.

            PeterJonesP Alan KilbornA EkopalypseE 3 Replies Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @Murray Sobol 1
              last edited by PeterJones

              @Murray-Sobol-1 said in C Language vs Rust:

              @Alan-Kilborn Obviously, Alan, you are NOT open to new ideas / improvements in new programming languages.

              Rewriting an application from scratch is a huge investment in time and resources. Rewriting an open-source application from scratch, when the main developer has no good reason to do so is something that’s not likely to happen. (Notepad++ is volunteer, unpaid development. The author himself only works on it in his spare time, as he has a full-time day-job to pay his bills.)

              And, btw, Alan is just a fellow user, like you and like me. So he’s not the one you need to convince. (And the way you argue, I cannot imaging that your techniques would convince Don to invest that time.)

              We all know the limitations of C and c-based programming languages.

              Though not all of us agree that a limitation of a language is enough to justify throwing away the existing codebase and starting over from scratch – especially when the aspects of the application that would use that “limited” portion of the source language are working as designed.

              My suggestion would be to incorporate the Rust language in the development of drivers, etc as a first and learning step.

              What “drivers, etc” do you think are part of Notepad++?

              1 Reply Last reply Reply Quote 3
              • Alan KilbornA
                Alan Kilborn @Murray Sobol 1
                last edited by

                @Murray-Sobol-1 said in C Language vs Rust:

                My suggestion would be to incorporate the Rust language in the development of drivers, etc as a first and learning step

                Oh, sorry, I didn’t know you meant such new development; perhaps you should have mentioned that in the first posting, for the utmost in clarity.

                I guess if you reread your original post, you’ll see how silly it sounds without that qualification.

                In light of the new information, I suppose that yes, it would be interesting to see some newer technologies show up in Notepad++ sources.

                1 Reply Last reply Reply Quote 0
                • gstaviG
                  gstavi @Murray Sobol 1
                  last edited by

                  @Murray-Sobol-1
                  C developers free memory as soon as it is no longer needed. “Garbage collection” is a completely different thing.

                  Rust does not have better memory management. Rust helps (careless) developers to avoid mistakes. It comes with a price of less flexibility. Notably the inability to form linked list which is the bread and butter of C programming.

                  Rust claim to fame is reducing the bug rate in very large projects. Much of it is for large groups of developers where rust helps in catching bugs a developer added due to misunderstanding other developers assumptions.

                  This advantage is very minor to Notepad++ which is a mature project with relatively low amount of development and very few developers.

                  I do wonder how many experienced C/C++ developers switched to rust and like it. I am mainly a C developer, not C++ so I don’t use STL, I use raw pointers ALL THE TIME. I started reading rust documentation. It is quite impressive but not using pointers freely feels like working with my hands tied.

                  Murray Sobol 1M 1 Reply Last reply Reply Quote 5
                  • EkopalypseE
                    Ekopalypse @Murray Sobol 1
                    last edited by

                    @Murray-Sobol-1

                    … furthermore Rust and C++ code cannot simply be mixed, the effort to do this is … considerable.
                    But if it is about plugins, then this can be done already today … but here one must work with unsafe code permamently,
                    if interactions with Npp or Scintilla are desired. So whether this helps to write safe code I don’t know.

                    I have been experimenting with several “modern” languages lately, Nim and V (garbage collected), Odin, Zig and Rust.
                    All have some appeal, but each require glue code to be written in order to use it to write a plugin for Npp.
                    It seems to be a certain challenge for programming languages to create a DLL and interact with the Windows API.

                    A few impressions

                    8d230a5a-9279-42ea-9809-ac11cfb50830-image.png

                    dd8866ca-e0d6-4aaa-a5a0-3d215bd1c17e-image.png

                    Please note that these are not truly idiomatic code, as I have learned just enough for each of these languages to make the plugins work.

                    1 Reply Last reply Reply Quote 4
                    • Murray Sobol 1M
                      Murray Sobol 1 @gstavi
                      last edited by

                      @gstavi said in C Language vs Rust:

                      C developers free memory as soon as it is no longer needed

                      HaHaHa:
                      One of the most common mistakes made in c (or C++) is exactly this: the Failure to free memory when not used.

                      datatraveller1D Lycan ThropeL gstaviG 3 Replies Last reply Reply Quote -1
                      • datatraveller1D
                        datatraveller1 @Murray Sobol 1
                        last edited by datatraveller1

                        @Murray-Sobol-1 I doubt Rust is well suited for creating Windows desktop applications. The Notepad++ GUI is perfect and cannot be done better in Rust, probably only worse. And even if Rust was that great, there would be no need to completely rewrite an absolutely properly working application.

                        1 Reply Last reply Reply Quote 0
                        • Lycan ThropeL
                          Lycan Thrope @Murray Sobol 1
                          last edited by

                          @Murray-Sobol-1 ,
                          Then you have just made the case for C, since it is not the language’s fault, but the faulty operator’s (programmer’s) fault.
                          :)
                          People in general don’t clean up after themselves, why should their programming be any different. It takes discipline, not seat of the pants programming they like to call rapid development. Better to learn it right and get faster, than to get it done faster and spend forever cleaning it up.

                          1 Reply Last reply Reply Quote 1
                          • gstaviG
                            gstavi @Murray Sobol 1
                            last edited by

                            @Murray-Sobol-1 said in C Language vs Rust:

                            HaHaHa:
                            One of the most common mistakes made in c (or C++) is exactly this: the Failure to free memory when not used.

                            HaHaHa,
                            One of the main reasons why you shouldn’t convert Java (or Rust) developers to C.
                            But 1st grade developers who learned C as their first programming language don’t do this mistake.

                            Surprisingly, both Linux and Windows kernels are written in C and they manage to free unneeded memory.

                            1 Reply Last reply Reply Quote 4
                            • Jaguar AsadJ
                              Jaguar Asad
                              last edited by

                              Truly agree rust is really a far better language

                              1 Reply Last reply Reply Quote 0
                              • rdipardoR rdipardo referenced this topic on
                              • First post
                                Last post
                              The Community of users of the Notepad++ text editor.
                              Powered by NodeBB | Contributors