News for hackers. Stuff that matters.
Re:The search for easier safe systems programming by cornholio on Wednesday May 08, 2024 @06:14AM (#40296258)
Seems like the wrong problem to solve. "Systems programming" is hard, and should be hard, for reasons unrelated to the programming language used. Something like Rust which forces you to constantly reevaluate your design before you even press the compile button, is ideal.

What's really lacking are safe, easy, strong typed general purpose languages that can leverage AOT compilation for high performance and static analysis etc. A language with the learning curve of Python, near C performance and strong safety guarantees of Rust. There is nothing that suggests to me such a language would not be possible. Swift and C# come closest but they are warped by their respective corporate overlords.

Re:The search for easier safe systems programming by K0nserv on Wednesday May 08, 2024 @06:37AM (#40296398)
> Seems like the wrong problem to solve. "Systems programming" is hard, and should be hard, for reasons unrelated to the programming language used. Something like Rust which forces you to constantly reevaluate your design before you even press the compile button, is ideal.

I was recently musing about this on Mastodon[0], commenting on a tweet that said something to the effect of "C++ isn't complex, it just doesn't lie about the complexity of reality". I think Rust is similar, and really any system language has too be. However, there's a space between lying about reality and fully reflecting reality where useful abstractions, such as Rust's lifetimes live. If you hardline the "lying about reality" framing, any abstractions on top of machine code must be ruled out. So while I see where you are coming from, I think lots of space to improve system programming, as Rust did.

> What's really lacking are safe, easy, strong typed general purpose languages that can leverage AOT compilation for high performance and static analysis etc. A language with the learning curve of Python, near C performance and strong safety guarantees of Rust. There is nothing that suggests to me such a language would not be possible. Swift and C# come closest but they are warped by their respective corporate overlords.

I agree about Swift fitting this mold, it's unfortunate that it has failed to gain traction outside of Apple's ecosystem.

0: https://infosec.exchange/@k0nserv/112399102914339131

Re:The search for easier safe systems programming by UncleMeat on Wednesday May 08, 2024 @08:05AM (#40297051)
C++ has a bazillion different ways of initializing a value, most of which contain syntactic footguns of some kind that don't do what you probably intended. That's not fundamental complexity of reality, that's messy evolution over decades coupled with the inability to break backwards compatibility.

C++ also does "lie" about reality in a lot of ways, in the sense that the actual compiled program behaves quite a bit differently than a plain reading of the code implies to a nonexpert. The most obvious form of this is the rules for effect ordering. Even the recurring complaints about the compiler doing unexpected things based on the as-if rule and undefined behavior seem to count here.

Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @09:14AM (#40297758)
Actually, it has enough for having a 200+ pages book full of them.

"C++ Initialization Story: A Guide Through All Initialization Options and Related C++ Areas"

https://www.amazon.com/Initialization-Story-Through-Options-...

Re:The search for easier safe systems programming by ModernMech on Wednesday May 08, 2024 @09:46AM (#40298066)
C++ is the poster child for incidental complexity.
Re:The search for easier safe systems programming by bluGill on Wednesday May 08, 2024 @10:49AM (#40298713)
The reality is people have 30 year old code bases, and so a messy evolution without breaking backward compatibility is and important part of reality. C++ could have been a much better language without backwards compatibility - but nobody would used it and so what is the point.
Re:The search for easier safe systems programming by UncleMeat on Wednesday May 08, 2024 @10:59AM (#40298830)
I don't think that C++'s rigorous adherence to backwards compatibility (include binary compatibility) is a bad choice. It has served the language well. It just has consequences.
Re:The search for easier safe systems programming by pjc50 on Wednesday May 08, 2024 @08:15AM (#40297132)
> it just doesn't lie about the complexity of reality

"Undefined behavior" is not reality; it's a strange shadow world where anything may happen. The compiler reserves the right to reject your reality and substitute its own - which it will not show you within the language, nor let you choose or hint, nor warn you.

People like to use C and C++ as if they were a species of typesafe macro assembler that always produces predictable machine code, and that breaks down often enough that the world is full of systems-level CVEs.

Re:The search for easier safe systems programming by bluGill on Wednesday May 08, 2024 @10:53AM (#40298754)
People keep saying this, yet undefined behavior sanitizer proves in the real world it isn't an issue most of the time.

Most real world security issues have nothing to do with code. Social engineering breaks more security than memory issues. We are also skewed by many of the fundamental programs are written in C and so there is a lot of value in finding holes.

Re:The search for easier safe systems programming by pjc50 on Wednesday May 08, 2024 @11:13AM (#40299022)
The US government official cybersecurity people have a different opinion. https://www.whitehouse.gov/oncd/briefing-room/2024/02/26/pre...
Re:The search for easier safe systems programming by bluGill on Wednesday May 08, 2024 @01:09PM (#40300460)
Nothing in that disagreed with my statements.
Re:The search for easier safe systems programming by gjm11 on Wednesday May 08, 2024 @07:12AM (#40296644)
It doesn't feel to me like much of C++'s complexity is just "the complexity of reality" being faithfully exposed.

I'd wonder whether that's just me being dim, but if so then I think Bjarne Stroustrup and Herb Sutter are dim in the same way. (Stroustrup, quoted approvingly by Sutter: "Inside C++, there is a much smaller and cleaner language struggling to get out." and "Say 10% of the size of C++ in definition and similar in front-end compiler size. ... most of the simplification would come from generalization.") And it doesn't seem likely to me that they are ignorantly overpessimistic about the complexity of C++.

Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @07:00AM (#40296574)
.NET of today seems to stand out quite a bit in comparison to many other MSFT-backed projects. Especially if you look not at non-essential and possibly azure-related tooling but rather at the "core" itself (that is, SDK, runtime and compilers) which is distributed under permissive MIT license which you can just take and do anything with.

To surprise of many outside of .NET community, it has much better performance than Swift[0][1][2] and lets you match performance of C and C++ in areas that matter.

[0] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

[2] https://benchmarksgame-team.pages.debian.net/benchmarksgame/... (better performance for short-running benchmarks sensitive to JIT)

(no direct comparison but Tl;Dr: ARC and Swift defaulting to virtual dispatch that can't always be elided with WMO results in Swift having much lower (even if more consistent) performance)

Re:The search for easier safe systems programming by pjc50 on Wednesday May 08, 2024 @08:18AM (#40297163)
With AOT and "[UnmanagedCallersOnly]" you can even emit C# libraries that are callable from true native code using the C FFI.
Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @08:21AM (#40297186)
Yup, you can even statically link them into C/C++/Rust/etc. (or vice versa)!
Re:The search for easier safe systems programming by igouy on Wednesday May 08, 2024 @01:39PM (#40300872)
Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @04:52PM (#40302608)
Thanks!

Also wow, I stand corrected, Swift is a much stronger contender in Benchmarks Game scenarios than earlier microbenchmarks and research projects that I've seen would suggest. Particularly when using its own SIMD abstraction, it is likely LLVM makes very competent transformations, possibly merging narrower operations into a wider ones, replacing one set of intrinsics with another, etc.

However, still seems to suffer quite a bit, just like Go, in Binary Trees (it's not like C# does the best there either, the winners use bump allocators, and then there's also a 2.6s magic entry by Java, write barrier elision?).

Re:The search for easier safe systems programming by armchairhacker on Wednesday May 08, 2024 @07:27AM (#40296750)
And Kotlin, and arguably Java and Scala, and possibly Dlang and Nim. There are a lot of strongly-typed general-purpose languages.
Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @08:07AM (#40297069)
Yeah the JVM is quite fast at this point after it starts up.
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @09:22AM (#40297848)
It can even be helped to be faster with AOT/PGO, or JIT caches.

And while Android ART technically isn't Java (the plaform), its mixed execution mode with hand written Assembly interpreter, JIT, AOT with PGO shared via play store is quite cool.

Re:The search for easier safe systems programming by knighthack on Wednesday May 08, 2024 @08:16AM (#40297140)
I really must suggest Nim.
Re:The search for easier safe systems programming by angra_mainyu on Wednesday May 08, 2024 @07:38AM (#40296824)
>A language with the learning curve of Python, near C performance and strong safety guarantees of Rust.

Sounds like Go or Zig, though Go is slightly less safe and slower - in turn being much easier.

Though I'd reach for Go first if I'm working with anything concurrent. Concurrency is hard, and Go really helps with getting it right.

Re:The search for easier safe systems programming by kaba0 on Wednesday May 08, 2024 @08:54AM (#40297579)
Go is not at all playing in the same league as Zig or Rust. Of course managed languages are more than fine for almost every use case, but I really hate this trends to wash go together with low-level languages for absolutely no good reason.
Re:The search for easier safe systems programming by mwcz on Wednesday May 08, 2024 @09:08AM (#40297695)
That's not just a trend. There are many areas of programming where a choice between Rust and Go is perfectly reasonable. Rust is playing on Go's turf, but Go isn't playing on Rust's, if you get my meaning.
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @09:20AM (#40297821)
F-Secure created USB Armory firmware in Go instead of Rust, exactly because they wanted to make the point of it being a possible scenario for Go, regardless of what the interwebs think about the idea.

USB Armory is still being sold.

Re:The search for easier safe systems programming by gliptic on Wednesday May 08, 2024 @10:00AM (#40298219)
Zig doesn't have anything like the safety guarantees of Rust.
Re:The search for easier safe systems programming by _kb on Wednesday May 08, 2024 @06:58AM (#40296546)
Crystal lang also plays a bit into that space. It has a fairly expressive type system, good inference, checked nil type, and very approachable syntax.
Re:The search for easier safe systems programming by kkukshtel on Wednesday May 08, 2024 @06:35AM (#40296388)
C# nails this consistently, it's not worth hand waving it away because it isn't FOSS. Rust drama itself suggests that a FOSS language doesn't shield it from corporate meddling.
Re:The search for easier safe systems programming by raddan on Wednesday May 08, 2024 @07:04AM (#40296603)
The C# compiler has an MIT license and is available on GitHub, which is about as FOSS as it gets.

https://github.com/dotnet/roslyn

Re:The search for easier safe systems programming by crote on Wednesday May 08, 2024 @08:40AM (#40297403)
The compiler is one thing, the ecosystem is another.

Sure, you can compile and host your .NET Core web app on Linux these days, but desktop applications are a completely different beast. You're often lucky if one exists at all, and if it does there's a decent chance it's not designed for "modern" C#-on-Linux. It really isn't a viable option yet, maybe in a decade or two.

Re:The search for easier safe systems programming by stanac on Wednesday May 08, 2024 @08:56AM (#40297591)
WPF is MIT licensed, available on github. The fact that it's windows only doesn't make it less FOSS. Microsoft doesn't have incentive to port it to other platforms but other people and companies are free to do that.
Re:The search for easier safe systems programming by MarkSweep on Wednesday May 08, 2024 @09:27AM (#40297889)
WPF is not the best example of open source, as some components are still closed source. Though it only runs on Windows, a closed source operating system, so perhaps that is not so important.

https://github.com/dotnet/wpf/issues/2554

That said, there are cross platform, open source .NET UI frameworks out there, including one that is inspired by WPF:

https://avaloniaui.net/

Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @08:09AM (#40297083)
The issue for me with languages like C# is the lack of expressiveness.

Sometimes classes aren’t the abstraction I want to use.

That’s why I like kotlin over Java or c#. It’s be nice to have a language like that which targets .net

Re:The search for easier safe systems programming by estebarb on Wednesday May 08, 2024 @08:31AM (#40297290)
You should try Java and C# again. They have added lambdas and the support for high order functions is quite good. Sure, there is missing some things like guaranteed tail call optimization.
Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @09:27AM (#40297887)
I have tried C# recently.

They have support for these features, but they require some ceremony to use (like wrapping function arguments in a Callable), which increases friction, signal to noise ratio, and decreases the expressiveness that I want.

I just want to write what I want without having to think too much about how the language wants me to write it. Go is good for that. JS too, but has a lot of historical cruft.

Re:The search for easier safe systems programming by kkukshtel on Wednesday May 08, 2024 @04:47PM (#40302577)
I feel like your "recent" must have still been years ago. Modern C# is as terse as Python/TS/Js for basically any equivalent task, if not more so. Dotnet 8 even make the following possible:

var foo = [1,2,3];

Add on switch expressions, primary ctors, first class functions, no ceremony in Program.cs anymore... it's hard to get more terse and expressive unless you want lots of chained single symbol operators (look at F#).

Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @06:02PM (#40303165)
(slight correction: `var foo = [1, 2, 3];` requires natural types for collection literals (it needs to infer the best type for var), this is coming in C# 13 (.NET 9, this November), but otherwise `int[] numbers = [1, 2, 3];` works)
Re:The search for easier safe systems programming by kkukshtel on Thursday May 09, 2024 @11:33AM (#40309289)
You're right! I remember some session where they talked about wanting to infer a natural type for stuff like that but its obviously a big question. But as you said declaring the type directly allows it to work. However the other nice part is that you _can_ do this:

void myFunc(List<int>){}

myFunc([1,2,3]);

The expression sytanx can infer the type from the caller syntax so you can just inline the array declaration.

Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @10:46PM (#40304805)
My recent was a month ago, but to be fair, the CTO of that company (who wrote the existing code when I joined) last wrote production code in 2008, so his code may have not been using those newer syntax features.
Re:The search for easier safe systems programming by kkukshtel on Thursday May 09, 2024 @11:30AM (#40309255)
Yeah it's very easy to write Java style C# that is incredibly verbose and rigid, but once you understand modern c# you can see how it's this really great (imo, awesome) hybrid of functional/typed languages. They've done a ton of syntax work to let types get out of your way when you need them to, with the ability to always fallback to rigidly declaring them when you need better readability.

The downside of all this is that the only people that know how awesome C# is are people who are already doing C#. Growing the pot and trying to convince people to give it a go in its modern (post dotnet 5/"core") iteration is like pulling teeth. Everyone assumes nothing has changed since like C# 2, and given the fact it's a "boring" language that doesn't have Hacker Hype behind it, people just ignore it.

Every week you have people on HN wishing for something that does exactly what C# does but don't want to give it a shot or admit that C# is _actually_ an incredible language and toolset that does exactly what they want (and more).

Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @10:49AM (#40298709)
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @11:02AM (#40298863)
Actually they were made for other languages given the original goal of Common Language Runtime, as published on the 2001 release note.

https://news.microsoft.com/2001/10/22/massive-industry-and-d...

Anyone with the pre-release MSDN .NET SDK that was initially made available to MSFT Partners, with alpha documentation written in red, has a folder with tons of functional languages that could take advantage of tail calls.

F# only came later into the picture, even considering its OCaml for .NET origin.

Re:The search for easier safe systems programming by SirGiggles on Wednesday May 08, 2024 @02:31PM (#40301439)
Not the person you replied to but, today I learned!

As an aside, and as someone who's currently going through materials such as Crafting Interpreters (and who knows what else based on suggestions from r/compilers), is there a, I guess, guide for people who want to implement a compiler that targets the CLR/CLI?

I have a copy of CLR via C# 4th edition, but other than that not sure what else I can reference targeting anything newer than .NET Framework 4

Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @04:37PM (#40302518)
I don't have something that could be of Crafting Interpreters level on hand, but the general suggestion given to this question on DotNetEvolution discord by Roslyn team members was to start with the spec itself: https://ecma-international.org/publications-and-standards/st...

This might be a bit of a learning curve if you don't have experience with writing compilers like that though.

There are other materials that might prove useful should you go down this path:

- A series of blog posts of a student who is writing a Rust to .NET compiler which you could follow along: https://fractalfir.github.io/generated_html/home.html The project itself: https://github.com/FractalFir/rustc_codegen_clr

- A video series on writing a compiler for .NET from scratch: https://www.youtube.com/watch?v=wgHIkdUQbp0&list=PLRAdsfhKI4... Notes: https://github.com/terrajobst/minsk/tree/master/docs

As for CLR via C#, while it has certain facts that remained the same, the ecosystem has changed a lot since then, you really want to target the latest LTS to get best experience and performance. If you liked it, then I can strongly suggest https://github.com/dotnet/runtime/tree/main/docs/design/core... which covers .NET runtime internals.

p.s.: if it's any consolation, the promise in CLR via C# of JIT having the advantage of dynamically profiling code execution and compiling to profile-guided version, tuned to the exact hardware and environment is finally fulfilled, many years later :)

Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @08:13AM (#40297119)
C# offers multiple options for abstracting away functionality. What do you have in mind?

Also, JVM ecosystem does not offer the ability to provide zero-cost abstractions, which C# does with monomorphized generics. This is a hard requirement for productive systems programming if you don't want the C level of verbosity.

Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @08:21AM (#40297193)
> Also, JVM ecosystem does not offer the ability to provide zero-cost abstractions

This is true, wasn’t thinking about that.

C# always requires me to use and organize my code into classes and my data into objects.

For example, If I wanted to use higher order functions, I need to wrap functions in callables (Objects).

If I wanted to throw together a quick script to test, I need to set up a program which uses some magic configurations so that I don’t need that entry point class.

Granted I only worked with C# professionally for a couple of years before getting back to a Go shop, but it always felt like trying to avoid thinking in objects was fighting against the language.

Personally, I like just having first class functions which take simple data structures as arguments. Modeling the world as objects just isn’t as clear to me (the old OOP vs FP discussions)

Languages like C# and Java turn me off for that reason.

Re:The search for easier safe systems programming by prmph on Wednesday May 08, 2024 @08:50AM (#40297538)
Exactly.

I used C# for a long time, and when I started using JS, I marveled at the directness of its expressiveness, its lack of ceremony.

What's actually needed is a language as direct as JS, with the bad parts stripped out, types and a proper standard lib added, and compiled to byte-code for performance.

They can call it a different name if they want.

Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @09:30AM (#40297908)
Yeah that “directness” you’re talking about is what I call “expressiveness”

It’s important for how I like to code.

Re:The search for easier safe systems programming by benji-york on Wednesday May 08, 2024 @02:10PM (#40301222)
You might like AssemblyScript (https://www.assemblyscript.org/)
Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @09:56AM (#40298172)
Are you sure you are talking about C# and not some other language? There is no such thing in C# as "callables". It has lambdas, Funcs and delegates.

It has always had a fair share of FP features and only gained more as it kept evolving. It had higher order functions partially in the form of method group to delegates conversions since C# 2.0, released 19 years ago and to a full extent in the form of lambda expressions since C# 3.0, which also included LINQ, released 17 years ago. It is a mixed-paradigm language.

On the off chance that this is trolling, I must point out that Java and C# are sufficiently distinct, with the latter leaning more heavily on offering both lower and higher level features like extensive pattern matching, LINQ, structs and pointers/byrefs.

If you do have C# snippets you are unhappy with - please post them. There is likely a better way.

(I noticed you posted about Callables twice, and had a quick search - it appears to be a Godot-specific abstraction imposed on C# due to inadequacy of GDScript it has to interoperate with, and has nothing to do with C# itself)

Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @11:05AM (#40298901)
Unity and Godot are both a bless and a sin for C#'s adoption.

In one way, they help the adoption in the games industry, in the other hand they introduce so many anti-patterns with their reflection based SDKs, and use of magical methods instead of proper .NET code.

Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @10:50PM (#40304829)
Callable may have been the wrong word. I think I meant delegate. (I do work with Godot, but not in C#. Some wires must’ve gotten crossed)

Regardless of the actual word, there is an extra thing I need to do to pass a function to a higher order function as an argument.

I was using this as an example to demonstrate how C#’s support for the language features I like require some ceremony which reduce expressiveness and require me to think about the language more.

Re:The search for easier safe systems programming by neonsunset on Thursday May 09, 2024 @01:44AM (#40305607)
You didn’t. The example does not exist and the terms you used don’t apply to C#.

Post an actual example (code).

Re:The search for easier safe systems programming by dartos on Friday May 10, 2024 @08:27AM (#40318158)
Delegate is a C# term and was what I was talking about

https://learn.microsoft.com/en-us/dotnet/csharp/programming-...

I need to create a delegate for any function I want to pass around.

Re:The search for easier safe systems programming by neonsunset on Friday May 10, 2024 @09:04AM (#40318505)
Trolling is bad, consider asking ChatGPT or reading documentation first, thanks.

    var func1 = (int i) => i + i;
    var func2 = () => func1(1) * 2;
    
    Console.WriteLine(func1(4) + func2());
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @09:25AM (#40297869)
Valhala might help there, but yeah, we are still a couple of years away and currently the best is to manually model memory with the new Panama API, definitly not the same league as C# / .NET today, which I consider the closest modern language to what Modula-3 has promised us.
Re:The search for easier safe systems programming by fuzztester on Wednesday May 08, 2024 @09:43AM (#40298034)
In what ways is C# the closest to Modula-3's promises?
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @10:05AM (#40298271)
Now that AOT is part of the standard toolchain, with plenty of Midori, and C++/CLI capabilities also exposed to C# Language level, a memory safe systems language with a modern type system.

I would also place D and Swift into that bucket, only D never managed to really take off when it had the opportunity, and Swift is clearly at home in iDevices.

Re:The search for easier safe systems programming by fuzztester on Wednesday May 08, 2024 @10:31AM (#40298540)
Thanks.
Re:The search for easier safe systems programming by galangalalgol on Wednesday May 08, 2024 @07:10AM (#40296632)
Those are good points, but my problem with c# is that it isn't as performant in Linux. On Linux I'd suggest go as the more performant option. In any case I like both of those so much more than swift. Swift is slower even with bounds checks off. You can't turn them off in go.
Re:The search for easier safe systems programming by aljgz on Wednesday May 08, 2024 @07:49AM (#40296931)
> but my problem with c# is that it isn't as performant in Linux

Any evidence for this? From the benchmark game it seems like c# is more performant than go, and measurements are done on Linux.

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re:The search for easier safe systems programming by galangalalgol on Wednesday May 08, 2024 @08:48AM (#40297506)
I think it is because I generally look at a given benchmark there and don't browse below the "optimized" section to look at solutions that use intrinsics directly. Being able to use intrinsics directly is a great feature, but doesn't fit in with the whole "fast but not so fast I need to worry about safety" theme. When you exclude solutions that use intrinsics, go is faster. I use rust as my daily driver at work and home. I don't think I'd select either go or c# for a project. When I just want something that works, and I'm not worried about performance, rust is easy to use. It is only when I'm trying to squeeze out performance it gets hard. It is hard to convince go that it is safe to skip bounds checks, and while writing intrinsics isn't hard, it isn't very portable and you have to write lots of versions unless you metaprogram it, which I find harder than idiomatic code in any of these languages. Squeezing out performance is easy in c++, even in c++17, but it usually entails doing something that will "probably always be ok". Doing stuff like that repeatedly adds up to frequent issues.
Re:The search for easier safe systems programming by igouy on Wednesday May 08, 2024 @01:52PM (#40301013)
> I generally look at a given benchmark there

Which? Just curious.

Some-of the spectral-norm programs seem quite similar:

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re:The search for easier safe systems programming by galangalalgol on Wednesday May 08, 2024 @03:48PM (#40302138)
Hi! Thanks for the update! I usually look at your curated list of "idiomatic/optimized/non-portable and unsafe" but in the list you noted the c# solutions faster than go had intrinsics.
Re:The search for easier safe systems programming by Thaxll on Wednesday May 08, 2024 @09:18AM (#40297799)
Those benchmarks were debunked, they don't represent anything.
Re:The search for easier safe systems programming by igouy on Wednesday May 08, 2024 @01:42PM (#40300902)
Where were they "debunked" ? Please share.
Re:The search for easier safe systems programming by Thaxll on Wednesday May 08, 2024 @04:27PM (#40302444)
You just need to look at the c# implementation.
Re:The search for easier safe systems programming by igouy on Thursday May 09, 2024 @12:59PM (#40310252)
Re:The search for easier safe systems programming by Lutger on Wednesday May 08, 2024 @07:18AM (#40296685)
The D programming language is mostly this, or could be this, however it has several flaws. It still isn't as polished and doesn't have the ecosystem, and is sort of trying to be Rust, C# and Python at the same time which doesn't always work out that well. But when it does, it is amazing. It also has some crazy and unusually powerful metaprogramming abilities.
Re:The search for easier safe systems programming by farresito on Wednesday May 08, 2024 @06:15AM (#40296264)
I think that's what they are trying to achieve with Mojo.
Re:The search for easier safe systems programming by sa-code on Wednesday May 08, 2024 @06:23AM (#40296316)
Agreed, although the language still feels like a tech demo. They don't even have a package manager yet. I'm curious and hopeful to see what it looks like in a year
Re:The search for easier safe systems programming by mirekrusin on Wednesday May 08, 2024 @07:08AM (#40296625)
They don't yet have `class` support.
Re:The search for easier safe systems programming by sa-code on Wednesday May 08, 2024 @08:30AM (#40297284)
They have their own version called struct which works in a very similar way. I feel like this should be mentioned when saying that `class` support didn't yet exist
Re:The search for easier safe systems programming by mirekrusin on Wednesday May 08, 2024 @11:00AM (#40298845)
Yes, you're right and struct is _the_ interesting part about mojo and is enough to write interesting things in it.

Floodgates will open though once class is also supported.

Re:The search for easier safe systems programming by almostgotcaught on Wednesday May 08, 2024 @08:05AM (#40297054)
"Brought to you by Carl's Jr."
Re:The search for easier safe systems programming by fuzztester on Wednesday May 08, 2024 @09:34AM (#40297951)
Posted this Chris Lattner interview about Mojo to HN yesterday. The video is just 6 days old. It's on the Developer Voices channel.

https://news.ycombinator.com/item?id=40285414

Re:The search for easier safe systems programming by binary132 on Wednesday May 08, 2024 @06:38AM (#40296406)
I mean, Go and Java have those properties, but achieve them using managed runtimes.

The first thing that crossed my mind reading this comment was Nim. It’s pretty Pythonesque (but that’s kinda what I hate about it.)

Re:The search for easier safe systems programming by gwd on Wednesday May 08, 2024 @06:48AM (#40296474)
I love Go, but it certainly doesn't have the safety guarantees that Rust has. You're not going to have a memory leak or use-after-free, due to the garbage collector, but you have nil pointer dereferences and data races.
Re:The search for easier safe systems programming by binary132 on Wednesday May 08, 2024 @08:29AM (#40297266)
Also, data races in Go are trivially addressed using the common pipeline / CSP pattern, since channels are serializing. Of course, it doesn’t eliminate the possibility of doing stupid concurrency things, and you could of course argue that giving users trivially easy concurrency primitives encourages stupid concurrency, but I think it is fair to say that in most cases, Go idioms and primitives make race-free concurrency pretty easy. You have to go out of your way to write racy Go, and there’s nothing really preventing people from going out of their way to write unsafe Rust, either.
Re:The search for easier safe systems programming by angra_mainyu on Wednesday May 08, 2024 @07:42AM (#40296864)
Strange, I've worked on complex projects in the distributed space with Go and it's very easy to catch these things with `-race` and linters.
Re:The search for easier safe systems programming by binary132 on Wednesday May 08, 2024 @08:14AM (#40297131)
nil dereference isn’t unsafe.
Re:The search for easier safe systems programming by imtringued on Thursday May 09, 2024 @02:54AM (#40305919)
It's undefined behaviour, which is even worse!
Re:The search for easier safe systems programming by binary132 on Thursday May 09, 2024 @10:34PM (#40314975)
Nope. Nil deref in Go is checked, and simply panics, just like array access out of bounds.
Re:The search for easier safe systems programming by usrnm on Wednesday May 08, 2024 @07:13AM (#40296650)
I have seen more leaks in the golang project I currently work on than in most C++ codebases I've worked with in my career. It's trivial to leak stuff in golang, and much more difficult to make sure that you don't
Re:The search for easier safe systems programming by binary132 on Wednesday May 08, 2024 @08:10AM (#40297090)
Ok? Is it not trivial to leak in unsafe rust? Managed memory is safety.
Re:The search for easier safe systems programming by pdimitar on Wednesday May 08, 2024 @07:14AM (#40296653)
And it's trivially easy to ignore an error.

Also channels and WaitGroups are easy to misuse (well, that's why there's also an ErrGroup now).

I'd make Golang my 100% go-to language if it got rid of several footguns.

Though let's be real, that's absolutely certain to never happen, they take their backwards compatibility extremely seriously. So we'll have to keep relying on checkers and linters that alleviate some of the pains somewhat.

Re:The search for easier safe systems programming by angra_mainyu on Wednesday May 08, 2024 @07:44AM (#40296883)
I'm not aware of any serious Go project without linting and tests.

In fact, most projects I've worked on won't even merge a PR with ignored errors.

Also, `go test -race` is a Go feature, there's nothing wrong with using it.

Re:The search for easier safe systems programming by dgacmu on Wednesday May 08, 2024 @07:58AM (#40296990)
go test -race is awesome and everyone should use it.

But it's worth remembering that it's a dynamic analysis that only covers access patterns created by your tests.

Re:The search for easier safe systems programming by ddorian43 on Wednesday May 08, 2024 @06:21AM (#40296299)
Isn't Java better than Swift/C# ? (more open, green threads, better ecosystem).
Re:The search for easier safe systems programming by kryptiskt on Wednesday May 08, 2024 @06:52AM (#40296507)
C# has value types, stackalloc, simpler FFI and a rich SIMD API, offering far better control for low-level code than Java. I don't feel green threads is a system level concern, and while Java's ecosystem is huge, it's also very enterprisey. Also, I'd disagree with more open, C# is under a more permissive license and Oracle has actually been litigious over Java.
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @07:09AM (#40296626)
While I also favour C# over Java, the languages, the runtimes it is a bit different, given the wide spectrum of JVM implementations in the wild.

Lets not forget that C# only exists because Sun won the lawsuit over J++, where several C# features were born (J/Direct => P/Invoke, events, JFC => Windows Forms, COM support), and Ext-VOS (the COM next generation runtime) paper refers to J++, before COOL became C#, and J# was introduced as migration path from J++.

Ironically, after all these years, as means to keep Azure relevant for the Java community, Microsoft has become a OpenJDK contributor by acquiring jClarity, including ARM support on Windows, better escape analysis, and has their own distribution.

And VSCode plugins for Java, developed in collaboration with Red-Hat, are much better than C# Dev Kit, without requiring a Microsoft account.

Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @07:24AM (#40296722)
The only features DevKit offers are Visual Studio style solution and test explorers. You don't need either DevKit or a Microsoft account to use base C# extension.

The description is confusing though. I suppose they did the whole "rebrand" thing because for years everyone thought poorly of experience of writing C# in VSC while it has always been semi-decent (depending on your skills) and got better recently, especially after moving to Roslyn-based LSP from Omnisharp.

Re:The search for easier safe systems programming by pjc50 on Wednesday May 08, 2024 @06:50AM (#40296489)
Debateable; I much prefer the dotnet ecosystem, even if it's less open. I suspect green threads vs C# async is another matter of taste as well. Plus Oracle is a much more annoying overlord for Java.
Re:The search for easier safe systems programming by alternatex on Wednesday May 08, 2024 @06:49AM (#40296482)
Someone prefers Java over Swift/C#? Now I've seen everything.
Re:The search for easier safe systems programming by naasking on Wednesday May 08, 2024 @07:02AM (#40296591)
How is Java more open than C#?
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @07:13AM (#40296652)
Its features are driven by a consortium of Java companies, even if Oracle does the majority of the development.

This allows for a spectrum of JVM implementations, where basically any CPU capable of running some form of Java implementation has a JDK available.

https://en.wikipedia.org/wiki/List_of_Java_virtual_machines

Likewise, most frameworks are driven by set of companies, based on industry standards, where .NET due to its culture, most Microsoft shops tend to only adopt what comes from Microsoft.

It is a long discussion problem in the .NET community that when many FOSS projects finally manage to get enterprise adoption, Microsoft ends up coming with their own solution, which said enterprises then switch to, thus killing those FOSS efforts.

Listen to big podcasts like .NET Rocks, where this tends to be often discussed with their guests.

Re:The search for easier safe systems programming by naasking on Wednesday May 08, 2024 @07:30AM (#40296769)
I don't see how any of that means that C# is less open. Microsoft drives C# feature evolution from community feedback, so is that less open than a consortium of commercial interests?

Does Microsoft somehow prevent anyone from developing a CLR implementation for CPUs they don't support? The only reason the JVM is everywhere is because they had first-mover advantage.

How does Microsoft developing their own solution to a problem "kill" FOSS efforts, exactly? Microsoft's solutions are almost all also FOSS. Is competition some kind of inherent problem? Or is a large corporation creating and maintaining FOSS a problem? Why aren't you annoyed at those enterprises that started adopting the original FOSS projects, but didn't contribute dev time to maintaining them? Instead you're annoyed at Microsoft for creating its own FOSS and paying to maintain it for the community for free.

I just find most objections to .NET so bizarre, it's almost always knee-jerk Microsoft hate.

Re:The search for easier safe systems programming by taylodl on Wednesday May 08, 2024 @08:29AM (#40297277)
It's been 25 years since the release of C# and 30 since the release of Java. The fact C# isn't everywhere Java is has nothing to do with "first-mover advantage" as you call it but is due to the fact that C# is open-source software, which is not the same as Free Software. Java, even Oracle's Java, is controlled by the community; .NET is controlled by Microsoft. That's the difference.
Re:The search for easier safe systems programming by naasking on Wednesday May 08, 2024 @10:08AM (#40298296)
C# and VB compiler suite, MIT license: https://github.com/dotnet/roslyn

.NET virtual machine, MIT license: https://github.com/dotnet/runtime

SDK, MIT license: https://github.com/dotnet/sdk

You were saying?

Re:The search for easier safe systems programming by taylodl on Wednesday May 08, 2024 @10:57AM (#40298806)
It's Microsoft-driven, not community-driven. For the past 25 years the Microsoft camp has either never understood, or hasn't cared about, that distinction.
Re:The search for easier safe systems programming by naasking on Wednesday May 08, 2024 @11:44AM (#40299413)
Each of those links shows thousands of contributors not connected to Microsoft, but do go on believing there's no community, or that it's a terrible thing that people rely on Microsoft to produce a free, open source, solid product they can depend on. That's the reason it's Microsoft-driven, because they've mostly been doing just fine as a steward, and it being MIT licensed means MS knows the community can take over if they step too far out of line.
Re:The search for easier safe systems programming by taylodl on Wednesday May 08, 2024 @12:27PM (#40299945)
Not the point. Who's leading? That's the point. Not impressed with your example of a corporate behemoth using free labor. That's the wrong kind of Free.
Re:The search for easier safe systems programming by naasking on Wednesday May 08, 2024 @01:04PM (#40300398)
> Not the point. Who's leading? That's the point.

No, the point is, who cares as long as everyone is happy with the direction?

Re:The search for easier safe systems programming by taylodl on Wednesday May 08, 2024 @03:07PM (#40301777)
Not quite the same thing though, is it? And if you're not happy with the direction then you're stuck.
Re:The search for easier safe systems programming by tcmart14 on Wednesday May 08, 2024 @01:11PM (#40300485)
I think this may be a better way to explain it. Supposed someone comes up with a C# proposal that defines a way to introduce the Result type enum system that Rust has as a replacement for Exceptions. Supposed this is a pretty solid plan, easy transition, we can make a magic button that all the code bases when upgrading to the next version of C# just has to press the magic button and its done. No more expcetions, you now have Result return types. Lets also supposed this proposal has a large amount of the community on board with it. At the end of the day, that proposal will live or die by someone (or some group) at Microsoft.

Now granted, I don't know if it would be different with Java and Oracle. But that is the point. A significant enough change proposal for C#, supposed like above, a change proposal that goes against where Microsoft thinks the development path of C# should be, that is the important bit. So long as contributions and feature request align with Microsoft's interest, its all good, but if the community has large support for a contribution or change request that doesn't align, then it may be different.

Addition: Although arguably, this is true for most languages. Even FOSS languages have some type of leadership that those big shifting proposals will live and die with. Not intending to cast anyone in a bad light, but just a project leader and a project I am familiar with. If a proposal that was as ground shifting as the proposed above was suggested for Zig, whether or not the project does it, the decision of whether to do it may live or die depending on Andrew Kelly or his close knit team of contributors to Zig. Same could be said about Rust, the project has leadership and they could kill a popular proposal. Even outside of languages. The linux kernel, a feature or restructure may live or die by the hand of Linus Torvalds.

Re:The search for easier safe systems programming by naasking on Wednesday May 08, 2024 @02:52PM (#40301636)
> So long as contributions and feature request align with Microsoft's interest, its all good, but if the community has large support for a contribution or change request that doesn't align, then it may be different.

Speculation about what Microsoft may do or may not do in response to community pressure is a weird kind of criticism. I can invent all sorts of fictional boogeymen too. What if Linus has a psychotic break and wants to make the Linux syscall interface mimic the Windows NT kernel?

People would do exactly what I'm suggesting here: fork and continue development without him.

As you also say, leadership means leading, and Microsoft takes backwards compatibility very seriously, and that's why people trust them and use their offerings, sometimes instead of open source offerings.

A change like that would invalidate every tutorial and document ever written about C# over 25 years, so is it really C# anymore? I don't think anyone would make that change. It's simple to fork the MIT licensed C# compiler, call it C* and make that transition in a language that is definitely no longer C#. I just don't think this is a good example.

For good examples, see the language evolution that has actually taken place which has been community driven in many cases. Records, tuples, the evolution of type constraints have all been started from community feedback, and are backwards compatible.

As a final note, a comment on "aligning with Microsoft's interests". They are interested in two things for .NET: selling Azure hosting, and incentivizing Windows programming. Making the software development experience pleasant, robust, predictable and backwards compatible are the objectives, so devs are incentivized to pay them to program on their OS, target your program to their OS, or run your software on their cloud infra. I really don't see the problem.

Re:The search for easier safe systems programming by taylodl on Wednesday May 08, 2024 @03:09PM (#40301795)
Java still has the Java Community Process. Oracle has a thumb on the scale, but it's still a largely community-driven process. The .NET community has nothing even approaching this level of community and openness. Microsoft is in the driver's seat.
Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @01:25PM (#40300663)
Not exactly related to conversation but given that you mentioned (discriminated) unions, here are notes on recent design work:

https://github.com/dotnet/csharplang/blob/main/meetings/2024...

https://github.com/dotnet/csharplang/blob/main/meetings/2024...

Re:The search for easier safe systems programming by tcmart14 on Wednesday May 08, 2024 @02:50PM (#40301612)
Would be really nice to have. I hope we can get it with something like optionals you see in Rust or Swift. And really, with optionals, something like Swift's guard let statements.
Re:The search for easier safe systems programming by cess11 on Wednesday May 08, 2024 @09:56AM (#40298175)
Why would MICROS~1 hate be something bizarre?

I find such hate quite understandable. I might not share it, but I would not put any trust in MICROS~1 either, especially not in a professional setting.

When I develop applications for MICROS~1 platforms, I do it in Java, betting that the Eclipse foundation and a plethora of corporations, including MICROS~1, aren't going to suddenly team up and do something nasty to the language and important libraries. With MICROS~1 as the lone manager of a language and most of its 'ecosystem' this seems like a real risk.

Re:The search for easier safe systems programming by naasking on Wednesday May 08, 2024 @10:10AM (#40298307)
> With MICROS~1 as the lone manager of a language and most of its 'ecosystem' this seems like a real risk.

Why? All of the code is MIT licensed. If MS does anything untoward, forking it is trivial.

Re:The search for easier safe systems programming by cess11 on Wednesday May 08, 2024 @11:15AM (#40299042)
Sure. Organising a community to care for the fork is not.
Re:The search for easier safe systems programming by naasking on Wednesday May 08, 2024 @11:49AM (#40299490)
Ximian and Mono were built almost immediately after .NET was released and provided a decent multiplatform community-supported alternative for years, but you somehow think that forking an existing and working codebase would be more difficult than a completely independent reimplementation?

Look, there are obvious differences in how Java and the JVM are maintained and evolved as compared to .NET, but to continue claiming that these differences really matter all that much is just FUD, to put it politely.

Re:The search for easier safe systems programming by cess11 on Wednesday May 08, 2024 @03:43PM (#40302092)
I made no such comparison.

No, it's not. Is Mono independent today?

Re:The search for easier safe systems programming by Nullabillity on Wednesday May 08, 2024 @03:13PM (#40301819)
So far I haven't had jdb refuse to open because it wasn't running inside of an Oracle-provided mystery meat build of NetBeans.
Re:The search for easier safe systems programming by nickpsecurity on Wednesday May 08, 2024 @02:33PM (#40301449)
Oracle’s lawsuits, esp copyrightable API’s, makes me default on staying away from anything they make. I’d leave any platform they acquire, too. There’s many open platforms whose owners or backers aren’t as aggressive in lawsuits as Oracle is. Many have strong communities of contributors, too.

The only reason I’d use or contribute to Oracle I.P. is if I was paid to do so. The other is porting off Java but that’s legally risky if minima changes. CPAChecker was the one I was thinking of. Past that, I’d try to avoid Java.

Re:The search for easier safe systems programming by brazzy on Wednesday May 08, 2024 @06:59AM (#40296562)
> "Systems programming" is hard, and should be hard, for reasons unrelated to the programming language used.

The question is: is it harder than it needs to be due to accidental complexity[1] in programming language design. TFA argues that there is still some accidental complexity in the design of Rust that leaves room for an "easier" language that still allows the level of control needed for a systems language.

[1] https://medium.com/@sharkaroo/navigating-complexity-in-softw...

Re:The search for easier safe systems programming by dist1ll on Wednesday May 08, 2024 @07:25AM (#40296726)
There's definitely a bunch of accidental complexity in systems programming. Even in domains with extreme performance constraints, large portion of the code base could be expressed with simpler and safer semantics like MVS.
Re:The search for easier safe systems programming by melodyogonna on Wednesday May 08, 2024 @06:42AM (#40296436)
Checkout Mojo
Re:The search for easier safe systems programming by prmph on Wednesday May 08, 2024 @09:02AM (#40297630)
What's actually needed is to start with JS, and:

- Strip out the bad parts.

- Add types, more functional features, a proper standard lib, and a standardized module system.

- Allow compilation directly to performant machine or byte code.

They can call it a different name if they want.

Re:The search for easier safe systems programming by thfuran on Wednesday May 08, 2024 @09:12AM (#40297737)
Why start with JavaScript?
Re:The search for easier safe systems programming by prmph on Wednesday May 08, 2024 @09:24AM (#40297861)
Why not?
Re:The search for easier safe systems programming by thfuran on Wednesday May 08, 2024 @09:39AM (#40297992)
Because it seems so very far away from your goal. What is it bringing to the table that makes it the best starting point?
Re:The search for easier safe systems programming by prmph on Wednesday May 08, 2024 @10:50AM (#40298722)
As a front-end interface, JS is pretty good.

- It has simple, straightforward, and pleasant syntax/semantics. Except for a few tweaks here and there, there is no need to re-invent the wheel here.

- It is pretty functional, all that's needed is to add everything-is-an-expression

- It supports multiple paradigms (functional, imperative, OOP)

- Since it has no types currently, a _modern_ type system can be feasibly added, supporting concepts like result/error instead of exceptions, maybe/option, pattern matching, etc.

- It has easy-to-reason about async features

- It has a huge ecosystem; it shouldn't be hard to port many high-quality packages to a similar language

Now, the lower-level features are another matter entirely, but it shouldn't be too difficult to retrofit what we want, like multi-threading (maybe building on top of workers), utf-8 strings, and so on.

Re:The search for easier safe systems programming by ctxcode on Wednesday May 08, 2024 @02:33PM (#40301450)
If you change the language, you have no ecosystem. You cant say, it has a big ecosystem "if everyone ports their code". By that logic all languages have a big ecosystem. Anyhow. JS has much unexpected strange behaviour, i really would not recommend such a language in 2024.
Re:The search for easier safe systems programming by prmph on Wednesday May 08, 2024 @04:55PM (#40302638)
So let's take out the "unexpected strange behavior", that's what all I'm saying
Re:The search for easier safe systems programming by 63stack on Wednesday May 08, 2024 @08:27PM (#40304075)
With so many sweeping changes you could take any currently popular scripting language as a base.
Re:The search for easier safe systems programming by knighthack on Thursday May 09, 2024 @06:24AM (#40306771)
> It has a huge ecosystem; it shouldn't be hard to port many high-quality packages to a similar language

...Spoken like a person who's never coded anything meaningful or serious, if you can't even gauge the complexity and man-hours needed to create (much less port) high-quality packages between programming languages.

Re:The search for easier safe systems programming by prmph on Thursday May 09, 2024 @06:43AM (#40306861)
No need for that flippant response. You do not know the work I've done, so don't assume I don't know what I'm talking about.

Talking about "man-hours" tells me you think of software engineering like an assembly line, which it is not.

There are whole lot of factors that might influence the time needed for such porting; the keyword in my comment is "similar". If the new language is a superset of the original language, minus a few warts, I'm not sure what should take so much time. For one thing, the architectural design of the packages (which probably took most of the original effort) remains the same.

Re:The search for easier safe systems programming by gumby on Wednesday May 08, 2024 @09:06AM (#40297672)
> What's really lacking are safe, easy, strong typed general purpose languages that can leverage AOT compilation for high performance and static analysis etc.

The funny thing is that MACLISP could do this back in the early 70s. While Lisp is a dynamically typed, GCed language, MACLISP let you annotate variables to promise that they would only be called on certain primitive types, thus supporting compile-time optimizations for numeric code and not necessarily allocate memory, follow a pointer, unbox data etc. This was critical to make packages like MACSYMA run on machines with performance in the KIPS range.

Although languages like Python support similar declarations or annotations, they aren't used in the same way -- if you want performance you write the module in C++ and give it a python interface.

Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @09:16AM (#40297784)
Somehow it is kind of tragedy of this industry, the amount of zig-zag it does between ideas and technologies, until mainstream finally adopts concepts that were already available during its genesis to a iluminated few.
Re:The search for easier safe systems programming by bsder on Wednesday May 08, 2024 @09:41AM (#40298010)
> While Lisp is a dynamically typed, GCed language, MACLISP let you annotate variables to promise that they would only be called on certain primitive types, thus supporting compile-time optimizations for numeric code and not necessarily allocate memory, follow a pointer, unbox data etc.

And woe betide you if you happened to violate the preconditions of one of those annotations. That kind of programming is no better than C with "Segmentation fault. Core dumped."

The problem is that "system programming" or "embedded programming" isn't one thing.

There are people who want to throw around a zillion polygons at 144FPS. There are people who want max performance on x86-64 shoveling around millions of network connections. There are people who need guaranteed real time response or someone dies. There are people who need to stay asleep all the time to conserve battery and only wake up once every 5 minutes to chirp some RF.

These people do not have the same needs in a language yet they almost all wind up shoveled into C.

Re:The search for easier safe systems programming by gumby on Wednesday May 08, 2024 @11:12AM (#40299000)
> And woe betide you if you happened to violate the preconditions of one of those annotations.

Umm, this is MACLISP we're talking about -- you know the types at runtime and can pass the unspecialized argument to an ordinary function. A kind of generic function I suppose, though we didn't use that vocabulary back then.

Just because this was 50 years ago doesn't mean that programmers were morons.

Re:The search for easier safe systems programming by bsder on Wednesday May 08, 2024 @11:01PM (#40304900)
The point of annotations is to avoid having to branch on type at runtime.

Consequently, whatever you sent in was assumed to be what the annotation was. There was no "compilation phase" to ensure that the type at the call point actually matched the type in the annotation. If those differed, then your program would just go boom.

Now, it could be that I'm remembering something other than MACLISP. It's been a lot of years.

Re:The search for easier safe systems programming by gumby on Thursday May 09, 2024 @07:23AM (#40307044)
MACLISP was most definitely a compiled language, it’s just that like modern Lisps you could mix the two (compiled and interpreted code).

I tried to be clear by using the modern terminology “generic function”.

If you compile a function with those annotations you’d end up with two functions: one that could be called if you knew the types at compile time and one that did not.

Re:The search for easier safe systems programming by bsder on Thursday May 09, 2024 @12:00PM (#40309546)
Apparently I am confusing LISPs. My fault.
Re:The search for easier safe systems programming by ModernMech on Wednesday May 08, 2024 @09:45AM (#40298052)
> These people do not have the same needs in a language yet they almost all wind up shoveled into C.

Why is that tho? There are better languages for each of those applications. What do you think, is it business requirements? Hardware? Regulation? Legacy code?

Re:The search for easier safe systems programming by bluGill on Wednesday May 08, 2024 @10:47AM (#40298690)
Are there better languages? What does it even mean to be better?

C is a great choice because I can hire people who know C and get good results. A domain specific language will not be much better than C for any of the above. It turns out that all the hard problems listed above are similar enough that someone good in one will be good in them all and so I can hire C experts from any field and get going fast without having to teach them my domain specific language that isn't really much better.

Re:The search for easier safe systems programming by ModernMech on Wednesday May 08, 2024 @12:25PM (#40299926)
So does that mean you feel programming language design peaked in 1972?
Re:The search for easier safe systems programming by bluGill on Wednesday May 08, 2024 @01:15PM (#40300539)
No. However I think most "modern" languages make a big mistake because they don't address interoperability. Rust is great if you only write in rust, but if you have millions of lines of C++ it is really hard to fix a simple one line of code bug in rust. Rust cannot talk C++ - it can at least talk C but you lose the advantages of rust. Now imagine you have C++, rust, go, and ada teams fighting about which is best - they have to drop down to 1972 C to work with each other. (note that I carefully excluded D since D does have some C++ interoperability)

I do not know the best way for any modern language to take to any other modern language - but 1972 C is a big negative to them all.

Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @03:57PM (#40302222)
Only on Linux and regular UNIX systems.

On other systems we have XPC, COM, AIDL, TIMI, MSIL.

Re:The search for easier safe systems programming by bluGill on Wednesday May 08, 2024 @05:04PM (#40302695)
Trade offs - I'm not familiar with all of those, but the ones I do know of are trading something for that flexibility - generally performance and power consumption - two things that we should not be willing to trade off. You can get similar things from UNIX as well, though it isn't the default and so you need extra effort to use them.

That said I fully accept your correction. (even though it doesn't apply in my world)

Re:The search for easier safe systems programming by nikhilsimha on Wednesday May 08, 2024 @09:15AM (#40297770)
Nim?