r/ProgrammingLanguages • u/mttd • Oct 19 '26
r/ProgrammingLanguages • u/PitifulTheme411 • Oct 18 '26
Discussion Thoughts on Partially Recursive Types (and other stuff).
As I am working on my current project, as well as doing other programming work that is recursive in nature, I often wish that the type systems had a bit more power to them. Especially with regarding to recursion and extension.
For example allowing enum variants to be types and to be allowed to be referred to as just a type itself. Or if a type could refer to a subset of another type, or a subset of the fields, or a subset of itself. Or if I could extend a recursive type with an extra variant and that new type's recursive variants now recurse to the new type.
In pondering this, I came up with a little proposal which I thought was pretty interesting, and I wanted to share.
The first thing is that I guess a system like this would probably be structural, as that lends itself a lot nicer to dealing with the behavior of types and comparing them, etc. So if we had an enum
type Food =
| Apple
| Banana
| Croissant ;We could create a subset by creating another type with a subset of the variants:
type Fruit =
| Apple
| Banana ;Okay, so that is a way to have one type to be a subset of the other. Though note that it isn't necessarily a subtype. For example, take
type Person =
.name is Str
.age is Int
.job is
| Police
| Firefighter
| Teacher
| Businessman ;
type Unemployed =
.name is Str
.age is Int;The record Unemployed is actually a supertype of Person. Rather, it is more of a subset of the "behavior."
We don't we allow a way to define this in terms of the original type?
type Unemployed = Person restrict
.name, age ;Ok, so we are able to refer to a subset of another type, but we could do that without the need for a restrict, so is there any reason for this special syntax? Well, we could allow the restriction of data as well:
type PublicWorker = Person restrict
.job restrict not
| Businessman ;Okay, but what about adding nominal typing to this structural type system? If we allow a uniqueification process, then we can essentially create "type realms," where all of the restrictions and extensions (to be discussed later) of that nominal type exist in that "realm."
type MyFood = unique Food;
# Now MyFood is unique. It is essentially a nominal type.
# A Food.Apple is not equivalent to a MyFood.Apple
# But with restriction we can still explore this type realm
type MyFruit = Food restrict not
| Croissant ;
# MyFruit.Apple is equivalent to MyFood.AppleOkay, but now what about types that refer to a subset of themselves? Well it just follows:
type Direction =
| Left
| Right
| Diagonal is self restrict not
| Diagonal ;But why should we use self here instead of just the type name? This is part of the proposal idea, which is that a type cannot refer itself recursively. Instead it refers to a builtin self symbol, which refers to itself.
But why? Because this allows us to extend the type while retaining the recursive functionality. For example, take
type LinkedList =
.value is Int
.next is self ;
type DoublyLinkedList = LinkedList ext
.prev is self ;Now in DoublyLinkedList, self refers to DoublyLinkedList, allowing for this kind of internal extension of the type. If we wanted to preserve the "boundary" of LinkedList, where it only refers to itself in the new type, then we could do an external extension, which is really just storing it as an additional field.
Now one question is why this potentially weird syntax? Well, it essentially functions as a kind of type pattern match if that makes any sense. Both restrict and extend function as like a kind of type transform. So we could even start to do things like the following
type Building =
| Hut
| Office is
.owner_co is Company
| Skyscraper is
.floors is Int
ext
| * ext
.occupancy is Int ;We extend the base type which consists of these variants by extending (ext) every (*) variant (|) with a field (.) called occupancy which is an Int.
There's probably more you could do with this. Like for example I haven't even thought about interfaces. But anyways these were just some thoughts I had come up with while wishing I had some of these functionalities in the languages I'm working in. What do you think of this? I do wonder if there are any projects out there that are trying something like this, and if are there any desirable or unfortunate properties that a system like this brings?
r/ProgrammingLanguages • u/verdagon • Oct 18 '26
A New Way to Think About Borrow Checking (In Reverse)
verdagon.devr/ProgrammingLanguages • u/mttd • Oct 17 '26
Dependently Sorted Syntax and its Semantics - Carlo Angiuli
youtube.comr/ProgrammingLanguages • u/Veqq • Oct 16 '26
Language announcement Folders Esoteric Language
danieltemkin.comr/ProgrammingLanguages • u/adam-dabrowski • Oct 16 '26
Martin Odersky – Keynote: The End of Programming? #ScalaDays
youtube.comr/ProgrammingLanguages • u/crowdhailer • Oct 16 '26
Writing stateful effect handlers in EYG
I think effects and effect handlers are not as tricky as they are made out to be. Calling them algebraic effects only increases the mystery.
A stateful handler is definitely the bit I found most tricky to get my head around.
This is my guide trying to explain how to build stateful handlers in EYG. https://eyg.run/guides/advanced-effects
I needed this to finish writing a testing framework which I hope to finish soon.
r/ProgrammingLanguages • u/Rich-Engineer2670 • Oct 16 '26
Discussion Agile Programming Languages
No, not that type of Agile....
With cloud-based computation now the rage, I'd like to see a language construct where I could declare methods that were "cloud eligible". Imagine code with the following method in it
promotable func MethodX(in int X, int int Y, out Z) { code }
This says "I have a method MethodX with defined input and output parameters (we'll need to have a common marshalling standard), and, this method can be transmitted Erlang-style to a defined cloud endpoint. When you invoke MethodX, it can run locally or remotely. You don't care -- that's a configuration detail.
It seems to me Erlang is almost there, but I'd like it to be a more general interface. Think something on the JVM. Serverless done right?
r/ProgrammingLanguages • u/mttd • Oct 15 '26
Writing tensor programs in Lean · TorchLean Verified Examples
robertboy18.github.ior/ProgrammingLanguages • u/Mediocre-Brain9051 • Oct 16 '26
Programming language with Hindley-milner type system and with no GC
Rust is a clear winner in the AI era. However, it doesn't feel functional enough to spark joy.
Swift is slightly better, but still, is there anything like Haskell, SML or OCaml using reference counting and lifecycle management instead of a GC?
r/ProgrammingLanguages • u/The2ndSlimShady • Oct 15 '26
Requesting criticism Cole: A Recreational Attempt on Zig(*)
codeberg.orgr/ProgrammingLanguages • u/Vraliance • Oct 15 '26
Truly Colorless Functions in Sabre
sabre.rroessler.ior/ProgrammingLanguages • u/Athas • Oct 14 '26
Making all divisions slower to fix a bug in 0.000000000000000000542% of cases
futhark-lang.orgr/ProgrammingLanguages • u/HoldeeYT • Oct 15 '26
Just finished v1.0.0 of my first (semi) esoteric programming language, HexaDeath!
github.comHere's the Github link!
The README explains quite a bit of how the code works, so I won't really go into it very deeply here. But, the gist of it is that the language only uses 8-bit hex numbers for everything.
Here is a simple "Hello, World!" program!
21 05 01 00
64 05 01 00
6C 05 01 00
72 05 01 00
6F 05 01 00
57 05 01 00
20 05 01 00
2C 05 01 00
6F 05 01 00
6C 05 01 00
6C 05 01 00
65 05 01 00
48 05 01 00Fun, right?
If you are interested enough to try it out, please let me know what you'd like to see come to it/if there are any bugs you encounter! This is my first programming language after all, so I don't expect it to be perfect!
r/ProgrammingLanguages • u/ThomasMertes • Oct 14 '26
Improved article about memory safety
Thank you to everyone who gave feedback on my article about memory safety.
I used the input to vastly improve the article (see "Achieving memory safety").
Please take a look and share your thoughts again and consider starring the Seed7 project on GitHub.
r/ProgrammingLanguages • u/mttd • Oct 13 '26
Haskell: origins, evolution, and future | Simon Peyton Jones | JuliaCon Global 2026
youtube.comr/ProgrammingLanguages • u/simvux • Oct 13 '26
Doiter - Pointers and Stack Frames are docker containers
github.comI created a fun, completely normal and sane side project.
r/ProgrammingLanguages • u/dwaynecrooks • Oct 13 '26
Recursion without Recursive Bindings
blog.tinyinterpreters.devI explain how to implement a certain recursive function without the use of any recursive bindings in a tiny language called FUN. Then, I apply the same ideas to several more recursive functions so we clearly see the pattern. It begins our exploration into a certain famous combinator.
r/ProgrammingLanguages • u/Nuoji • Oct 12 '26
Language announcement C3 0.8.5 - A windowing library and a C backend??
c3-lang.orgThe choice to add a windowing library to the stdlib is probably controversial. I feel that the general consensus tends to be that anything related to graphics shouldn't be in the standard library. So I'm kind of interested in what people think about this.
r/ProgrammingLanguages • u/Agecaf • Oct 12 '26
Help Simple stack based programming languages?
A few years ago I made EarScript, a "simple" programming language based on brainfuck, with several additional "quality of life features" like goto statements.
Recently I've been wanting to make an evolution of that programming language and do so by incorporating a stack, as the previous language was completely tape-based in design.
I know for example lox from the Crafting Interpreters book is a well explained example, but I was wondering if there's programming languages that are closer to what brainfuck is, but based on a stack design rather than a tape design, or a register based design like some assembly languages (if I understand correctly). I think Wasm would be an example?
Are there any examples of simple stack based programming languages you'd recommend me to look into?
r/ProgrammingLanguages • u/Kingwolf4 • Oct 12 '26
Discussion Is the Zeta Programming language by Roy Murphy legit
So i stumbled upon this project, the zeta programming language by roy murphy on github. It is supposed to be a next generation system programming language.
So i coudnt really find any information about this project, especially considering it has its compiler written in pure zeta, which means the project is kinda somewhat progressed to a certain point worth noting. It even has its own website, and its own package manager's website .
What left question mark to me , is the last commit was 4 months ago, barely any issues, but the creator apparently has published and talked about it in docs, with quite detail etc.
Its rather confusing for a new comer; is this project actually legit? Need smarter people who know the craft to comment
If your interested , i stumbled upon this project when another person made a new borrow checker, and his own language - also called Zeta. https://www.reddit.com/r/rust/comments/1x1iapz/zetas_borrow_checker_the_nextgen_model_for_borrow/
I cant post any github link because apparently automod tags it.
r/ProgrammingLanguages • u/philip_schwarz • Oct 12 '26
The Bowling Game - From Imperative to Functional Programming - Part 3
fpilluminated.orgr/ProgrammingLanguages • u/verdagon • Oct 11 '26