Critique my idea for a language
from tatterdemalion@programming.dev to programming_languages@programming.dev on 31 Jan 2024 21:58
https://programming.dev/post/9391176

I’ve never felt the urge to make a PL until recently. I’ve been quite happy with a combination of Rust and Julia for most things, but after learning more about BEAM languages, LEAN4, Zig’s comptime, and some newer languages implementing algebraic effects, I think I at least have a compelling set of features I would like to see in a new language. All of these features are inspired by actual problems I have programming today.

I want to make a language that achieves the following (non-exhaustive):

I think with this feature set, we would have a pretty awesome language for working in data-driven systems, which seems to be increasingly common today.

One thing I can’t decide yet, mostly due to ignorance, is whether it’s worth it to implement algebraic effects or monads. I’m pretty convinced that effects, if done well, would be strictly better than monads, but I’m not sure how feasible it is to incorporate effects into a type system without requiring a lot of syntactical overhead. I’m hoping most effects can be inferred.

I’m also nervous that if I add too many static analysis features, compile times will suffer. It’s really important to me that compile times are productive.

Anyway, I’m just curious if anyone thinks this would be worth implementing. I know it’s totally unbaked, so it’s hard to say, but maybe it’s already possible to spot issues with the idea, or suggest improvements. Or maybe you already know of a language that solves all of these problems.

#programming_languages

threaded - newest

librecat@lemmy.basedcount.com on 01 Feb 2024 03:23 next collapse

I would like to use or at least try a language like this, especially if GC is optional.

tatterdemalion@programming.dev on 01 Feb 2024 03:45 collapse

Yea I’m not sure exactly how much control of the GC would be possible, but having multiple options seems like a reasonable approach. Languages with RAII usually rely on scoping, reference counting, and arenas, so I would provide those in addition to a more “global” garbage collector.

spartanatreyu@programming.dev on 01 Feb 2024 03:57 next collapse

Not to give you a definitive answer, but you’d probably be really interested in Vale.

It’s still early days, but there’s a lot of clever ideas that most languages can’t take advantage of that you’d probably be really interested in.

There’s only one core developer (who is currently on a temporary medical break), but there’s a lot of programming language theory discussion in the discord.

jasperwilde09@programming.dev on 02 Feb 2024 04:30 next collapse

@enneagram test I think the decision between algebraic effects and monads depends on the specific goals of your language and the trade-offs you are willing to make. Both have their strengths, and the choice may impact the language’s learning curve and expressiveness.

tatterdemalion@programming.dev on 02 Feb 2024 07:47 collapse

My current understanding is that effects solve the composability problem of monads, but I’ve not been enthusiastic about the syntax I’ve seen in Koka or Unison.

There have been multiple times while writing Rust when I needed to use two different monads together and they didn’t quite have the API I needed to compose them. But I wouldn’t say it’s a core issue with the language, just a small inelegance.

Corbin@programming.dev on 22 Feb 2024 18:23 collapse

What’s your intended underlying formalism? How are actors specified and what will their type signatures be? (On this second point, see this article and my comment.)

What do your modules look like? Can they be compiled separately? How expensive is linking? You’ll need to figure this out if you want to compile faster than Rust or C++.

For inspiration, I am obligated to mention my language Monte, an ergonomic flavor of E; my JIT for Monte outperforms Python, an explicit design goal. However, your desires remind me more of Wyvern, which is statically typed and effect-oriented.

Welcome to the world of actor languages! I invite you to also study capability theory while designing your language. Start with the story of the confused deputy and then dig into the E archeological dig site.

tatterdemalion@programming.dev on 11 Mar 2024 07:03 collapse

Not sure if your questions are rhetorical or not. I’m not at the point of being able to answer them in detail, but I appreciate your direction.

What’s your intended underlying formalism?

I don’t know. I’m not well-studied in language theory.

What do your modules look like? Can they be compiled separately? How expensive is linking? You’ll need to figure this out if you want to compile faster than Rust or C++.

No spec yet, but there would certainly be some independent compilation step into an IR which would need to be linked with other modules later. No clue how expensive linking would be. I haven’t implemented any of this yet, it’s just an idea. But I appreciate the tip that linking will have a large performance impact.

Thank you for pointing me to some relevant languages I had not heard of.

Corbin@programming.dev on 11 Mar 2024 21:13 collapse

My questions are serious and you should eventually be able to answer them, but right now it’s okay to think of them as guides and you don’t have to justify yourself to me. I think what you’re doing is fun; but if you want anybody to use your language, then you should be prepared for the language checklist.

Your formalism will matter a lot for performance. You should at least know about abstract machines, which are how C, C++, Java, and Rust achieve impressive runtime performance; they all are defined such that their compilers can optimize based on abstract behaviors and those abstractions are relatively lightweight to map to physical hardware. There are also approaches based on wrapping – taming – the lowest-level parts of the hardware to add various safety properties; after wrapping, various components can be composed directly with respect to those properties.

tatterdemalion@programming.dev on 12 Mar 2024 03:05 collapse

and those abstractions are relatively lightweight to map to physical hardware

Or in the case of Java, a virtual machine. A VM would be my preferred approach to keep things simple at the outset.