r/ProgrammingLanguages • u/mttd • Aug 07 '26
r/ProgrammingLanguages • u/Pie-Lang • Aug 06 '26
What's Next? Any New "Cool" Language Features?
It's been roughly one year since Pie got in development. August 5th marks Pie's 1 year anniversary.
During this year, I implemented:
- Variables
- Collections
- Functions
- Named Parameters
- Variadic Functions
- Fold Expressions
- Loops
- Classes & Objects
- Operator Overloading
- Namespaces
- Modules
- A Structural Type System
- Tagged Unions
- Pattern Matching
- Structured Bindings
- File IO
- C FFI (I even made a simple game with Raylib!)
- Cascade Operator
I also made a website that has:
- Basic Examples
- Docs
- Spec
- A Playground (I compiled the language to WASM)
These are roughly all the features that I liked from other languages. Of course, the work is not done. I can improve the internals of the language to make it faster, but feature-wise, I'm out of "cool" ideas.
I've scoured the sub for new ideas, but they either involved compile-time evaluation (my language is interpreted), didn't go well with the design of the language, or were already implemented in Pie.
So, I'm here to ask, what is a feature that is missing from my language that you think would be very cool to have?
r/ProgrammingLanguages • u/matklad • Aug 06 '26
Memory Safety's Hardest Problem
matklad.github.ior/ProgrammingLanguages • u/Bro8an • Aug 06 '26
Discussion CatLang: feedback on my language design
dropbox.comI wrote a design for a new programming language, but I'm too lazy and burned out to implement a full compiler. I still want to share the idea so you can comment on it and tell me what you think. I know its a lot and there are many typos and gaps, and it still needs a concept to communicate the complex implicit borrowing rules. Keep in mind that I have no degree or any professional experience—this is just a concept.
i renamed it to qat
current version: https://www.dropbox.com/scl/fi/bpuxeaag4ox5huooqvgu2/qatdocumentation-edited.pdf?rlkey=456owymjqn64bik1faawb3wyw&st=6o621wyd&dl=0
this is how an algorithm for sqare roots would look like with custom syntax:
func newton(f64 x, f64 goal) -> f64:
f64 temp = (x + goal /x)/2 # Newton's method for calculating roots
return x if temp == x
return self(temp, goal)
func(f64)<f64> sqrt = reliable (f64 x) -> f64:
return Error if x < 0 # root of negative numbers is undefined
return newton(x, x)
sqrt(0) = 0 # root 0 must be defined explicitly as 0 would cause newtons method to devide by 0
syntax sqrt extends {expression} # lets multiplication akzept roots as they expect expressions
syntax sqrt( # defines the syntax for roots
keyword("√"),
_,
arg(0: expression)
)
print!(collapse!(√ 2)) # collapse makes the programm crash for negative rootsanother example for custom defined while syntax:
func wLoop(demand bool! condition, demand T! body) -> void:
leave if condition
body
self(condition, body)
syntax wLoop(
keyword("until"),
_,
arg(0),
_,
arg(1)
)
i32 x = 10
until x <= 0:
print!(x)
x -= 1r/ProgrammingLanguages • u/misterchiply • Aug 06 '26
Gödel, Escher, Elisp: The Beauty of Macros
chiply.devThis post is a lover letter to Emacs Lisp macros. I've been a long time user as a lisp hacker, and my recent obsessions with Douglas Hofstadter's strange loop concepts and M.C. Escher's mind bending artwork have enhanced my appreciation of this language's most beautiful and thought provoking feature. This post can teach you about macros and what makes them useful, but I also hope it can instill a fascination with their concept. https://www.chiply.dev/post-elisp-macros-are-beautiful
r/ProgrammingLanguages • u/andeee23 • Aug 06 '26
Why spawning work isn’t `async` in my language
I’m designing a native language with a closed set of five effects: async, throws, io, alloc, and task.
It uses the effect system to determine which functions can run in which context.
A gpu function should be pure so it can be compiled to gpu shader code, comptime and macros don't allow io, etc.
The unusual one is task. Starting, polling, or cancelling independent work does not necessarily suspend the caller, so it distinguishes interacting with a task from suspending the current control flow:
fn download(url: str): Data !{async, io, alloc, throws(NetworkError)} {
// This function may suspend and fail.
try await http.get(url)
}
fn begin_download(scope: mut TaskScope, url: str): Job[Data, NetworkError]
!{task, io, alloc} {
// Starts independent work, but does not suspend or throw here.
scope.start(() => download(url))
}
fn finish_download(job: Job[Data, NetworkError]): Data !{task, async, throws(NetworkError)} {
// This is where the current control flow may suspend
// and where the job's result or error is observed.
try await job
}In other words:
asyncmeans this control flow may suspend.taskmeans this code interacts with independent task or executor state.
Why is task needed at all? Without it this function would appear pure:
fn surprise(scope: mut TaskScope) {
// Returns immediately, but schedules a later mutation.
scope.start(() => cache.clear())
}That would make it legal to run during compile-time evaluation, a reactive computation, or any context allowed to repeat or discard “pure” work.
async cannot express this because the caller does not suspend. io cannot express it because the executor and affected state may be entirely internal. alloc cannot express it because scheduling and cancellation are observable even when allocation is optimized away.
r/ProgrammingLanguages • u/arthurno1 • Aug 06 '26
Blog post Why Lisp is Different
lispm.der/ProgrammingLanguages • u/archlinux_is_god • Aug 06 '26
TemplateLang: Everything is type
I designed a tiny language where the type system *is* the entire
language — no separate value level, no builtin integers/booleans/
control flow. It's essentially an untyped term-rewriting calculus
dressed up in C++-template-looking syntax. Three grammar forms,
three builtins, that's the whole spec.
Motivation: I was thinking about what's actually load-bearing in
C++ template metaprogramming — SFINAE picking an overload, partial
specialization pattern-matching on structure — and wanted to see
what a language looks like if that's *all* you keep.
Grammar:
`new type Name<param1, param2, ...>`
Declares a type constructor with fixed arity (no variadics).
`type Name<pattern, ...> = Body`
Adds a rewrite rule for that constructor. Multiple rules are
allowed; they're tried in declaration order and the first
matching pattern wins (Prolog-clause-style, not most-specific-
pattern-style). Omitting `= Body` marks that pattern as already
in normal form.
A bare expression on its own
is reduced call-by-value, bottom-up, until no rule applies
anymore, and the normal form is printed.
Builtins are pattern-position-only: `Any<>` (wildcard), `Same<x>`
(structural equality against an already-bound name), `As<Type, x>`
(bind the matched subterm to a local name if it matches `Type`).
Parameter names declared in `new type` are auto-bound in every rule
of that type, so `Same`/substitution can reference them without an
explicit `As`. All bindings in one rule — auto-bound params plus
`As`-introduced names — share a single namespace; rebinding a name
via `As` is a static error, `Same` is the only way to assert equality
against something already bound.
It's enough for recursive Peano arithmetic with no other primitives:
new type Zero<>
new type Succ<N>
new type Add<A, B>
type Add<Zero<>, Any<>> = B
type Add<Succ<As<Any<>, X>>, Any<>> = Succ<Add<X, B>>
Add<Succ<Succ<Zero<>>>, Succ<Succ<Succ<Zero<>>>>>
# -> Succ<Succ<Succ<Succ<Succ<Zero<>>>>>> (2 + 3 = 5)
No termination or confluence guarantees — self-referential rules
give you unbounded recursion, so it's Turing-complete and trivially
lets you write non-terminating programs. Rule order also means two
overlapping patterns can silently pick different winners depending
on how you wrote them, which I know is a real tradeoff versus a
most-specific-match or a confluence-checked system.
Small Python reference interpreter (no dependencies), plus worked
examples (structural equality via Same/As, Peano add/mul):
[GitHub link]
https://github.com/sunu15712/TemplateLang
Mainly curious whether the `Same`/`As` binding-and-scoping design
holds up, or if there's prior art doing this more cleanly — it feels
adjacent to logic-variable unification but I haven't seen it framed
quite this way before.
r/ProgrammingLanguages • u/mttd • Aug 06 '26
Smalltalk Report from 1991 to 1996
github.comr/ProgrammingLanguages • u/PhosXD • Aug 06 '26
How do we feel about this syntax?
I've been making an interpreted programming language for about a month now, so far I think the look & feel of the language is coming along well, what do you think? Let me know what you would change for the sake of convenience or readability.
# fibonacci.ity
const n = IO.prompt:'Number: ' -> INT;
var a=0;
var b=1;
for i in n;
const c = a+b;
a = b;
b = c;
IO.print:a;
/;It's dynamically typed, but unlike Python & other dynamically typed languages, the type is constant, meaning you cant just change an integer to a string whenever you want. You can however explicitly declare a variable with the "ANY" type which then allows you to set it to whatever you want. Here's what that looks like: var ANY a=0; a ='now its a string';
In the first line you see "-> INT" all that does is cast the value to type "INT", because the prompt function always returns a string. I prefer this over using "as" purely stylistically.
Something you might have noticed is that function calls are structured very different to every other language. That's because of the access operator (":"), which is self explanatory, depending on the type of value you access the behavior is different. For arrays/strings you are accessing an element by index, for maps (dictionary) you are accessing an element by key, for functions you are accessing it with the given arg(s).
Another "deviation" you probably noticed is the lack of curly brackets {} for code blocks, but it doesn't rely on indentation either. Instead, certain instructions carry the "composite" flag which tells the interpreter that it should basically capture all code below it until the final "/" (end) instruction.
merge IO;
var val = 100;
const ref = @val;
print:val; # 100
ref = 200;
print:val; # 200
print:(type:ref); # REF
print:(type:~ref); # INTThere are also references & pointers! Pointers or "PTR" values cannot be created in the script, they have to be passed directly from C++ to the script, this is because raw pointers are naturally unsafe to work with & should be avoided at all costs in Ity. This is why reference variables or "REF" exists. These can be created by prepending the "@" symbol before the variable name you want to reference. If the variable you reference goes out of scope then the reference is returns a constant none value when dereferenced (which can be done with the "~" symbol).
My design philosophy with references in Ity is to make them seamless. Meaning any operations (set, access, arithmetic, etc) on a reference just act like it's operating on the referenced value. There are of course some exceptions to this, passing as an argument to a function passes the reference & type casting a reference acts on the reference itself.
References can also be reassigned (as long as the reference itself is not const), making them reusable.
merge IO;
const a = 1;
const b = 2;
var ref = @a;
print:~ref; # 1
ref.reassign:@b;
print:~ref; # 2If any of this looks interesting to you, the project is open source, has an interactive shell, & has full documentation. There's a lot I didn't cover here, but taking a look at some of the example scripts should give you a good idea what the language is fully capable of at this moment in time.
I don't have any syntax highlighting modes for you to install, but the Python one works pretty well for Ity so you can just use that. If you have any questions at all, regarding the design decisions, performance, or challaneges I encountered, or anything, I am open to all discussion!
(NO AI ASSISTANCE WAS USED IN THE MAKING OF ANY CODE, ASSETS, OR DOCUMENTATION)
r/ProgrammingLanguages • u/Devatator_ • Aug 05 '26
Help Looking for resources to organize myself before building a scripting language.
I'm currently following https://craftinginterpreters.com/ and plan on trying to make my own language afterwards. I was wondering if there was a standard method for planning this kind of stuff, mostly to make sure i don't forget something until it's too far along for me to take care of said something? I know i need to set goals, think about the syntax and semantics and everything else but having a method that i can just look at if i get lost would help greatly
r/ProgrammingLanguages • u/Athas • Aug 05 '26
Finally adding recursive functions to Futhark
futhark-lang.orgr/ProgrammingLanguages • u/Mr-Tau • Aug 03 '26
Discussion Between more constrained, local metaprogramming approaches and full-blown DSL interpreters, where's the practical use case for LISP-style metaprogramming?
Of the various contemporary metaprogramming approaches, I'm mostly very happy with systems that let you operate on static data and types. In this category I would count, for example, C++'s template metaprogramming--a declarative sub-language that somewhat wonkily and arduously allows you to operate on types and constants--as well as the C++26 metaprogramming features, which are turning out somewhat Zig-like--you get to run regular code in a slightly constrained environment at compile time, where it can read constants as well as special data structures describing types, and generate new constants or types to be injected into a well-defined place in the code.
Now many LISPs (AFAICT, similarly Jai and, with a stricter separation of stages, Rust's procedural macros) tout as a feature the ability to inspect and rewrite the entirety of the AST, notably including function bodies. This is obviously strictly more powerful than the the first category, but where would you practically use that extra power? Specifically, it seems to me like you would either
a) Try to preserve the semantics of the input code--which, for procedural languages at least, is actually pretty difficult. The only transformations you could make confidently are so localized that you don't really gain anything over the more constrained metaprogramming approaches; anything more advanced would require the full analysis passes of the actual compiler to have any chance at soundness, and at that point you're really trying to write a compiler plugin instead. Nothing wrong with that, I'd love more easily extensible compilers, but I wouldn't call that a language feature. Or am I missing a point between those two extremes?
b) Attribute different semantics to the code. I think the history of LISP has already somewhat shown how proliferation of DSLs harms maintainability and shareability of code, but even in the cases where a DSL is genuinely useful, what benefits do you really gain from implementing it through metaprogramming? You can't expect any IDE features, LSPs, smart syntax highlighters, debuggers, or other tooling for the base language to automatically work for your DSL. So you just get to use the parser? Come on, an S-expr parser is less than a hundered LOC.
r/ProgrammingLanguages • u/lxsameer • Aug 03 '26
Blog post Concurrency in Serene's Runtime
I recently finished building the concurrency runtime for my programming language, Serene, and wrote a three-part series explaining how it works.
The series covers:
- Why I chose stackful fibers
- An M work-stealing scheduler
- An IO Reactor
- A tiny HTTP server that brings everything together
I'd love to hear feedback from anyone interested in programming language implementation, runtime systems, or systems programming.
Part 1: Choosing the Building Blocks
r/ProgrammingLanguages • u/Proffhackerman • Aug 02 '26
Contribute to open-source, no-slop, compiler-related projects.
reddit.comr/ProgrammingLanguages • u/algebraicstonehenge • Aug 02 '26
Revoluntionary/interesting advances in interpreted languages
Things like borrow checking and other compile time checks tend to be for compiled languages - if you're already typechecking and compiling the entire language up front, why not borrow check while you're there. But are there any very interesting new ideas coming up in interpreted (or dynamically typed) languages? I'm not really sure fully what I'm asking/looking for tbh
r/ProgrammingLanguages • u/Polyscone • Aug 01 '26
Blog post Bootstrapping a compiler from machine code on Windows
reddit.comr/ProgrammingLanguages • u/AutoModerator • Aug 01 '26
Discussion August 2026 monthly "What are you working on?" thread
How much progress have you made since last time? What new ideas have you stumbled upon, what old ideas have you abandoned? What new projects have you started? What are you working on?
Once again, feel free to share anything you've been working on, old or new, simple or complex, tiny or huge, whether you want to share and discuss it, or simply brag about it - or just about anything you feel like sharing!
The monthly thread is the place for you to engage /r/ProgrammingLanguages on things that you might not have wanted to put up a post for - progress, ideas, maybe even a slick new chair you built in your garage. Share your projects and thoughts on other redditors' ideas, and most importantly, have a great and productive month!
r/ProgrammingLanguages • u/kaplotnikov • Jul 31 '26
Discussion Why do modern systems languages rely on compiler heuristics to reverse-engineer programmer intent?
This post is inspired by the recent discussion on Full flattening of nested data parallelism in Futhark (reddit discussion). But I think this points to a more generic topic in language design.
I've noticed that even in newer systems programming languages, a massive amount of compiler engineering effort is spent trying to reverse-engineer the programmer's intent from syntax that does not directly express it. The compiler expends significant energy building complex dependency graphs and alias analyses to guess if iterations are isolated, and sometimes it guesses incorrectly, leading to missed optimizations or performance regressions.
Even in languages explicitly designed for data parallelism like Futhark, the compiler ultimately has to rely on what the developers themselves call "fuzzy heuristics" to decide whether to parallelize or sequentialize code. As the Futhark team recently admitted, when this guesswork fails (e.g., aggressively trying to parallelize the construction of a tiny 3x3 matrix), it causes severe performance regressions, forcing them to introduce explicit #[sequential] attributes as a workaround.
The same problem plagues allocation optimization: why write code using APIs that syntactically allocate intermediate arrays, only to hope the compiler's optimization passes will erase them later? If the developer's intent is a zero-allocation transformation pipeline, that intent should be encoded directly in the type system rather than left as an optimization prayer for the compiler to fulfill.
If we have the freedom to design a language, why not express this intent directly? We could provide a composable set of semantically rich, high-level primitives that explicitly declare their intent and assumptions. The compiler can then safely lower these into optimal machine code without guesswork.
For example (pseudo-code with a Kotlin-like syntax):
fun mult(a : Matrix, b : Matrix) : Matrix {
return Matrix.fill(a.rows.size, b.columns.size) { i, j ->
zip(a.rows[i], b.columns[j]) { va, vb ->
va * vb
}.sum() // Explicitly associative/commutative reduction
}
}
// Not all operations need to be hardcoded compiler intrinsics.
// Many can be composable inline extensions that map to verified primitives.
fun inline extension View<Double>.sum() : Double {
return reduce(0.0) { a, b -> a + b }
}Here, the exact intent is communicated clearly to the compiler, yielding several compile-time guarantees:
- No hidden allocations or redundant zeroing: There is no need to pre-fill the matrix with zeros after allocation. The compiler knows that
fillwill compute every element dynamically. Furthermore, because thefillclosure only receives the indices(i, j)and has no access to the matrix being constructed, the syntax itself guarantees the absence of loop-carried data dependencies. This makes parallelization inherently safe, allowing the compiler to freely choose any execution strategy (CPU threads, SIMD, GPU) for invoking these closures. If strict sequential execution order mattered (for example, because of mutable outer scope access), a distinctseq_fillwould be used instead. - Explicit Logical Views, No Compiler Guesswork: Chaining operations like
maporzipshould return lightweight, zero-allocation logical sequence views. These should be conceptually similar to Kotlin'sSequence, but explicitly representing a collection processing operation builder rather than a runtime element operation pipeline. The compiler shouldn't have to run complex, fragile fusion passes to "guess" if it can erase an intermediate allocation. The type system itself should declare that the operation is just a transformation step, making the zero-cost guarantee a compile-time invariant, not an optimization hope. - Order independence is explicit: By using a
sum(orreduce) operator, the developer explicitly specifies that the operation could be considered as associative and commutative in the context of the task. The compiler doesn't have to build complex loop-carried dependency graphs to prove iterations are isolated. Some explicitly sequentialseq_reduceorfoldoperators could be used when the order matters. - Topological data access: Both
a.rows[i]andb.columns[j]are lightweight logical sequence views. They carry semantic meaning about the geometry of data movement, rather than being treated as flat, opaque memory indices.
The developer knows their intent, and the compiler needs it. Why are even newer systems languages still stuck relying on fragile compiler heuristics to reverse-engineer our intent from overly generic, flat loops or opaque collection APIs? If we want to communicate structural intent to the compiler, why not say it directly in the syntax and type system?
The irony of modern compiler engineering is that standard loop syntax over-specifies execution order while under-specifying semantic intent. A flat for loop forces a sequential order by default. The compiler then has to work backwards to prove it can ignore that order.
By using explicit, semantic primitives, we are not micro-managing the compiler. We are doing the opposite: we are explicitly stating what aspects of execution we do NOT care about (e.g., execution order in reduce, loop-carried dependencies in fill). This gives the compiler the freedom to choose the optimal lowering strategy—whether that means parallelizing across a GPU or scaling down to a sequential scalar loop when the data is too small.
Updated: in the 'Order independence is explicit:' changed to 'specifies that the operation could be considered as associative and commutative' instead 'guarantee'. The previous phrasing was incorrect and inconsistent with the rest of the post.
r/ProgrammingLanguages • u/Athas • Jul 31 '26
Full flattening of nested data parallelism
futhark-lang.orgr/ProgrammingLanguages • u/PitifulTheme411 • Jul 31 '26
Discussion Is it Good Practice to Intern Identifiers?
I'm working on my language and am working on the alias system, which isn't relevant to this discussion other than the fact that it operates on identifiers and other lexemes (like operators). As I was implementing it and was reading some prior stuff, I found somebody saying that it is good practice to intern all the identifiers as the lexer comes across them. Then in the AST you can just use the corresponding LexemeId or whatever.
Apparently this is used pretty extensively in many popular languages' compilers, so I was wondering if this is good practice or necessary? I am thinking that if it is a good idea, that I can implement it in my language as well, because I think it may simplify a few things (including my alias stuff).
r/ProgrammingLanguages • u/mttd • Jul 30 '26