Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2018 11:50:12 +0200
From:      Damjan Jovanovic <damjan.jov@gmail.com>
To:        Alan Somers <asomers@freebsd.org>
Cc:        Eric McCorkle <eric@metricspace.net>,  "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Speculative: Rust for base system components
Message-ID:  <CAJm2B-kwBpx1V3bsNYZpOOPKB8=zv-OdzBADao2zkS=fFGJgPg@mail.gmail.com>
In-Reply-To: <CAOtMX2g64pAXPbvwXCY14BOz=H4qE9wqV8K8D7kPmWK=3vFC0Q@mail.gmail.com>
References:  <ca76e5f7-6e59-bd67-144a-90ad66f0252e@metricspace.net> <CAOtMX2g64pAXPbvwXCY14BOz=H4qE9wqV8K8D7kPmWK=3vFC0Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 31, 2018 at 8:37 AM Alan Somers <asomers@freebsd.org> wrote:

> On Sun, Dec 30, 2018 at 10:38 PM Eric McCorkle <eric@metricspace.net>
> wrote:
> >
>
> >
> > == Go ==
> >
> > Go is not really a "systems language" in the sense that C or Rust are.
> > It isn't a replacement for C so much as a replacement for python.
> >
> > What's more, it is almost universally disliked by people with a
> > background in programming languages (I am one of those).  There's a
> > couple of reasons for this.  First, it omits a number of features that
> > modern languages *really* should include, parameterized types (generics)
> > being one of the most glaring.  Beyond that, it completely ignores
> > anything produced by modern PL research (unlike Rust, which benefits
> > from that work).  Second, one of its main design parameters was "it
> > should compile fast".  This as a design constraint basically guarantees
> > that you can't do anything interesting in compilation, which rules out
> > both advanced type systems as well as serious optimization.
> >
> > Unlike Rust, which offers substantial security and stability benefits
> > through its type system, Go would do little more than just change the
> > syntax of a bunch of code.  Moreover, it's likely that there would be
> > performance consequences, given the design constraint of fast
> compilation.
>
> I think there's a common misconception that Go and Rust are similar
> just because they were invented at about the same time and they share
> some superficial syntactial similarities.  But Go is much less
> suitable for an OS.  It's a memory-managed language, like Java.
> Remember when Java was the hot new thing, and people predicted that
> OSes would be written entirely in Java, and microprocessors would be
> redesigned to execute JVM bytecode directly?  It never happened,
> because Java just isn't suitable for low-level work.  Neither is Go.
> Rust is.
>
>
ARM chips could (and some did) have the Jazelle DBX extension to run Java
bytecode in hardware. There are Java editions used on SIM cards and Blu-ray
disks, so it certainly has low-level editions. It's Java SE that is heavy:
7 threads and 50 MB RAM for a hello world application, last time I checked.

In this regard, Go is much lighter: 2 threads and 1 MB RAM for a hello
world. Go has unsigned types, structure embedding, excellent
interoperability with C, and the ability to compile into shared libraries
which are loaded and called from C, so it is a lot better for low-level
programming than Java. Having said that, the number of architectures
supported by Go is fairly limited, and languages with automated garbage
collection are unusable for kernel development.

I would like to see more Rust (or a similar language) in systems
development.

Damjan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJm2B-kwBpx1V3bsNYZpOOPKB8=zv-OdzBADao2zkS=fFGJgPg>