News for hackers. Stuff that matters.
Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @03:29PM (#14344388)
Simplicity? Modula-3 was simple, fast, and safe. PreScheme was less type-checked but powerful and simple. You can learn how to use them in a day coming from an imperative or functional language. Rust looks like it gives users extra power/safety with quite a bit of a learning curve (most say weeks to months) due to extra complexity. Definitely not simple, though.

https://en.m.wikipedia.org/wiki/Modula-3

https://en.m.wikipedia.org/wiki/PreScheme

Re:Two years of Rust by kibwen on Monday May 15, 2017 @04:18PM (#14344769)
The Modula-3 Evangelism Strike Force! We meet again! :)
Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @04:38PM (#14344901)
Oh yeah, I forgot to ask "Have you or the others considered rewriting your compiler in Modula-3? I hear you get safety, acceptable speed, and 5x iteration speed of Rust."
Re:Two years of Rust by lacampbell on Monday May 15, 2017 @06:15PM (#14345640)
I look forward to your fascinating re-implementation of unix tools from the 70s - only with less functionality.
Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @06:49PM (#14345875)
That's what would happen lol.
Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @04:27PM (#14344828)
Lol. While we're at it, I guess that makes Adacore and pals pushing Ada the Imperial Army, Ada Division given DOD background.
Re:Two years of Rust by Keyframe on Monday May 15, 2017 @08:13PM (#14346360)
And I was just about to preach Ada... ffs, man. We're not EVIL just because Death Star's OS is in Ada.
Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @09:58PM (#14346828)
Remember that little hole in the Death Star that blew the whole thing up? It was the C FFI. ;)
Re:Two years of Rust by fizixer on Monday May 15, 2017 @06:57PM (#14345940)
Looking at Modula-3 wikipedia page, no thanks. (If it's case-sensitive, I don't want to switch to uppercase everytime I use the language keywords. If it's not case-sensitive, don't even get me started.) I had enough of that for a lifetime through FORTRAN, COBOL, SQL, BASIC, ASSEMBLY, etc.

PreScheme sounds like an interesting idea.

Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @07:09PM (#14346020)
Do you have anything to say about it's feature set instead of just syntactic preference? As in, it's tradeoff in balancing complexity by what set of features?
Re:Two years of Rust by fizixer on Monday May 15, 2017 @07:23PM (#14346092)
Looking at it very briefly, its feature set is probably small enough to keep the language simple yet useful.

To be clear, I'm not a Rust guy, or even C++, Go, D.

On top of that, I'm a 2PL advocate (two programming languages). I think a combination of a readable high-level language like Python or Scheme, and a fast systems language like C, can carry out feats that no single programming language can as far as I know. (I don't consider keeping two or three programming language in your head while doing productive work a big deal, especially when learning multiple language is considered a beneficial thing).

Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @07:49PM (#14346239)
I'm with you on the 2PL right tool for the job idea. It's what I did. :)
Re:Two years of Rust by webkike on Monday May 15, 2017 @03:40PM (#14344483)
It's definitely simpler than most other systems languages in what it gives you access too. Go, D, C++, C# are all far more complicated than Rust is. I would argue Modula-3 is not as simple because it contains a garbage collector - thus making the connection between written and compiled code less simple. Don't know much about pre scheme
Re:Two years of Rust by comex on Monday May 15, 2017 @04:04PM (#14344662)
Go, at least, is far simpler as a language than Rust, and the implementation (compiler) is less complex overall, especially if you count LLVM on Rust's side. I suppose that Go programs exhibit more complex behavior at runtime due to the GC and green threads and stuff, but it's a huge stretch to call Go more complicated overall.

On the other hand, I'd argue that Rust makes up for the complexity with performance, power (ability to express more complex programs in less code), and safety (not just memory safety, which Go also mostly guarantees, but the ability to leverage the type checker to verify code correctness in general). C++, on the other hand, is more complex (due to all the legacy drift), yet equal in performance, less safe, and less powerful in most respects (there are some things C++ can do that Rust can't, but more things for which the opposite applies).

Re:Two years of Rust by kbenson on Monday May 15, 2017 @04:27PM (#14344829)
> I suppose that Go programs exhibit more complex behavior at runtime due to the GC and green threads and stuff

Given the GP's note about the connection between written and compiled code and how a GC affects that, I think this is exactly what is being referred to. I.e. a GC makes everything much simpler up until it doesn't, and then it makes it much more complicated. That point may never be reached in many programs, but it may be hard in some cases to tell whether it's something you have to worry about at all.

Re:Two years of Rust by infogulch on Monday May 15, 2017 @06:46PM (#14345855)
> GC makes everything much simpler up until it doesn't, and then it makes it much more complicated

I would say that's true in general, but in Go there's a lot more room to ask the GC to get out of your way if you need that than most.

Re:Two years of Rust by webkike on Monday May 15, 2017 @04:26PM (#14344821)
Consider how interfaces work and how you would have to implement them. Rust may have a more complicated type system and I suppose enums are more complicated in Rust, but the things I value as simple are more simple in Rust than Go.
Re:Two years of Rust by comex on Monday May 15, 2017 @05:05PM (#14345114)
What about interfaces? The basic idea of fat pointers with vtables works the same as Rust's trait objects. If you mean the ability to dynamically cast from one interface type to another, which Rust doesn't support - that does require a global list of implemented interfaces per type, but without generics that's not too hard to implement. (In Rust, it would be drastically more complex, verging on impossible to pull off with a good UX, due to various language features including wildcard impls, type-parameterized traits, and a Turing-complete type system.)
Re:Two years of Rust by webkike on Monday May 15, 2017 @05:23PM (#14345250)
When ever you would need to box a trait object in Rust Go automatically performs a heap allocation that is garbaged collected at some point. A bit more is explained here https://research.swtch.com/interfaces Basically there are some property of Go interfaces that make them far more dynamic than traits and implementations in Rust.
Re:Two years of Rust by pcwalton on Monday May 15, 2017 @07:45PM (#14346217)
> (In Rust, it would be drastically more complex, verging on impossible to pull off with a good UX, due to various language features including wildcard impls, type-parameterized traits, and a Turing-complete type system.)

Swift can downcast, and it has generic extensions and generic protocols. I highly suspect it has a Turing-complete type system as well.

Supporting this requires heroic effort in the compiler, but it can be done.

Re:Two years of Rust by cwzwarich on Monday May 15, 2017 @04:09PM (#14344698)
How is Rust simpler? In terms of cognitive complexity on the part of the user, Modula-3 is much simpler; it is easier for a programmer to learn to write new Modula-3 code and correctly read Modula-3 code than it is for Rust code.

In terms of implementation complexity, Modula-3 is also much simpler, despite the existence of a GC. A Modula-3 spec would be a great deal smaller than an equivalently detailed Rust spec. Many people have independently implemented Modula-3, whereas an independent implementation of Rust is effectively impossible, due to all of the unspecified implementation-defined behaviors. If you told me I had 1 year to implement either language from scratch, I would much rather choose Modula-3.

Re:Two years of Rust by webkike on Monday May 15, 2017 @04:24PM (#14344810)
I'm talking about the mean distance in expectations between a program and the compiled output. I don't think Modula-3 is much more complicated or even moderately more complicated. I think it's all pedantry of personal definitions at this point. What makes a language "simple" or even "the most simple" aren't even questions that are possible to answer objectively.
Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @04:33PM (#14344871)
"I'm talking about the mean distance in expectations between a program and the compiled output."

Then you should be talking about Rust, C++, Java and other complex languages if that's your concern. Wirth-style languages use simple constructs that map straightforward to assembly. He actually designs the language in conjunction with the compiler so the simplicity is maintained. If it's hard to compile, he just takes it out of the language. Modula-3 adds select complexity to a Wirth-style language to give it exceptions, multithreading, and a standard library. Most of them are similarly straight-forward in implementation. It's why it compiles lightening-fast.

Re:Two years of Rust by steveklabnik on Monday May 15, 2017 @04:12PM (#14344729)
There are two alternative implementations of Rust in the works; one is _almost_ able to compile rustc at this point.
Re:Two years of Rust by cwzwarich on Monday May 15, 2017 @04:21PM (#14344783)
What are these implementations? The one I immediately found by searching (https://github.com/thepowersgang/mrustc) is accompanied by an explicit nongoal to correctly implement the language. It also doesn't seem particularly independent from rustc, given the similarities in implementation strategy and the fact that some parts look like rustc code converted to C++.
Re:Two years of Rust by steveklabnik on Monday May 15, 2017 @04:24PM (#14344803)
Mrustc is one; my understanding is that it isn't yet, because its purpose in life is to make bootstrapping/ddc stuff easier. Once that works, I thought it intended to add the stuff that's missing.

There's another that's not public.

Re:Two years of Rust by kibwen on Monday May 15, 2017 @08:58PM (#14346582)
> ddc stuff

Note: this refers to "Diverse Double Compilation", which is a mitigation tactic against Reflections-on-Trusting-Trust attacks.

Re:Two years of Rust by nickpsecurity on Tuesday May 16, 2017 @02:29PM (#14352057)
I suggest you email the team that did the C formal semantics about doing one for Rust. They did it in K Framework (Maude-based) with a front end, KCC, designed to be usable like GCC. Their other work includes functional and logic languages. A team that did an executable semantics for all of those seems ideal for a formalized compiler for Rust given it's like several styles combined. Their rewriting based tools could probably handle at least a subset. Then you get DDC for free plus a way to equivalence check reference compiler for certain features.

https://github.com/kframework/c-semantics

http://www.kframework.org/index.php/Main_Page

Re:Two years of Rust by pjmlp on Monday May 15, 2017 @04:04PM (#14344663)
That is what the Assembly view of the compiler is for.

Also your complaint can be applied to C as well.

Given how optimizing compilers work, and the amount of UB being exploited, the language stoping being simple long time ago.

Re:Two years of Rust by nickpsecurity on Monday May 15, 2017 @04:30PM (#14344847)
Modula-3, like many Wirth-inspired languages, can be described in a few pages with developers understanding those pages. You can be writing useful code in a day, using most of its features in a week, and probably master it in months to a year. The GC doesn't make it any less simple as that's one component that lets you ignore the complexity of memory management. The component itself can also be simple.

Rust being simpler than other programming languages you cite actually means those languages are enormously complex. That is, given how much more complex Rust was to Wirth-style languages, Smalltalk, Scheme, and so on. It has extra stuff. Hence, the extra complexity. The compiler is also harder to write to make all that work.

Re:Two years of Rust by jabits on Monday May 15, 2017 @03:50PM (#14344558)
Have only checked Rust out a bit, but you mention C#. Does Rust have functionality similar to, and as easy to use, as Linq?
Re:Two years of Rust by moosingin3space on Monday May 15, 2017 @04:00PM (#14344636)
In Rust, you'd generally use functions that return iterators or Tokio's streams for Linq-style tasks. Check out the "Complex Queries" example on http://diesel.rs for an example of what a Linq-like library looks like in Rust.
Re:Two years of Rust by zlynx on Monday May 15, 2017 @03:58PM (#14344617)
Linq, ick. It's a performance nightmare. No one knows what it is actually doing in the background so firstly, everyone writes horrible O-cubed performance with it, and then it is a series of random poking around to try fixing it.
Re:Two years of Rust by xorxornop on Tuesday May 16, 2017 @03:46AM (#14348015)
Depends if you're using it with ORMs or not. It's equally as useful with data in memory. Definitely slower for some things though (yes, it's always slower in one sense... But its also easier to make parallel, so it can even out in the end)

Still, I now prefer doing such things in Rust.

Re:Two years of Rust by xorxornop on Tuesday May 16, 2017 @03:44AM (#14348005)
Yes, it does. Also a C# programmer. I really like Rust. About as easy to use to transform, filter, group etc, but considerably faster.
Re:Two years of Rust by placeybordeaux on Monday May 15, 2017 @03:55PM (#14344599)
How are you defining complexity in a programming language?
Re:Two years of Rust by webkike on Monday May 15, 2017 @04:02PM (#14344647)
I suppose it's the difference between the computational model presented by the language verses the computational model presented by the computer. A combination of how many components require some runtime environment to exist and how many disparate language features there are. Not an intuitive definition of simple for sure, but this is in the context of a system's programming language. In terms of just plain simple, I'd say scheme or just lambda calculus even takes the cake.
Re:Two years of Rust by placeybordeaux on Monday May 15, 2017 @04:05PM (#14344671)
So the fact that that is a scheduler and a garbage collector in go means that by your definition even the simplest go program has a large complexity cost?
Re:Two years of Rust by webkike on Monday May 15, 2017 @04:20PM (#14344781)
Not necessarily large, but it factors into the mean complexity cost.
Re:Two years of Rust by int_19h on Tuesday May 16, 2017 @01:38AM (#14347599)
If I remember correctly, the only reason why Modula-3 is memory-safe is because it requires a GC. That right there is a no-go for a "C++ killer" system language.
Re:Two years of Rust by nickpsecurity on Tuesday May 16, 2017 @09:26AM (#14349357)
Most C++ apps can be written in a GC'd language. It has UNSAFE/SYSTEM for when you want to take chances managing your own memory. A language like Ada or Rust would be better at unsafe stuff.
Re:Two years of Rust by int_19h on Tuesday May 16, 2017 @11:00PM (#14355291)
Yes, a lot of C++ code out there can be rewritten with GC. But for a language to replace C++, it has to cover the full spectrum, and that includes GC-less operation for low-level components. Providing primitives to manually allocate memory on unmanaged heap is not sufficient - the language must allow running without GC at all.
Re:Two years of Rust by nickpsecurity on Wednesday May 17, 2017 @12:46PM (#14360231)
It does. It just isn't safe. The extra primitives for safer handling of pointers are main advantage of C++, D, Rust, etc. A worthwhile re-incarnagion of Modula-3 should have something similar.
Re:Two years of Rust by int_19h on Wednesday May 17, 2017 @10:31PM (#14364461)
So the standard library doesn't rely on GC semantics anywhere?

As I recall, that's the main problem with D: the standard library basically requires GC. Your code might not require it, but the library is always there. On top of that, it's just too easy to accidentally involve GC by using reference types.

Re:Two years of Rust by nickpsecurity on Wednesday May 17, 2017 @11:02PM (#14364548)
Actually, I dont know. Good question. I tried to quickly get the info but all I found was about I/O. It's done UNSAFE to use platform-specific ways of reducing overhead. Probably no GC semantics there. Anyone curious who can get some Modula-3 source for stdlib might just look to see if UNSAFE is at the top of the routines. Also, if that turns off the GC, Id reason that just putting it in front of a stdlib function that was GC'd might make it work without it unless they screwed up memory management in the code itself.
Re:Two years of Rust by pjmlp on Monday May 15, 2017 @04:07PM (#14344692)
Given the work being done in .NET Native and the planned features for C# 7.2, the language is starting to look like the spiritual descendent from Modula-3.