News for hackers. Stuff that matters.
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)