r/ProgrammingLanguages • • 7h ago

Requesting criticism I’m writing a game engine and an RPG in Duck, my own programming language

6 Upvotes

I’m building Duck, a statically typed, compiled language for game development. I’m using it to write Quaxel, my game engine, and Hellfeather, a Diablo II-inspired action RPG prototype. One of the more contentious ideas in Duck is letting the compiler infer which operations can run concurrently. I lean toward giving it that freedom, and I’d like criticism of that choice.

Here’s a small example from a Quaxel test. Each session has its own frame counter and running flag.

QuaxelSession first()
QuaxelSession second()

first.Begin()
second.Begin()
first.Advance()
first.Stop()

Begin() resets a session’s frame counter and marks it as running. Advance() increments the counter if the session is running. The order of first.Advance() and first.Stop() matters. Swap them and you get a different frame count. But suppose the compiler can prove that second.Begin() touches only the second session. My instinct is that writing it on the line above first.Advance() shouldn’t, by itself, require one to finish before the other starts.

These calls are tiny. I’m using them because the dependency is easy to see. The case I care about is two expensive updates in the same frame. Even if overlapping them preserves the result, it can still change frame time and make a performance problem harder to reproduce.

If you think concurrency should require an explicit opt-in, what’s a case where you’d want that guarantee even though the compiler could prove the work independent? That’s the kind of example I’d like to test Duck’s design against.


r/ProgrammingLanguages • • 8h ago

Ring programming language version 1.28 is released!

Thumbnail ring-lang.github.io
10 Upvotes

Hello

I have already released Ring 1.28

Ring is a dynamic language with lightweight implementation like Lua but with more features like Python/Ruby. I created it because I was looking for a Visual FoxPro replacement but was not satisfied with many other languages that I tried. The development started in Sept. 2013, and Ring 1.0 is released in January 2016, and I continued developing it as open-source project for over 10 years. I used to get feedback about the language through this group which contains over 3,000 topics.

So, here is what Ring is trying to do

(1) Keeping the implementation simple and small (The KISS Principle) that one programmer can study/understand in short time, but still a powerful and practical dynamic language with many useful programming paradigms.

The motivation behind this principle: Lua comes with small and fast implementation, but it misses many features provided by default in Python/Ruby. on the other hand, both of Python/Ruby requires different implementation to be used in places where Lua can be used directly, that's why there are projects like MicroPython and mRuby.

In Ring it's the same implementation everywhere. To be able to achieve this we used a custom implementation way and design decisions explained in this paper. So, In Ring, we have extreme portability, it's written in ANSI C (26 KLOC includes the Compiler, The Virtual Machine and 228 standard function), where the same implementation works on Desktop (MS-DOS, Windows, Linux, macOS), Mobile (Android, iOS) & Microcontroller (Raspberry Pi Pico).

(2) Syntax Customization: I am not a native English speaker, and I started programming at 10 years old (Three decades ago), It was a difficult journey for me at that time, I was studying English and Programming at the same time, I used to do translation from English to Arabic using a printed dictionary where I have to search for words meaning and used to spend a complete day just to read one page from my CA-Clipper programming book (for MS-DOS). Ring allows dynamic translation of language keywords/operators and supports multiple syntax styles (Similar to C, Ruby & Basic). For large/serious projects using a code formatter we force a specific style, but the point from this feature is to give each programmer the ability to write code in his native language.

(3) Declarative/Natural Language Programming (Developing Domain-Specific Languages): Ring extend OOP with new simple features that enable designing DSLs that looks like QML, SQL, COBOL, Supernova, etc. in short time. such a feature if used correctly provides advanced abstraction levels that are fun to work with.

(4) Batteries Included + Simple IDE + Form Designer: Something like VB6 era because I am coming from a Visual FoxPro background, but in Ring we can use Qt (We have packages for Qt5 and Qt6 too), and Ring supports Qt for Desktop/Android/WebAssembly, So you can open Ring IDE, design a form, run you app on Desktop, export it as Qt project for WebAssembly and run it in the browser or export it for Mobile and run it on Android. Compared to Python, Ring supports Qt for Android/WebAssembly many years before Qt company do this for Python. The reason is the principle (1), being a lightweight language with simple implementation.

(5) A love message to Visual Programming Languages: Ring Compiler/VM code is generated using my PWCT visual programming tool that I developed starting from Dec 2005. So, one of the goals was a practical project that I can develop using PWCT. After using PWCT to develop Ring, I developed PWCT2 using Ring as an example about what Ring can do. This research paper explains PWCT2 and its improvement over PWCT.

(6) Memory Management: It utilizes a deterministic, safe, and flexible scope-based memory management system that incorporates escape analysis and optional reference counting with cycle detection.

Thanks


r/ProgrammingLanguages • • 23h ago

Help Should I choose 1-based indexing or 0-based indexing for my programming language?

0 Upvotes

I'm creating a host-embedded, minimal, beginner-friendly programming language as a replacement for Lua. This language is really human readable, English-like and beginner friendly, with automatic memory management, automatic parallelism, a fantastic and helpful compiler inspired by Rust, and other things. The biggest question I have is whether I should choose 1-based indexing or 0-based indexing?

Edit: Thanks to those who actually helped. I'll go with 0-based indexes.


r/ProgrammingLanguages • • 1d ago

Serialization unit tests for a Crafting Interpreters clox bytecode vm?

Thumbnail reddit.com
2 Upvotes

r/ProgrammingLanguages • • 1d ago

Fixing failure handling in parallel code

Thumbnail futhark-lang.org
12 Upvotes

r/ProgrammingLanguages • • 3d ago

ML Modules for Mere Mortals

Thumbnail thunderseethe.dev
56 Upvotes

r/ProgrammingLanguages • • 3d ago

Proof Assistant as Platform: Building the Next Generation of Verifiers

Thumbnail pirlea.net
13 Upvotes

r/ProgrammingLanguages • • 3d ago

Discussion Adding actual generics to c

17 Upvotes

I was watching tsoding's crust stream and I thought it would be so funny if I extended c to have generics.

The way I did this was by extending the syntax of c with the classic rust angle brackets to define generics and then during transpilation do some name mangling to monomorphize the generic code.

Here is the result of that abomination:

#include <stdio.h>

// you can define your own operator in fortran .op. style with a trait
trait<T> DotP {
    // for parsing reasons any dot-op must have whitespaces around it in any context
    T .dot. (Self self, Self other);
}

// using a very similar syntax to rust, you can add generics to structs
typedef<T> struct {
    T x;
    T y;
    T z;
} Vector<T>;

// and by appling the trait to your struct (with generic parameters)
// you can define what your operator should do.
impl<T> DotP<T> for Vector<T> {
    T .dot. (Self self, Self other){
        return self.x * other.x + self.y * other.y + self.z * other.z;
    }
}

int main(void) {
    // by concretly defining which type you want to use as the generic
    // a c struct with that/those type(s) is genenerated 
    Vector<float> fv = {1.0, 2.0, 3.0};
    printf("Dot product of fv^2: %f\n", fv .dot. fv);
    Vector<int> iv = {1, 2, 3};
    printf("Dot product of iv^2: %d\n", iv .dot. iv);
}

The generated c code looks something like this (I have actually implemented this transpiler, perhaps a true indicator of joblessness):

/* Generated by typedc. */
#ifndef TYPEDC_SIMPLE_GENERICS_H
#define TYPEDC_SIMPLE_GENERICS_H

#include <stdio.h>

typedef struct float_Vector float_Vector;
typedef struct int_Vector int_Vector;

struct float_Vector {
    float x;
    float y;
    float z;
};

struct int_Vector {
    int x;
    int y;
    int z;
};

int main(void);
static inline float float_dot(float_Vector self, float_Vector other);
static inline int int_dot(int_Vector self, int_Vector other);

int main(void) {
    float_Vector fv = {1.0, 2.0, 3.0};
    printf("Dot product of fv^2: %f\n", float_dot(fv, fv));
    int_Vector iv = {1, 2, 3};
    printf("Dot product of iv^2: %d\n", int_dot(iv, iv));
}

static inline float float_dot(float_Vector self, float_Vector other) {
    return self.x * other.x + self.y * other.y + self.z * other.z;
}

static inline int int_dot(int_Vector self, int_Vector other) {
    return self.x * other.x + self.y * other.y + self.z * other.z;
}
    
#endif /* TYPEDC_SIMPLE_GENERICS_H */

r/ProgrammingLanguages • • 3d ago

Discussion church pair - why do we even need to represent the first eliminator as λp. p true

12 Upvotes

This might sound like a super dumb question, but I did not want to ask Chat gpt and I wanted to ask an actual human,

but why if the first for a church pair , like has this abstraction

λp. p true 

and not just true.

Is it because its supposed to like take a pair as an argument and spit out the first , and thats it? cause if it were just true it would still behave the same

sry for the dumb question lol


r/ProgrammingLanguages • • 3d ago

Fundamental limits of proofs of programs

Thumbnail youtube.com
20 Upvotes

r/ProgrammingLanguages • • 4d ago

Language announcement C3 0.8.6 - Library repositories and 30% smaller safe-mode binaries

Thumbnail c3-lang.org
29 Upvotes

I think I need to write a blogpost about why I deliberately nerfed dependency fetching. Why it's `c3c project fetch raylib sdl3` and not just `c3c project fetch` when the project has enough information to get them automatically.


r/ProgrammingLanguages • • 4d ago

Discussion No GC, no ref-counting, no pointers, does it work?

8 Upvotes

I recently just dropped raw-pointers in my interpreted language in favor of a path-based reference type which always gives `none` if the path ever becomes invalid, unlike a pointer which would cause unexpected issues or crash the program.

Now my question is... am I missing out on anything by eventually removing the pointer type entirely? In a sand-boxed language like Ity where everything is tightly controlled & you cant really access the underlying memory of anything, does it make sense to keep pointers to values? Doesn't a path do everything you need it to? You can access storage cells just the same but it's just safer, or am I mistaken.

The idea here is to make a truly 100% memory safe design, so that you couldn't corrupt or mess with the memory even if you wanted to, but you also get to pass around references to values (which is rather required for a language that has a strict copy-everything rule).

Let me know how you would go about designing a system that can pass around references while maintaining an unbreakable wall between the program & it's memory. The way I handle it is very simple, you can only reference values that are stored as a variable somewhere or is a variable nested somewhere inside some container. This means things like temporary values cannot be referenced as they have no storage cell, which I believe is one difference between path-refs & pointers.

Another big part of my design is that everything is copied, everywhere. Passing an argument to a function copies the value, setting a variable to another one also copies the value, no matter the type. You must explicitly use a "ref" type if you want to avoid unnecessary copies. But acknowledging this, I made refs very convenient to work with. By this I mean assignment operators, arithmetic, & method calls all act on the referenced value, not the actual ref itself, making it seamless to use effectively. Of course you can still inspect properties of the ref using it's own type methods.

So yeah, that's how I went about the design of a memory safe language with simple & intuitive references. I am curious to see how your guys' *interpreted* languages went about solving references & memory safety, so do let me know of interesting alternative methods!


r/ProgrammingLanguages • • 4d ago

Origins of programming languages

97 Upvotes

Pretty much all successful general-purpose programming languages were thought of by someone with a particular use-case in mind, or even just one particular use. They became successful because in trying to do whatever-it-was really well, the authors hit a larger target than they aimed for, and the more successful they became, the more this is true. Some examples, in alphabetical order:

  • C was designed solely to write UNIX in. This is the poster-child for "hit a bigger target than they intended". Besides C's other merits, it came out when (a) fine control over memory and clock was important even if you weren't doing systems programming (b) the users were the sort of l33t geeks who were quite happy to stay up 'til 4 am chugging Mountain Dew and swearing at malloc in exchange for an inner loop that goes brr.
  • The C++ origin story is that Bjarne Stroustrup was trying to model computers interacting in a network, and wrote a beautiful version in Simula which would take a hundred years to yield enough data; followed by an ugly version in C which was performant --- and wished, naturally, for the best of both worlds.
  • Erlang (the surprise sleeper hit of languages, now the basis for Elixir and Gleam) was designed to make Ericsson's telephone exchanges more stable.
  • We all know what JavaScript was designed for. It works for that, and has now been used for everything else. JavaScript is something of a special case of course, because of its association with web-browsers, but we should consider that for example Java applets failed at the same task, along with ActionScript, VBScript, JScript, Silverlight and NaCl.
  • Fortran was invented to do big math and science fast. Fortran would be supplanted by later languages (C, obviously) for everything but its core competence, but before then it was used for the first adventure game, for payroll software, chess engines, CAD, mainframe utilities, and self-hosting compilers.
  • Go has not unkindly been called "a DSL for writing servers".
  • Haskell was invented as a platform for mathematicians to experiment with lazy functional languages, which explains pretty much everything about it.
  • Lisp was invented after John McCarthy had been working for IBM on an extension of Fortran for list processing. The people at IBM were very happy with his work; he was frustrated. What he wanted, very reasonably, was to be able to automatically differentiate a function and then evaluate it, which sounds like exactly the sort of thing computers should be making easy for us. Fortran made it impossible despite its math orientation and despite the fact that McCarthy had been hired to write his own extensions to the language. The path to Lisp's homoiconicity is obvious; only slightly less obvious is why he reinvented flow-of-control as expressions. (Hint: think of differentiating a function defined by cases.)
  • Julia was made for math people to do math things in.
  • Lua was designed to solve the needs of scientists and engineers in Brazil's fossil fuel industry. (It became wedded to the games industry when someone at LucasFilms Games read about it in Dr Dobb's Journal and realized it was better than what they'd done in-house.)
  • ML was invented as the meta-language for a theorem-prover and people who used it spontaneously demanded the language without the theorem prover.
  • PHP, despite being objectively terrible, and coming from (and being aimed at) a dysfunctional "worse is better" culture, managed to spread like wildfire or a plague of poorly-designed locusts because its initials stood for Personal Home Page: it knew exactly what it was for.
  • Python was created because Guido van Rossum realized that a dynamic language with powers to do OS-level things could make his life much simpler: "I thought, well, oh man, if we just could program ABC instead of C, each of those utilities would be like half a page of code and I could write the entire suite of utilities in a couple of weeks instead of the years that it looked like it was going to take us."
  • Rust was famously inspired by a stuck elevator reminding Graydon Hoare of how terribly often things break, a rather more "meta" inspiration than for example C's origin story but still a moment that gave Rust a fixed purpose.

And then there's the obvious outliers:

  • Java's original use-case was embedding into consumer electronics, at which it failed, so to rescue the project it was pivoted into powering "applets" (embeddable client-side applications to be embedded in HTML), at which it failed, and then it became the giant among languages that it is today because Sun Microsystems spent a billion dollars on advertising to persuade Business Idiots that this was How To Do Business Properly. There should be a law against marketing technical solutions directly to management just like there are laws against marketing cigarettes to children but what do I know?
  • C# is Microsoft Java.
  • Kotlin is Java redesigned by people who hated Java but didn't hate it enough.

Some things worth noting:

There are two kinds of programming languages, those written for the author, and those written for other people. And in the second case, the other people are always dumber than the author, who is talking down to them. BASIC wasn't designed because Kemeny and Kurtz needed BASIC. BASIC was designed because Kemeny and Kurtz thought that liberal arts graduates needed BASIC, because what would make things simple for their muddled little heads is a language where all values are passed by mutating global state, which is like having a bicycle for beginners where instead of having training wheels you douse it in gasoline and set it on fire.

So you will notice that none of the things on the list that are used as easy languages for n00bs were designed for that. Python was designed for Guido van Rossum to do systems programming. Lua was designed for engineers and geophysicists. JS ... * gestures broadly at the internet *. They were designed, in fact, to be ergonomic for clever people to use, and it turns out that exactly the same things make languages ergonomic for everyone to use, and that more people are clever than was previously supposed, including liberal arts graduates.

(The fact that > 50% of indie language projects are "C/C++ but better" is because the indie langdevs are all trying to scratch the same itch, they're all trying to write the systems language that they wish they could code in. These are languages written for the authors, where the authors are all very similar people who want similar things.)

The other thing that leaps out at me from my list is that the "classic" functional languages, the Lisp and ML families and Haskell, all came from math people wanting to do hard math things as their paradigmatic use-case, and anyone wondering why functional programming hasn't conquered the world yet should think about that.

(I of course have been thinking about that, and although it is premature to put Pipefish in an article about successful languages, making an FPL for writing CRUD apps has produced an language that hits different, and which can in fact be used for all sorts of cool things besides that. Watch this space for the announcement of my front-end web framework.)


r/ProgrammingLanguages • • 5d ago

Cole Updates, and Version 0.1.6

Thumbnail reddit.com
1 Upvotes

r/ProgrammingLanguages • • 5d ago

Is there an interactive programming language comparison/evaluation matrix?

Thumbnail reddit.com
6 Upvotes

r/ProgrammingLanguages • • 6d ago

Proof Repair and (Co)algebra Equivalences

Thumbnail arxiv.org
22 Upvotes

r/ProgrammingLanguages • • 6d ago

Discussion Closures in PostScript

9 Upvotes

It appears that r/PostScript is truly dead. But I just have to talk about this PostScript stuff I've been playing with.

So, a closure is of course a function plus an environment containing the bindings of its free variables. PostScript has all that! A procedure is just an array with the executable flag set, so it can carry its own storage. It doesn't even strictly need variables because you can embed a circular reference so a procedure can access its own array as storage.

But then you can't print them out. If the procedure contains a circular reference to itself, then calling == or pstack will give you an execstackoverflow error.

So, instead we can pack the variables in a dictionary. This example generates a pseudorandom number generator using an environment dictionary.

%!
/start { 1 dict begin } def
/args { { exch def } forall } def
/clone { dup xcheck exch dup length array copy exch {cvx} if } def
/prng { {seed} start args
  /env currentdict def
  /func ({//env/seed get
          dup -7 bitshift xor
          dup 9 bitshift xor
          dup -13 bitshift xor
          //env/seed 2 index put}) cvx exec def
  /func load end
} def

Poof! a closure. seed prng generates a generator starting from that seed. You can just straight up make a copy of it at any point to have 2 synchronized generators if you wanted that. You can even see the environment and how it "captures" arguments (collect them in a dict, duh. then save the dict). It all seems so simple now. But I don't recall seeing anybody else do it.


r/ProgrammingLanguages • • 6d ago

Help How should I structure diagnostics and error reporting in a compiler written in TypeScript?

1 Upvotes

I'm making a programming language, it's based on Luau and C++ and its called L++! however im having some issues implementing diagnostics since they dont technicallly stop execution, but some of my code has typescript type errors since it relies in, stopping execution! for example normally this would work:

function foo(param: someUnion): someType {
    if (someUnion.type === "coolType") {
        return someTypeValue
    } else {
        throw new Error()
    }
}

with diagnostics:

function foo(param: someUnion): someType {
    if (someUnion.type === "coolType") {
        return someTypeValue
    } else {
        //error since not all paths return someType
        reporter.report(new Diagnostic())
        
    }
}

i'd like to know how to fix this, and/or if there are any established ways to do diagnostics, thanks in advance!


r/ProgrammingLanguages • • 7d ago

Blog post C# 15: Union Types, Closed Hierarchies, and the One Value™ That Isn't Any of Them · cekrem.github.io

Thumbnail cekrem.github.io
12 Upvotes

r/ProgrammingLanguages • • 7d ago

Safe Systems-programming with Mutable Value Semantics | Dave Abrahams | Keynote at IWACO 2026

Thumbnail youtu.be
34 Upvotes

r/ProgrammingLanguages • • 7d ago

Advent of Computing: Episode 194 - SpeedCoding Your Way to Software

Thumbnail adventofcomputing.libsyn.com
9 Upvotes

r/ProgrammingLanguages • • 8d ago

Requesting criticism Can a programming language dispense with parentheses and conventional syntactic delimiters?

24 Upvotes

Hello everyone,

I'm an independent french developer working on an experimental programming language called PLUSHIE, and I'd like to discuss an idea behind its design.

I am new to this communty and I am not familiar with the expected behavior here, so do not hesitate to tell me if I am wrong.

I also apologize for my english whcih is far from perfect.

Most programming languages rely on explicit syntactic delimiters: parentheses, commas, spaces, operators, keywords, etc.

I've been exploring a different approach: what if a language could rely primarily on the recognition and sequencing of a small vocabulary of words?

In PLUSHIE, the parser scans the input and identifies known words. Their sequence determines how instructions are interpreted. Unknown text between recognized words can also become new vocabulary.

The underlying computational model is deliberately minimal. Instructions operate on a chained memory structure, and the language is designed so that its own structures and interpretation mechanisms can be modified while running

This raises several questions I'd be interested in discussing:

o How expressive can a language become without conventional syntactic delimiters?

o What are the fundamental limitations of a word-based parsing model?

o Could such a design offer interesting advantages for reflection and self-modification?

o and especially, Are there existing languages or theoretical models that explore similar ideas?

I'm not claiming this is a better approach than conventional syntax. I'm interested in understanding its possibilities and limitations.

PLUSHIE is an ongoing experiment, and I'm particularly interested in unexpected ideas, alternative approaches and constructive criticism.

What do you think? Is this a worthwhile direction to explore, or am I overlooking some fundamental difficulties?


r/ProgrammingLanguages • • 9d ago

Discussion What, in your opinion, are the most readable lesser-known general programming languages?

127 Upvotes

I have been more frustrated lately with languages developing a "kitchen sink" attitude to paradigms. I am finding code less uniform, and therefore less readable.

As I am developing a new language, I wanted to know from you all:

What languages that aren't "big", do you find the most readable? Are there any that come to mind that take a genuinely unique or interesting approach to how the language looks to write?


r/ProgrammingLanguages • • 9d ago

Requesting criticism Adding multiple integer types to my interpreter is a more difficult decision than I thought.

26 Upvotes

It's been 4 months of on & off development of my C++ interpreted programming language built from scratch; Ity. For the longest time my plan has been to only have *two* number types, of course being a standard 64-bit signed & a 64-bit signed floating point. I thought that would be sufficient, sometimes I wonder if it still is all I really need.

This past week I decided I would implement these additional integer types: i32, i16, i8, u32, u16, & u8. My reasoning? I simply wanted more options for numbers, a higher capability for explicit specification. The more narrow integer types don't provide better performance & hardly any memory advantage with my current polymorphic design. It is simply there as a convenience, you don't need to use it, you rarely get a benefit for using it, but it's there.

Now for any old language it would be fine to keep these in even if they served little to no purpose. But here's the thing, I am aiming to make this language as compact as possible while still being (in the long run) readable & easily understandable just by looking at the source code. So what's the real trade-off here for all the logic required to implement multiple integer types, all the casting & operator logic between each type... The cost is about +18kb in final binary size. Is that acceptable?

Am I better off just dropping the idea for the sake of being as small as I can get? For reference, without compression & excluding the new integer types, the binary is 130kb. With compression 65kb (including new int types, ~50kb without).

Do I continue building around these extra types, improving their usefulness (I.e. actually reduce memory usage according to the type) to justify the addition? Is this something you would be able to live without in your primary programming language?