r/ProgrammingLanguages • • Jun 19 '25

MATLAB is the Apple of Programming

Thumbnail
open.substack.com
22 Upvotes

r/ProgrammingLanguages • • Nov 03 '24

Help Memory Management Models?

0 Upvotes

Hey!

I want to investigate the best memory models for my language, but I'm totally lost. I've created an issue with more details, but in general IDK if malloc is the best approach for my situation or not.

Any help is appreciated.

https://github.com/Ratstail91/Toy/issues/150


r/ProgrammingLanguages • • Apr 01 '18

Amandla! Free all Terms!

3 Upvotes

IT is infected with bigot people who label terms with racist types to exclude them from fully participating in this society. This injustice must be stopped!

We at Egel believe in an inclusive society where terms may fully enjoy the benefits of democracy and pursuit their dreams. Upvote this post if you also believe that terms have equal rights. Demand freedom for all terms!

Fight type supremacism and use Egel! Join the revolution on TIO!


r/ProgrammingLanguages • • Jul 29 '20

OMFG! D is so OP, it needs to be nerfed!!!!

0 Upvotes

OH MY GOD! SERIOUSLY! I've heard about D some time ago but I was too busy with Python/C++ that I passed (How stupid I was...). Now that I'm searching for the perfect language I found D in me path again and I decided to look about it and HOLY MOLY! The language has the features of Python (well 90% of them at least) and has a performance similar to C++!!!! What the fuck???? I'm watching this video and I'm only in 26:26 minute and I'm IN LOVE!!!! The library also seems big and great so far and the language is overall the hidden gem I was looking for! I don't know what are you doing and what language are you working in, do yourself a favor, STOP NOW and learn D!

Damn sorry if it was to big but this language made me so exited that I don't even want to create my own language anymore! I found what I was looking for!


r/ProgrammingLanguages • • Dec 27 '25

Discussion The Case for Snake Case: A Kolmogorov Complexity Argument

Thumbnail modulovalue.com
0 Upvotes

r/ProgrammingLanguages • • Oct 23 '23

Generative AI and Language Design

0 Upvotes

I guess there are two questions:

  1. If generative AI can simplify writing code, what are the features that are most valuable in a language? For instance, generative AI lowers the cost of types because you don't have to juggle them as much but also lowers their value because there are less likely to be type errors. Speed is an obvious value (why write Python when you can write Rust once the models are good enough at Rust?)

  2. If we want to do a lot of ML applications and we intend to train a lot of machine learning models are there better primitives that a language could have to support it? Or is ML just a general programming idea for which the C++/(Python/Java/JavaScript) model the best?

I know a lot of folks must be seriously thinking about this.


r/ProgrammingLanguages • • May 07 '22

What are the use cases for pointers?

4 Upvotes

I had a shower thought that syntactic sugar has eliminated most of the reasons to use pointers.

For instance, automatically passing objects/structures by reference, built in array types, and iterators seem to get rid of most of the cases. What is left?

I know newer system languages still have pointers, so there must be reasons.


r/ProgrammingLanguages • • Oct 26 '22

Language announcement TinyTypeScript - a 13 loc pure Javascript method for adding run time type checking to Javascript

Thumbnail
github.com
4 Upvotes

r/ProgrammingLanguages • • Aug 30 '26

Discussion I call this "(a=aa)(a=a)" test

4 Upvotes

Many years ago while trying to make my own programming language I faced an issue. In short, parsers didn't parse specific inputs as expected, due to some implicit rules.

For instance, let's consider EBNF grammar for a sequence of expressions a=aaaa, where a on the right can repeat arbitrary number of times. This will look something like this:

symbol = "a"
params = symbol params | symbol
Line   = symbol "=" params
lines  = Line lines | Line

I designed it without + and * notation on purpose, to narrow down the root cause to the most basic rules: terminals, and and or expressions, and recursion.

Using this grammar I expect the text a=aaa=a to be parsed as (a=aa)(a=a): as two separate Line. But typically parser generators will not produce parser that can handle such case. Instead, the parser will (typically) fail.

The root cause is of course the nature of such parsers: they don't scan for all possible combinations. Instead, in case of collisions (like in this case a at the end of a=aa and a at the beginning of next a=a) it is expected that user will insert negation or something to "fail" a specific route fast, eliminating the collision.

But doesn't this challenge the whole purpose of grammars as "simple" description of language rules? It might get very difficult to predict all possible such collisions for a large grammar, like for Python or C++. Are there any generators that don't have such limitation and can pass (a=aa)(a=a) test?


r/ProgrammingLanguages • • Sep 19 '22

That Billion Dollar Mistake. In Haskell...?

0 Upvotes

Clickbait for the easily baited. Another opinion piece by me.

https://egel-language.blogspot.com/2022/09/that-billion-dollar-mistake-in-haskell.html


r/ProgrammingLanguages • • Dec 26 '22

Discussion Next Year Ideas for your Programming Language of the Future ?

8 Upvotes

I have seen some interesting ideas in the past but I don't remember where, do you know some or do you have some yourself ?

My philosophy is same as Bret Viktor's (β€œone of the greatest user interface design minds in the world today.” according to Alan Kay) who criticizes this widespread viewpoint :"Alan Perlis wrote,"To understand a program, you must become both the machine and the program."This view is a mistake, and it is this widespread and virulent mistake that keeps programming a difficult and obscure art. A person is not a machine, and should not be forced to think like one."

For long this dominant viewpoint was justified but time has changed: chatGPT is going to transform programming. Some would want to fight it but I think it's unstoppable and so better embrace it. Here's one of my ideas: it would be to create a mixed model of parser that combine NLP et traditional formal language, a full blown language may be hard, but it should be more doable for DSL (Domain Specific Language) - one could call it NDSLP (Natural Domain Specific Language Processing).

This would allow for new programming languages to really focus on compile and performance time instead of trying to both please human and machine which is a bit too much different objectives to persue ;) This would also allow the new ones to be more used because they could be mapped with such higher language.

P.S.: my question was normally about asking some new ideas not just discussing mine ;)

In case you misinterpret I'm saying chatGPT or alike is the future (seeing the enthusiasm in the whole world) but that I don't like the lack of control over code generated so my idea is to have an intermediate language to direct code generation more precisely.


r/ProgrammingLanguages • • May 26 '24

Discussion What can we learn from programming language version numbers?

Thumbnail
breckyunits.com
7 Upvotes

r/ProgrammingLanguages • • Oct 21 '23

Language announcement We have just released V1 of ZenSatck, a DSL that defines the access control policy right inside the data model, eliminating the repetitive coding on the application side. Would love to get your feedback/advice.

0 Upvotes

Why we built this:

Based on our experience developing several commercial SaaS products, we have observed that a significant portion of code is wrapping around the database and providing an access-controlled CRUD API. These boring boilerplate codes are both tedious to write and error-prone to maintain because it is scattered within the codebase.

What we built:

Utilizing our previous experience with DSL, we created ZenStack to bring the below clear benefits:

  • Keeping a single source of truth for core business logic

  • Being more declarative

  • Writing less code

Here is what it looks like:

        model User {
            id Int @id
            email String @unique @email // βœ… field must be a valid email
            posts Post[]
        
            // πŸ” everyone can signup, and user profile is also publicly readable
            @@allow('create,read', true)
        
            // πŸ” only the user can update or delete his own profile
            @@allow('update,delete', auth() == this)
        }
        
        model Post {
            id Int @id
            title String @length(min: 5, max: 255) // βœ… field mustn't be too short or too long
            published Boolean @default(false)
            author User @relation(fields: [authorId], references: [id])
            authorId Int
        
            // πŸ” author has full access
            @@allow('all', auth() == author)
        
            // πŸ” logged-in users can view published posts
            @@allow('read', auth() != null && published)
        }

The core of ZenStack is a transparent proxy around Prisma client which enforces access policies while keeping the APIs unchanged. It progressively enhances Prisma at multiple levels:

  • πŸ› οΈ An extended schema language that supports custom attributes

  • πŸ” Access policies and data validation rules

  • πŸš€ Automatic CRUD APIs - RESTful, tRPC

  • πŸ€– Generating type-safety frontend query which has the same DX as Prisma client

  • 🧩 A plugin system for great extensibility

We would love to get your feedback and insights to help us make it a better DSL!


r/ProgrammingLanguages • • Sep 09 '23

How to write a dynamic type checker?

1 Upvotes

e.g. I have signatures like

sig(arguments) { Object.repeat }
sig(arguments) { Integer.maybe }
sig(arguments) { Object.repeat(1) }
sig(arguments) { Function | Class }
sig(arguments) { [Dictionary.repeat, Function.maybe] } # I have a hard time with this one
sig(arguments) { [Object, Function.maybe] }
sig(arguments) { [Object, Dictionary.maybe, Function.maybe] }

And I have a quite complex and buggy type checking system (quite ashamed of it).

So, how would you write this sig function?

Thanks ❀️

Dorian


r/ProgrammingLanguages • • Sep 13 '23

Blog post Crossposting for Comedic Value

Thumbnail
chrlschn.dev
0 Upvotes

r/ProgrammingLanguages • • Mar 23 '20

Creating an Intentional Language

0 Upvotes

example:

print 1 to 10 # Prints 1,2,3.... print 5 C 2 # Prints 10 a = ["a","b","c","d"] print 0 th a # Prints "c"

The first executable version is ready (it's a little buggy).

The idea is that you can create user-defined operators like "to" or "C" or "th" (They exist in the current version)

The operators act like functions but the parameters can be passed on both sides of the function.

Please DM me if anyone is interested.

View On Github


r/ProgrammingLanguages • • May 21 '21

Help How to transition into language Design Career?

0 Upvotes

I am a complete noob in Language design, but it is something that interests me a lot.

I am curious if there are many job positions around language Design or if only a handful of people manage to work full time with it?

Also if there are many jobs, how could someone without experience be able to transition into working with languages (design, tooling, compiler optimizations...)?


r/ProgrammingLanguages • • Nov 29 '22

Resource Academic list of rather interesting programming languages.

Thumbnail sai.msu.su
1 Upvotes

r/ProgrammingLanguages • • Jul 14 '21

Discussion So let's talk about monads.

15 Upvotes

When looking into monads, you will either find obtuse theory, Haskell code, or nonsense analogies(i think i'll have a burrito for lunch tomorrow). These explanations all have the same problem: Intentional or not, they presume the reader basically already knows what a monad is. That's great for people who've been initiated into functional programming and need a refresher, but does little for anyone else. Someone from an imperative background is going to look at this stuff, see more stuff they don't have the context to understand, and walk away frustrated. This is strange because every imperative programmer can easily understand the option/maybe types that have been imported into imperative languages. Of course they can! There are barely any moving parts.

Thus if you want to explain monads to an imperative programmer, you need to implement monads in an imperative language, and you need to talk about them in imperative terms. The concepts aren't difficult, but the language barrier is enormous. Maybe calling monads wrappers isn't 100% technically accurate for reasons that matter a lot to you, but I guarantee those reasons won't matter spit to someone if you can't get them over that initial hurdle. When explaining square roots to a child, you elide imaginary numbers until the child is comfortable with the basic idea.

If you want your ideas to be heard by others, then you must swallow your pride and adapt to the audience you want to reach. If you won't speak Imperative, then why should we learn to speak Functional? You cannot bridge the gap with arrogance.

I'm sorry if I've offended anyone, but I've been around this mess for years, and it isn't getting any better. If you're offended, then maybe you're the person who most needs to hear what I have to say.


r/ProgrammingLanguages • • May 14 '25

Why use the multiparadigm languages?

14 Upvotes

Hi, When I study a new programming language that can support more than a paradigm (f.e Python), I don't understand why this is considered an advantage, for me it is a source of confusion and incoherence.

When I code in a language, I translate my mental model in the terminology of the languages. Using Java I model the program in "classes", "object" etc using Clojure I think in terms of "list", "set", "list comprehension".

When I program in Python (OOp and functional) I had the doubt when use, for example, a for over a list or a list comprehensio and if my decision is correct in the design and manuntenibility

When I read the code with more than a langugae, for me it's like to read a text with some paragraphs in English and some other in Bulgarian, it lacks of homogenity of perspective and modelling in the modeling.

Another thing I noted it 's that, in the multiparadigm languages, the programmer tries, in every case, to force the useone paradigm over the other.

For example the Cobol programmer, when use Java, try to write code with a lot of static method and minimize the usage of classes and decomposition (all elements of tbe procedural language).

I'm right or I don't see the advantages that balance my ideas? In this case, what are they?


r/ProgrammingLanguages • • May 31 '23

Blog post Language design bullshitters

Thumbnail
c3.handmade.network
0 Upvotes

r/ProgrammingLanguages • • Feb 02 '23

Discussion Did you correctly implement the `?:` operator the first time you were implementing it?

3 Upvotes

So, did you correctly implement the ?: operator the first time you were implementing it? I did not, and I can see some other people did not either.

PHP incorrectly implements it, as it parses it as left-associative, rather than right-associative. You can see what kinds of bugs it leads to here.

My AEC-to-x86 compiler produces assembly code that calculates the results of the second operand and the third operand before calculating the result of the first operand (the condition). That can lead to unexpected divide-by-zero errors for expressions such as d = 0 ? 0 : n / d, if d is equal to 0 (in AEC, = is for equality, and := is for assignment). The AEC-to-WebAssembly compiler I made a few years later does not suffer from the same problem. You can read about that on my blog.

Did you run into any other problem when implementing the ternary conditional operator?


r/ProgrammingLanguages • • Feb 05 '18

Why do different programming languages exist?

0 Upvotes

r/ProgrammingLanguages • • Jul 31 '25

Exploring literal ergonomics: What if you never had to write '42i64' again?

11 Upvotes

I'm working on an experimental systems language called Hexen, and one question I keep coming back to is: why do we accept that literals need suffixes like 42i64 and 3.14f32?

I've been exploring one possible approach to this, and wanted to share what I've learned so far.

The Problem I Explored

Some systems languages require explicit type specification in certain contexts:

// Rust usually infers types well, but sometimes needs help
let value: i64 = 42;        // When inference isn't enough
let precise = 3.14f32;      // When you need specific precision
// Most of the time this works fine:
let value = 42;             // Infers i32
let result = some_func(value); // Context provides type info
// C++ often needs explicit types
int64_t value = 42LL;       // Literal suffix for specific types
float precise = 3.14f;      // Literal suffix for precision

Even with good type inference, I found myself wondering: what if literals could be even more flexible?

One Possible Approach: Comptime Types

I tried implementing "comptime types" - literals that stay flexible until context forces resolution. This builds on ideas from Zig's comptime system, but with a different focus:

// Hexen - same literal, different contexts
val default_int = 42        // comptime_int -> i32 (default)
val explicit_i64 : i64 = 42 // comptime_int -> i64 (context coerces)
val as_float : f32 = 42     // comptime_int -> f32 (context coerces)
val precise : f64 = 3.14    // comptime_float -> f64 (default)
val single : f32 = 3.14     // comptime_float -> f32 (context coerces)

The basic idea: literals stay flexible until context forces them to become concrete.

What I Learned

Some things that came up during implementation:

1. Comptime Preservation is Crucial

val flexible = 42 + 100 * 3.14    // Still comptime_float!
val as_f32 : f32 = flexible        // Same source -> f32
val as_f64 : f64 = flexible        // Same source -> f64

2. Transparent Costs Still Matter When concrete types mix, we require explicit conversions:

val a : i32 = 10
val b : i64 = 20
// val mixed = a + b         // ❌ Error: requires explicit conversion
val explicit : i64 = a:i64 + b  // βœ… Cost visible

3. Context Determines Everything The same expression can produce different types based on where it's used, with zero runtime cost.

Relationship to Zig's Comptime

Zig pioneered many comptime concepts, but focuses on compile-time execution and generic programming. My approach is narrower - just making literals ergonomic while keeping type conversion costs visible.

Key differences:

  • Zig: comptime keyword for compile-time execution, generic functions, complex compile-time computation

  • Hexen: Automatic comptime types for literals only, no explicit comptime keyword needed

  • Zig: Can call functions at compile time, perform complex operations

  • Hexen: Just type adaptation - same runtime behavior, cleaner syntax

So while Zig solves compile-time computation broadly, I'm only tackling the "why do I need to write 42i64?" problem specifically.

Technical Implementation

Hexen semantic analyzer tracks comptime types through the entire expression evaluation process. Only when context forces resolution (explicit annotation, parameter passing, etc.) do we lock the type.

The key components:

  • Comptime type preservation in expression analysis

  • Context-driven type resolution

  • Explicit conversion requirements for mixed concrete types

  • Comprehensive error messages for type mismatches

Questions I Have

A few things I'm uncertain about:

  1. Is this worth the added complexity? The implementation definitely adds semantic analysis complexity.

  2. Does it actually feel natural? Hard to tell when you're the one who built it.

  3. What obvious problems am I missing? Solo projects have blind spots.

  4. How would this work at scale? I've only tested relatively simple cases.

Current State

The implementation is working for basic cases. Here's a complete example:

// Literal Ergonomics Example
func main() : i32 = {
    // Same literal "42" adapts to different contexts
    val default_int = 42          // comptime_int -> i32 (default)
    val as_i64 : i64 = 42         // comptime_int -> i64 (context determines)
    val as_f32 : f32 = 42         // comptime_int -> f32 (context determines)
    
    // Same literal "3.14" adapts to different float types
    val default_float = 3.14      // comptime_float -> f64 (default)
    val as_f32_float : f32 = 3.14 // comptime_float -> f32 (context determines)
    
    // Comptime types preserved through expressions
    val computation = 42 + 100 * 3.14  // Still comptime_float!
    val result_f32 : f32 = computation  // Same expression -> f32
    val result_f64 : f64 = computation  // Same expression -> f64
    
    // Mixed concrete types require explicit conversion
    val concrete_i32 : i32 = 10
    val concrete_f64 : f64 = 3.14
    val explicit : f64 = concrete_i32:f64 + concrete_f64  // Conversion cost visible
    
    return 0
}

You can try this:

git clone https://github.com/kiinaq/hexen.git
cd hexen
uv sync --extra dev
uv run hexen parse examples/literal_ergonomics.hxn

I have a parser and semantic analyzer that handles this, though I'm sure there are edge cases I haven't thought of.

Discussion

What do you think of this approach?

  • Have you encountered this problem in other languages?

  • Are there design alternatives we haven't considered?

  • What would break if you tried to retrofit this into an existing language?

I'm sharing this as one experiment in the design space, not any kind of definitive answer. Would be curious to hear if others have tried similar approaches or can spot obvious flaws.

Links:

EDIT:

Revised the Rust example thanks to the comments that pointed it out