News for hackers. Stuff that matters.
Re:The Rust I wanted had no future by anonyfox on Monday June 05, 2023 @08:18AM (#36195215)
I love Rust and built some production code with it in the past. But nowadays I want something more simple so that not-so-senior developers can pick it up quickly, and I want flawless tooling, and willing to sacrifice a bit of performance. So basically I often end up with Go. Go is exceptionally great in tooling, ecosystem, any objective metrics like build times or crosscompilation... but I still don't like the language itself personally.

If there would be something just like Go, but with a bit more powerful typesystem like Rust has (Option<T> instead of `err != nil`, and so on), and a simplified ML-like language instead of an imperative one... that would be my dream.

Re:The Rust I wanted had no future by zidad on Monday June 05, 2023 @08:27AM (#36195280)
You could try C# (or Kotlin if you have a MS bias ;-)). Both really nice general purpose languages, quite performant despite having a GC and great available tooling.
Re:The Rust I wanted had no future by anonyfox on Monday June 05, 2023 @08:31AM (#36195312)
I think I still would have to deal with a lot of OOP and imperative code there, C# feels like a kitchen sink of stuff - right?
Re:The Rust I wanted had no future by zamalek on Monday June 05, 2023 @08:48AM (#36195454)
C# is horribly OOP. I use it in my day job, and the frameworks wield OOP overcomplexity proudly. It has likely gone beyond Java as the posterchild for OOP: interfaces that are implemented once, classes that are instantiated once. You can't get away from it either, it is practically part of the stdlib and everyone cargocults it.

Rust is imperative too, though.

Re:The Rust I wanted had no future by hadrien01 on Monday June 05, 2023 @09:31AM (#36195947)
The language doesn't push you towards interfaces implemented once, but many developers indeed persist doing it for no reason at all. With proper code review we're able to make that practice go away on the projects I'm working on.
Re:The Rust I wanted had no future by vips7L on Monday June 05, 2023 @09:56AM (#36196210)
Isn't this just mostly an issue with mock testing in C#? Developers cargo cult single implementation interfaces because its so hard to mock concrete classes.
Re:The Rust I wanted had no future by za3faran on Monday June 05, 2023 @01:36PM (#36199884)
I've seen the same in golang, which ironically is supposed to be vehemently against OOP.
Re:The Rust I wanted had no future by rjbwork on Monday June 05, 2023 @04:10PM (#36202838)
>Isn't this just mostly an issue with mock testing in C#

Yes. You have two choices: Interface implemented once, or virtual on all your public members.

I personally think Interface is the sane choice.

Would be nice if the .NET devs let us mock POCO's though...

Re:The Rust I wanted had no future by hadrien01 on Monday June 05, 2023 @05:46PM (#36204319)
You can mock (well, "fake") POCOs with packages like AutoFixture that use reflection to generate mostly fake data, depending on what you need. You don't need interfaces or virtual, but you do need public getters unfortunately.
Re:The Rust I wanted had no future by diarrhea on Monday June 05, 2023 @02:19PM (#36200641)
Lots (all?) major frameworks push for dependency injection though, where interfaces are a must, as far as I know (not for DI-the-principle, but DI-as-implemented). ASP.Net Core is a good example. It's not C# at the language level forcing interface-driven development, but frameworks like ASP.Net are so tightly integrated that boundaries blur.
Re:The Rust I wanted had no future by zamalek on Monday June 05, 2023 @05:28PM (#36203968)
Yup, that's what I meant by "practically." Nobody forces you to use the Microsoft.x nuget packages, but good luck at finding packages that don't rely on Microsoft.DI, or Microsoft.Hosting, or what-have-you.
Re:The Rust I wanted had no future by hadrien01 on Monday June 05, 2023 @05:42PM (#36204255)
You don't need interfaces for dependency injection, you can inject classes directly. I see interfaces more for separation of concerns (with domain-driven design pushed from all parts in the .NET world at the moment...), but that's not an obligation.
Re:The Rust I wanted had no future by rowls66 on Tuesday June 06, 2023 @09:04AM (#36212028)
I have seen way too much of interfaces implemented once in Java, and have argued against it unsuccessfully many times. I am not working in Go, and see the same.
Re:The Rust I wanted had no future by chronofar on Monday June 05, 2023 @10:02AM (#36196297)
You can avoid quite a bit of OOP with Kotlin if you like, and with Arrow make some really nice functional code. Imo it offers a great balance of imperative vs functional, providing powerful tools for whatever style suits the project best.
Re:The Rust I wanted had no future by jjtheblunt on Monday June 05, 2023 @08:25AM (#36195265)
Have you dismissed F# ?
Re:The Rust I wanted had no future by FrustratedMonky on Monday June 05, 2023 @08:28AM (#36195290)
I would like to second F#. It seems to have a lot of what people want, so why isn't it more popular?
Re:The Rust I wanted had no future by anonyfox on Monday June 05, 2023 @08:32AM (#36195324)
Can I natively build self-contained binaries? One of Go's biggest advantages is the delivery chain from code to server (build for target arch, copy to target, ./run)?
Re:The Rust I wanted had no future by naraga on Monday June 05, 2023 @08:46AM (#36195444)
Re:The Rust I wanted had no future by throwaway2037 on Monday June 05, 2023 @11:20AM (#36197489)
I can vouch for it! I returned to C# for a tiny desktop GUI recently. I was blown away by how simple is the tooling to create a single monolithic binary. It's great for enterprise distribution. "No more installer."
Re:The Rust I wanted had no future by jjtheblunt on Monday June 05, 2023 @09:13AM (#36195711)
Yes
Re:The Rust I wanted had no future by ontologiae on Monday June 05, 2023 @10:42AM (#36196843)
I had to deal with it, when I hadto parse Transac-SQL code, and it's not handy. Very difficult to have a single executable file containing everything, it needs a whole subtree. OCaml is easier with Opam and ocamlbuild tools.
Re:The Rust I wanted had no future by zidad on Monday June 05, 2023 @08:30AM (#36195302)
Unfortunately a lot of people will dismiss C# and F# just because it has the Microsoft label. I do think they're missing out.
Re:The Rust I wanted had no future by anonyfox on Monday June 05, 2023 @08:33AM (#36195339)
Nowadays I program in a mostly Microsoft world (VSCode, Github, npm, typescript, GPT, ...) and I think its quite good, so no bias here. But the "shipping a native binary straight to the server that just works" is absolutely crucial for me
Re:The Rust I wanted had no future by walljm on Monday June 05, 2023 @08:38AM (#36195367)
.net will let you do that now. You can ship precompiled binaries with Native AOT. (https://learn.microsoft.com/en-us/dotnet/core/deploying/nati...)
Re:The Rust I wanted had no future by vips7L on Monday June 05, 2023 @09:56AM (#36196220)
And even before native AOT you could use publish single and have a single binary.
Re:The Rust I wanted had no future by mmargerum on Monday June 05, 2023 @08:39AM (#36195375)
ASP.NET AOT support coming in .net 8
Re:The Rust I wanted had no future by hajile on Monday June 05, 2023 @12:40PM (#36198967)
The rest of the world has. If you're going to use .net, there's almost zero chance that you'll get permission to use F#.

For whatever reason, C# devs seem incredibly resistant to even just looking at F#.

Re:The Rust I wanted had no future by pjmlp on Monday June 05, 2023 @04:33PM (#36203188)
Do you want reasons? Here are a couple from someone that has learned ML with Caml Light, and most of the latter ML variants.

VS Tooling lacking versus C#/VB, no support for code generators, no support for Roslyn, no support for GUI frameworks, no support for EF tooling, many .NET vendors don't support projects if using F#, community likes to create their own wrappers instead of embracing standard .NET projects, ....

Re:The Rust I wanted had no future by jeltz on Monday June 05, 2023 @08:24AM (#36195261)
Yeah, that is exactly what I want for when I build web applications. Something with an ecosystem like Rust's, with more advanced type system than go but which sacrifices some performance for ease of development.
Re:The Rust I wanted had no future by californical on Monday June 05, 2023 @08:33AM (#36195332)
I feel like Crystal is close, they just need more community to build out their ecosystem. Otherwise it seems like a perfect language (fun, simple to understand, compiled + fast, has types)
Re:The Rust I wanted had no future by anonyfox on Monday June 05, 2023 @08:35AM (#36195354)
Already played with it, what has killed me are the outragously long compile times for nontrivial code and no "easy" way to crosscompile binaries, besides from some docker hack. Also its like a modern Ruby, which is great in general, but I really want ML-like functional style programming instead of OOP
Re:The Rust I wanted had no future by amelius on Monday June 05, 2023 @09:25AM (#36195865)
OCaml?
Re:The Rust I wanted had no future by anonyfox on Monday June 05, 2023 @10:52AM (#36196985)
really tried to get into it for a while, but the tooling situation feels like the polar opposite of Go, where everything needed in daily work is right there in a standardized way and just works out of the box.

I kinda like the language (its what I want basically) but the operational aspects are what I actually need and want first and foremost.

Re:The Rust I wanted had no future by kaba0 on Monday June 05, 2023 @10:12AM (#36196428)
Scala, Haskell, Java, Kotlin.
Re:The Rust I wanted had no future by gardaani on Monday June 05, 2023 @11:00AM (#36197137)
Rust borrow checker and lifetimes are sometimes so frustrating. I hope that the Jakt language will evolve to the language I'd like to see: Swift without ties to Apple and Objective-C.
Re:The Rust I wanted had no future by bscphil on Monday June 05, 2023 @11:54AM (#36198171)
Apple has been pushing Swift on Linux enough that I've been checking out its progress every so often. It will probably never get entirely free of ObjC but it's a nice enough language that I'd really like to be able to use it for cross-platform desktop applications. Having a pretty robust standard library and a stable ABI (currently just on macOS) are big plusses, in my book. Having a built in REPL is icing (delicious, delicious icing).
Re:The Rust I wanted had no future by netbioserror on Monday June 05, 2023 @11:33AM (#36197773)
Nim gets real close. It doesn't have great UI tooling, but its command line tools are quite good.
Re:The Rust I wanted had no future by rdevsrex on Monday June 05, 2023 @03:00PM (#36201446)
Yeah I've been looking into Nim and I want to build something substantial in it and see how it performs and feels to write.
Re:The Rust I wanted had no future by xhevahir on Monday June 05, 2023 @03:40PM (#36202371)
Nim is quite imperative, too. And its BDFL(Araq) takes a dim view of functional programming: https://forum.nim-lang.org/t/8927
Re:The Rust I wanted had no future by 59nadir on Tuesday June 06, 2023 @03:42AM (#36209500)
Nim punts too many things to random GitHub libraries. Tagged unions with exhaustiveness checks for something like pattern matching on them is the responsibility of some random person in the Nim community, for example, which is a step too far, IMO.

I think what it comes down to is that the creator/BDFL of Nim has an eclectic set of things that he simply doesn't care about and will never add to the language even though they are basically table stakes nowadays.

Re:The Rust I wanted had no future by weatherlight on Monday June 05, 2023 @12:34PM (#36198848)
I wish someone would go back and give love to Standard ML. it such a great language, small, and easy to learn, extremely fast, compiles fast, and expressive to boot.

It's tooling isn't great though. I think its syntax is a lot nicer than OCaml's for example.

There is this wonderful language that is up and coming called Roc that look promising.

https://www.youtube.com/watch?v=6qzWm_eoUXM

language examples here -> https://www.roc-lang.org/tutorial

Re:The Rust I wanted had no future by YorickPeterse on Monday June 05, 2023 @01:19PM (#36199610)
Perhaps you'd be interested in Inko (https://inko-lang.org/). It's obviously not there yet in terms of tooling and what not, but it might scratch an itch for those looking for something a bit like Rust, but easier to use.

Disclaimer: I'm the author of said language :)

Re:The Rust I wanted had no future by justinpombrio on Monday June 05, 2023 @02:23PM (#36200709)
Everyone and their grandmother is aiming for "like Rust, but easier to use". I think I could name half a dozen. It's a laudable goal!

How do your references work? Is `&T` a type? Can you store it in a structure, or return it? Can you have a reference to a reference? If you can have a function `f(&T, &T) -> &T`, how do you distinguish whether the reference it returns lives as long as the first or second argument? If references can't be stored in structs, how do you do non-owned iterators, or string slices?

Re:The Rust I wanted had no future by YorickPeterse on Monday June 05, 2023 @07:42PM (#36205959)
If you scroll past the code examples, there are a few more details, though for more you'll need to look at the documentation (specifically https://docs.inko-lang.org/manual/main/getting-started/memor...).

> Is `&T` a type?

Inko's syntax for references is `ref T` for immutable references/borrows, and `mut T` for mutable ones. Unlike Rust, you can't implement methods/traits _only_ for references, instead you can only implement them for the underlying "base" type. So `impl ToString for String { ... }` is valid, but `impl ToString for ref String { ... }` isn't.

> Can you store it in a structure, or return it?

Yes.

> Can you have a reference to a reference?

No, `ref ref T` is "collapsed" into just `ref T`, and the language has no notion of pointers and pointer-pointers.

> If you can have a function `f(&T, &T) -> &T`, how do you distinguish whether the reference it returns lives as long as the first or second argument

Inko doesn't have a borrow checker, so it doesn't. Instead it relies on runtime reference counting to prevent dropping of values that still have references to them. Over time I hope to implement more compile-time analysis to reduce this cost as much as possible, but borrow checking/lifetime analysis like Rust isn't something Inko will have.

Or to put it differently, I want the compiler to catch say 80-90% of the obvious "this ref outlives its pointee" errors without complicated borrow checkers. For the remaining 10-20% the runtime check should suffice.

Re:The Rust I wanted had no future by avgcorrection on Monday June 05, 2023 @01:23PM (#36199660)
> If there would be something just like Go, but with a bit more powerful typesystem like Rust has (Option<T> instead of `err != nil`, and so on), and a simplified ML-like language instead of an imperative one... that would be my dream.

Not to be snarky (for once) but

- More powerful type system: that goes against the whole implementation culture behind Go and their wider philosophy

- ML-inspired instead of imperative: goes even more counter to the above

I have never tried Go and I will probably never care to try it, but I have never seen a language which manages to both be (1) simple in the Go-sense and (2) look remotely anything like an ML language.

Re:The Rust I wanted had no future by scythe on Monday June 05, 2023 @01:57PM (#36200247)
>like Rust has (Option<T> instead of `err != nil`

Didn't they implement generics already?

https://go.dev/blog/why-generics

It seems like their implementation has enough power to do this in most cases, although "Option" is not built in.