1. 58
  1.  

  2. 15

    People like to categorize things. People also like better things or newer things. That being said, I have to agree with a few of the replies on Quora. It will be hard to replace a language that has persisted decades and will continue to.

    In my opinion these languages were created for specific reasons. Rust has Mozilla and Go has Google. They wanted languages that would be safer or quicker to develop in. Go has an awesome networking library and Rust has guaranteed thread safety. All these new ideas are great and will help make software better in the future.

    1. 13

      I think that, once it becomes Open Source, Swift could easily be a contender for this list:

      • Huge adoption in a little over a year of existence
      • Lots of memory safety guarantees by a strong, LLVM-backed compiler
      • Near-C++/C performance
      • Very mature and well-implemented C (and Objective-C) interop
      • Automatic Reference Counting
      1. 18

        I think if Apple were serious about making Swift open source they’d have done it already. They’ve broken these kind of promises before (Facetime protocol). We should treat it as a proprietary language unless and until it gets an actual OS release.

        1. 8

          There was an issue with patent encumbrance that prevented Apple from going ahead with their original plans for FaceTime. The last few Swift releases have focused on interop with relatively obscure C features that Cocoa/iOS developers almost never use, which I take as (admittedly circumstantial) evidence that they are indeed serious about making it work on other platforms such as Linux.

          1. 3

            As a note, Apple (Chris Lattner really) said the end of the year for open source swift.

            https://twitter.com/clattner_llvm/status/641697365003341824

            So while you’re right, you’re also premature in the assumption they would have done it already. We don’t know their timelines or schedules outside of that twitter post. Even then, things could slip.

            1. 2

              They took their time with Webkit. I just hope with Swift they don’t dump a massive intractable hairball like the initial Webkit release which caused much animosity between the KHTML community. Let’s hope this time they do a better job.

            2. 11

              The problem of Swift is its master, as it was with Objective-C. While using Swift outside of the Apple ecosystem might become feasible, much example code still assumes Cocoa as some kind of de-facto stdlib, which is not going to be open sourced.

              1. 2

                I think this issue is surmountable. Much of the Swift sample code that exists is code for writing applications with GUIs that run on OS X or iOS devices. Swift applications on non-Apple platforms would either be non-GUI based (command line tools, web services) or GUI applications with bindings to non-Cocoa widget toolkits. In that case the lowest common denominator is the Foundation framework, a significant part of which is subsumed by the Swift standard library; the functionality that’s missing could be reasonably satisfied by an open-source replacement. (If nothing else, OpenStep’s Foundation implementation exists.)

                1. 2

                  Have you ever tried to work with OpenStep and Foundation side by side?

                  I admit I did it years ago, but it was the most horrible experience ever (beginning with the fact that OpenStep’s foundation did not build properly on OS X, which made side-by-side testing hard).

                  Still, having Foundation under control by a party that might do whatever they want with it is a mayor issue. Surmountable, but an issue.

                  1. 1

                    I agree with you. Swift’s best hope for widespread adoption outside its original iOS/OS X application development use case probably hinges on the creation of a parallel community writing software that isn’t tied to Foundation, Apple open-sourcing some subset of Foundation (apart from what CF provides), or some combination of the two. I am definitely interested in seeing how much of an adverse effect Cocoa/Foundation dependence proves to be in the future, though.

                  2. 2

                    Cocotron also has an implementation of Foundation (along with many other Apple APIs). I’m not sure how well it works with Swift, since it’s implemented in ObjC.

                    1. 1

                      Cocotron also has an implementation of Foundation (along with many other Apple APIs). I’m not sure how well it works with Swift, since it’s implemented in ObjC.

                      Well, Swift <-> ObjC is not an issue.

                      1. 1

                        Okay. :) I don’t currently have a Mac to develop on, so I wasn’t sure.

              2. 13

                An interesting comparison of the languages, but to be honest, I’ve never understood why Go gets called a systems programming language, always seems more like a better java to me. (And D seems like a better c++)

                1. 14

                  The post seems to address that. Originally it was supposed to be a better C, before it found its niche as a network applications language. However the original purpose stuck in people’s minds, despite it now being false.

                  After a brief period in which Go claimed to be a systems programming language, it has fully committed to the niche of networking services.

                  1. 1

                    Maybe I should of phrased it as: why are people still often calling go a systems programming language

                    1. 17

                      Hmm. So last month I wrote a DNS proxy. I used C because I needed a serious systems language because DNS proxies are something something overhead performance metal optimization. You know, right?

                      But the truth is I used C because developing for OpenBSD that’s kind of the only choice. Go would have been a fine choice.

                      It’s curious that I only “needed” a systems language when I used one, but if I’d selected a different language my requirements would have adapted.

                      Perhaps an even better rephrasing is: why do people still call any random thing done in C systems programming?

                      (I’m all over this thread, because I find the topic interesting and I actually do quite a bit of kernel development, but my thoughts on “system language” are best described as “strong opinions, weakly held”. :) I don’t think anybody’s wrong; I just like the discussion. ???)

                      1. 11

                        Because C has absolutely no memory safety, it feels harder to write (even though it’s incidental difficulty rather than essential difficulty), so there’s a strong temptation to regard that as a virtue, especially if one has spent time learning it. :)

                        1. 2

                          Just wondering, how do you test your C program?

                          I wrote dns-based service discovery a few weeks ago. Like you said for performance reason, C is the best tool for this. But I need to write a test before any implementation, I found that there is no “standart way” to test C program. Even k&r book is not mentioning how to test C program.

                          So I use Go instead of C. Go testing standart library is pretty neat. Also, the performance of Go 1.5 was not disappointed for my organization scale (~68nodes).

                          1. 7

                            I run it. :)

                            1. 5

                              When it’s reasonable to do so, I use a simple strategy I first noticed in some FreeBSD code. Add an #ifdef TEST at the end of a .c file and define a main function that tests the functions. Along with being incredibly simple and requiring no additional libraries, this lets you test static functions as well. Writing some makefile rules to support this isn’t bad either. Trivial example:

                              int add(int n1, int n2) {
                                  return n1 + n2;
                              }
                              
                              #ifdef TEST
                              #include <assert.h>
                              
                              int main() {
                                  assert(add(5, 8) == 13);
                              
                                  return 0;
                              }
                              
                              #endif /* TEST */
                              
                              1. 4

                                Throwing my suggestion on the pile, I really like Armin Ronacher’s thoughts on writing and testing native libraries.

                                In my case I am using Python to test my libraries. More to the point: I’m using py.test and CFFI to test my library. This has a couple of big advantages over directly doing it in C/C++.

                                The biggest advantage is the increased iteration speed. I do not have to compile my tests at all, they just run. Not only does the compilation step fall away, I can also take advantage of Python’s dynamic typing and py.test’s good assert statement. I write myself helpers to print out information and to convert data between my library and Python and I get all the benefit of good error reporting.

                                1. 1

                                  For a personal project that’s using C, I wrote a minimal testing framework alongside it, that gives me the unit-testing features I’m accustomed to from more modern languages. :)

                                  This is definitely a major drawback to the language.

                                  1. 1

                                    You could use a library that implements the https://en.wikipedia.org/wiki/Test_Anything_Protocol just Perl’s Test::Harness to interpret the result. I wrote about exactly that a few years ago. There’s an example use here, from a toy project I wrote at uni. (I wouldn’t have high hopes of the package-framework build system still working, but the project is simple enough that you probably don’t need to build it to make sense of it.)

                                  2. 1

                                    this is the sort of thing i really wish mythryl had caught on for.

                                    1. 1

                                      Possibly a dumb question, but why not include more compilers in the base system?

                                      1. 2

                                        The long and short of it is http://www.openbsd.org/plat.html

                                      2. 1

                                        It’s your choice, but I’m sure it could be written with less code in sensible C++ for a 0-5% overhead vs C. Depending on how many lines it is of course and sensible C++ can be safer as well.

                                        1. 1

                                          By any chance have you open-sourced the DNS proxy, i just created a folder locally to begin writing that only :)

                                          1. 7

                                            It’s in OpenBSD as rebound.

                                            1. 1

                                              Haha! Love the name. :)

                                        2. 6

                                          Because it was initially marketed like that. People still think Rust and Go are direct competitors because they were very similar ~4 years ago. Not a lot you can do :(.

                                      3. 12

                                        What does “systems” even refer to? Distributed systems can be made in any language that supports, say, sockets (loose definition, and the system could of course communicate over pipes only, but….).

                                        Another classification that I’ve seen is “can it use the services provided by the kernel, e.g., system calls?” But of course most languages provide wrappers around syscalls and don’t expose them directly. So based on this, they, too, could be systems languages.

                                        The term “systems programming” is as ambiguous, as “strong” vs “weak” typing. The terms have basically become meaningless due to loose usage, and no strict definition.

                                        1. 1

                                          That’s the best thing anyone has said on this thread.

                                          1. 1

                                            Thanks.

                                        2. 4

                                          The real test for systems programming is “could you write a kernel in it”.

                                          1. 11

                                            People say this, but I think it’s a rather limited view. The majority of code running on your system will not be the kernel. “Could you write a system service in it?” seems like the more relevant question. There can be debate about what counts as a system service, but I’ll note that there’s no reason why btrfs or zfs couldn’t be written in Go. There’s very little kernel code that can’t be written in straightforward go.

                                            1. 3

                                              Filesystems have been written in Python, so I don’t think that’s the distinction people are trying to capture. GC versus not is a pretty clear distinction that I think does capture something meaningful. More fundamentally, if C, D and Rust are in box A, and Java and OCaml in box B, I think Go feels closer to box B.

                                              1. 10

                                                I’ll note that the average unix like kernel in C contains a great many adhoc garbage collectors. Mostly ref counting, which you can count or not, but there’s also some more full blown collectors for things like file descriptors that get stuck being passed between processes.

                                                No disagreement about box A vs box B, though I’ve wondered why so many people care (and so much!). In terms of boxes, my point was really that very little software needs the tools in box A. We should (imo) distinguish between “software that can only be built with tools A” and “software that is currently typically built with tools A”.

                                                1. 4

                                                  Right - I think really what the presence of GC is a proxy for is whether the language is useful in environments that can’t use the runtime library it ships with.

                                                  1. 7

                                                    System language bingo: GC. Runtime. Overhead. Abstraction. Bare metal.

                                                    1. 1

                                                      Oh, agreed. :) (But I didn’t say overhead or bare metal, and I won’t. I don’t like those criteria. :))

                                                  2. 5

                                                    I care because I see people making bad decisions as a result. “We needed the performance of a systems language, so Java was out… we picked go”.

                                                2. 2

                                                  It’s also pretty misleading. If the rule is “could you write a kernel in it”, then Lisp, Oberon, and C# (the last via Singularity) would count as systems languages, while I don’t think people talking about systems languages would normally trudge those three out. I like your rephrase a lot better.

                                                  1. 9

                                                    There was an entire commercial operating system written in Lisp - kernel, daemons, GUI. The only reason it doesn’t feel like a systems language today is that it isn’t popular enough. Which is for a mix of reasons, none of which are “wrong”.

                                                    But I like tedu’s framing better, anyway. That’s an excellent point, that services are what most of us spend more time dealing with. I tend to think most services are smaller codebases than most kernels, but “majority of code” isn’t quite the right metric; it’s majority of mind-share.

                                                    There is a web server written in Java, and yet I don’t personally feel comfortable calling it a systems language… somebody convince me it either is or isn’t?

                                                    1. 1

                                                      Is the java webserver net facing? There are web servers in python and ruby, too, but they’re usually fronted by something like nginx. I think this nicely illustrates the partition between “application” and “system” even if one can point to an infinite number of exceptions.

                                                      1. 5

                                                        Tomcat is meant to be, yes. There’s a list of sites using it: http://wiki.apache.org/tomcat/PoweredBy

                                                        I agree that minor exceptions aren’t the point. Do I take it it’s your opinion that Java isn’t a systems language, and that this one service is irrelevant to that discussion? Having had a couple hours to chew on it now, I think that’s reasonable.

                                                        1. 4

                                                          In the open source world* you shouldn’t terminate TLS with a Java web server, so don’t use them as net facing servers. The best setup is nginx in front of Java, with a keep-alive connection pool using exactly one TLS ciphersuite to connect to Java.

                                                          Crypto implementations in Java are pretty dodgy, especially for more obscure TLS combinations, and there are some straight up correctness bugs in Java TLS that cause weirdness.** Definitely a weak area for Java. Additionally, using a threaded web server to handle a lot of user sessions just isn’t as efficient. Jetty and Tomcat both have event reactors fronting a thread pool now, but neither are as fast as nginx. Even if they were, nginx is a better TLS terminator, with a bunch of other goodies baked in too. Like load balancing, routing, caching, and actual transparent and configurable TLS options.

                                                          * maybe proprietary Java stuff is better at this? I wouldn’t know.

                                                          ** tl;dr “Roughly one out of 256 connections fail.”

                                                          1. 2

                                                            I terminate in embedded Jetty with a very limited cipher suite. Post-heartbleed I’m not willing to give a non-memory-safe language access to my private keys.

                                                          2. 4

                                                            I don’t know about Java. I mean tomcat basically says “application server” on the brochure, but there’s Java profiles for the micro controller running in your bluray player. Or maybe the nav system in your car. It quickly becomes “runs on space shuttle or doesn’t count”.

                                                            There’s things I wouldn’t want to do with a “scripting” language. What’s the alternative, if not “system” language? Ok, “application” language, though that seems like more of a venn overlapping circle. How do these classifications inform my decision making?

                                                            Like, how often does one say “I’m definitely going to need a system language for this.”? Why? Did you reject go (or even Java) out of hand for not being system enough? (I do think people reject GC languages out of hand for many tasks without considering how much overhead they can accept.)

                                                            1. 9

                                                              I like to make the point that it’s 2015 and we have forms of automatic memory management which are not garbage collection. Such as linear types, or their less-strict version, linear region inference (as seen in ARC).

                                                              Complaints about GC, and answers to them, are a well-trodden path, and an honest discussion used to end with “it could certainly avoid the performance problems, but it doesn’t”. It also was always the position of many fans that development and maintenance expenses are more important than computational expenses, which I do think is true in some quantifiable sense - there’s a tradeoff, and garbage collection is often a win.

                                                              As far as what you’re saying about blanket terms for large categories of languages, ¯\_(ツ)_/¯

                                                              Edit: Lobsters Markdown requires some extra backslashes in the shruggie. :)

                                                              1. 1

                                                                What wouldn’t you want to do with a scripting language, other than a kernel? I’d write a driver in Python if I didn’t have Scala. Heck, I think my current printer drivers (HP) are written in Python.

                                                                1. 4

                                                                  Snabb Switch ships drivers for gigabit NICs written in Lua,running on LuaJIT and running in userspace. Snabb Switch’s LuaJIT Ethernet Device Driver and Kernel-bypass Networking are both fun reads. ♥

                                                                  1. 1

                                                                    That’s a good question. I’m thinking of servers that need to scale vertically. Or perhaps a file system. Something where I’m dealing with bytes.

                                                        2. 1

                                                          I think “write a kernel” is shorthand for “has minimal overhead” (because you want to keep resources available for programs that will run concurrently in the system), “is very fast” (because the speed of your code will be a coefficient on all programs that call your code or gets preempted by your code), and “operates in a very predictable and regular way” (i.e. virtual isochrony; low latency; no/few lock pauses). It’s the same set of requirements that one might look at when trying to figure out a language implementation language.

                                                          Going by those more detailed measures, I think the usual “systems language” candidates come into focus: C, C++, maybe Rust.

                                                          Go almost made it into that group but is just slower enough than C/C++, and had just enough GC pause, and had just too few other modern-language benefits not to really find a fit. GC has changed in favor of reduced pause time since the early days, but that implies increased memory pressure. I wouldn’t write zfs again in go because you might as well use C to get the required speed and the required memory control, if you’re going to use a memory unsafe language.

                                                          Rust is a maybe in my book because it’ll be a few years until all of its optimization passes settle in, and it’s not clear to me that its, erm, highly decorative ceremony around memory management is worth the gains, but that’s a personal preference argument about developer productivity and the proper role of compilers.

                                                          1. 2

                                                            That’s a nice set of criteria, but I really don’t think it means the same thing at all as “write a kernel”. For example, it’s not the speed of the Python interpreter that keeps anyone from writing a kernel in it. It’s the fact that it isn’t set up to run without libc and the Python interpreter executable, and its scripts aren’t in a format that can be loaded into memory by a bootloader and directly invoked. Since they’re text files.

                                                            1. 1

                                                              No, those other things are implementation details – it could be statically linked with a library, it is itself the interpreter executable, and you can make a bootloader do some amazing things these days, with files of any format. But once you did all of those things, your kernel would be incredibly slow, single core by default, prone to pauses and lockups, and would consume relatively high resources; and nothing you could do could change that, because the language runtime has those features innately in order to provide a higher level of abstraction and developer ease of use.

                                                      2. 4

                                                        Here’s a panel about systems programming languages with key people behind C++, Rust, D, and Go: https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Panel-Systems-Programming-Languages-in-2014-and-Beyond Rob pike addresses that question here, and explains why they stopped calling it that themselves.

                                                      3. 1

                                                        In regards to C++, it’s worth mentioning Linus Torvalds remarks on the language.

                                                        1. 36

                                                          I don’t think it’s worth mentioning. For one thing, it’s 8 years out of date, and C++ had 2 major revisions since then. It’s a substantially different language now. For another thing, there’s no real argument made, it’s just a rudely expressed opinion.

                                                          1. 2

                                                            For another thing, there’s no real argument made, it’s just a rudely expressed opinion.

                                                            It just feels like an uninformed biased rant. I wish there was more actual content in it other than “Linus hates it” so we could know his actual issues with it.

                                                            1. 2

                                                              I didn’t check the date on that, my mistake.