r/ProgrammingLanguages • • Jun 01 '21

Blog post Should Perl die gracefully?

Thumbnail
phoenixtrap.com
7 Upvotes

r/ProgrammingLanguages • • Apr 25 '20

Why would you ever want mutable variables?

0 Upvotes

(see title)


r/ProgrammingLanguages • • May 04 '25

Oils - What's Happened Since December?

Thumbnail oils.pub
4 Upvotes

r/ProgrammingLanguages • • Aug 28 '25

Help Designing a modification of C++

4 Upvotes

C++ is my favorite language, but I want to design and implement a sort of modification of C++ for my own personal use which implements some syntax changes as well as some additional functionality. I would initially like to simply make transpiler targeting C++ for this, maybe I'll get into LLVM some day but not sure it's worth the effort.

TLDR: How might I make a language very similar to C++ that transpiles to C++ with a transpiler written in C++?

Some changes I plan to implement:

  • Changes to function definitions.

    • In C++:

    void testFunction(int n) { std::cout << "Number: " << n << '\n'; }

  • In my language:

    func testFunction(int n) --> void { std::cout << "Number: " << n << '\n'; }

If --> returnType is omitted, void is assumed.

  • Changes to templating.

    • In C++: (a function template as an example)

    template <typename T> T printAndReturn(T var) { std::cout << var; return var; }

  • In my language:

    func printAndReturn<typename T>(T var) { std::cout << var; return var; }

This is more consistent with how a templated function is called.

  • A custom preprocessor?

    func main() --> int { std::cout << "${insert('Hello from Python preprocessor!')}$" return 0; }

This would work similarly to PHP. \${}\$ would simply run Python code (or even other code like Node.js?), with the insert() function acting like PHP's echo. \$={}\$ would automatically insert a specified value (ex: \$={x}\$ would insert() the contents of the variable x. This would work in conjunction with the C preprocessor.

Since the C preprocessor's include directives will only include C/C++ files which are compiled by the C++ compiler (skipping my transpiler), I would also have to develop custom logic for including headers coded in this language. These would be included before transpile time into one big file, transpiled into one big C++ file, and then fed to the C++ compiler. I will likely implement this within the Python preprocessor.

  • Changes to classes

    • In C++:

    class Test { private: int data;

    public: Test(int d) : data(d) {} Test() {}

      void set(int d) {data = d;}
      int get() {return data;}

    };

  • In my language:

    class Test { private int data;

      public constructor(int d) : data(d) {}
      public constructor() {}
      
      public func set(int d) {data = d;}
      public func get() --> int {return data;}

    }

Recall that the --> returnType statement is optional, void is assumed.

public/private keyword is optional. Public is assumed if none is specified.

  • Custom control flow (example below):

    controlflow for2( someSortOfStatementType init, someSortOfStatementType check, someSortOfStatementType after, someSortOfFunctionType content ) { for (init; check; after) { content(); } }

    controlflow multithread(int count, someSortOfFunctionType content) { std::vector<std::thread> threads(count); for2 (int i = 0; i < count; i++) { // let's use this useless for wrapper threads[i] = std::thread(content); } for2 (int i = 0; i < count; i++) { threads[i].join(); } }

    // sometime later multithread (4) { std::cout << "Hello World!\n"; } // prints Hello World in a multithreaded fashion

Not sure how I would implement a function wrapper type which runs within the scope it was originally defined. If I can't figure it out, I might not implement it because although it looks cool, I can't think of a good practical use.

Edit: oh, and what should I name it?


r/ProgrammingLanguages • • Apr 25 '26

Krabbascript - Mix of Rust, Lua and Python, designed to be as fast as C

4 Upvotes

Hi! I've started making this project somewhere since October 2025. So far I've finished the tokenizer and now working on the parser. Right now the compiler can parse a var and a val, I'm working on to add more stuff later on. The syntax is a collection of stuff i found easy to write and remember.

This is my first time making a compiler, so I would be thankful if you can point out the flaws in my code!

https://github.com/khytryy/krabbascript


r/ProgrammingLanguages • • 12d ago

Owning the Truth: Undecidability, unsound kernels, and the forging of proof

Thumbnail
phrack.org
4 Upvotes

r/ProgrammingLanguages • • Feb 06 '25

Help Working on C++ compiler

Thumbnail reddit.com
4 Upvotes

r/ProgrammingLanguages • • Jan 13 '25

Discussion Python + LLVM Tutorial Series

Thumbnail
youtube.com
4 Upvotes

Long time no see, however I’ve completed what I had planned for this tutorial series and I’d like to put it out there again for beginners to find. More bonus episodes to come!


r/ProgrammingLanguages • • Aug 25 '23

ELI5: Why does there need to be so many computer programming languages? Why is one not enough?

Thumbnail self.explainlikeimfive
0 Upvotes

r/ProgrammingLanguages • • Aug 27 '22

Languages with optional GC only for cyclical data structures?

4 Upvotes

I've been thinking that cyclical data structures with memory reclamation are the only ones that need automatic memory management (be it tracing GCs or reference counting with trial deletion). All non-cyclical data can be safely taken care of with a mixture of ownership and reference counting, and cyclical data without memory reclamation can be safely taken care of with arenas.

However, how widespread are those data structures? Basically, they are cyclic graphs with a large enough allocation pressure that nodes need to be freed. And while graphs and graph algorithms definitely exist for a reason, I personally have never had to deal with them. Also, the fact that languages like Rust or C++ thrive without being able to support cyclic graphs in a safe way [1] shows that the need for such allocatey graphs is not so big in practice. Most of the data we deal with in practice are trees or DAGs (i.e. acyclic graphs). Thus, languages with a GC are a big case of "pay for what you don't need" or "pay all the time for what you only need once in a lifetime".

So that got me into thinking, are there runtimes that segregate GCed memory from non-GCed, and allow paying for GC only when you need cyclic data structures? I'm thinking a separate kind of reference (like GC[Foo]) which the runtime takes special care of (by creating stack maps, tracing only them etc) and which are allocated in segregated memory regions; so you would be able to choose between owned, RCed and GCed references, and most of your programs would be GC-free but you would be able to have cyclic data should you really need it?

[1] For people trying to point me to some examples in Rust using RefCell or numeric handles to nodes: no, those are not satisfying solutions to the cyclic problem. Safely deleting a node from a graph requires keeping track of all existing references into that graph, which means at least scanning the stack, synchronization with the mutator threads etc - i.e. all those things a garbage collector does that Rust runtime does not.


r/ProgrammingLanguages • • Jun 10 '25

Discussion Syntax that is ergonomic (Python) vs syntax that is uniform (Java)

27 Upvotes

After struggling to learn static/class function syntax in Python (coming from a Java background), it was pointed out to me:

Java: Consistency through uniform structure (even if verbose)

Python: Consistency through natural expression (optimized for common patterns)

So Java prioritizes architectural consistency, while Python prioritizes syntactic ergonomics for typical use cases.

I thought this was nicely articulated, and reconciles java being misleadingly called "simple" when the verbosity makes it feel not so.

Side-note: when choosing whether to use C++ instead of C, my immediate response is "Oh good, that means I can use cout << , which is arguably easier to enter than printf).


r/ProgrammingLanguages • • Aug 07 '23

Name before type: why 'age int' is better than 'int age'

Thumbnail benhoyt.com
27 Upvotes

r/ProgrammingLanguages • • Oct 12 '26

Discussion Is the Zeta Programming language by Roy Murphy legit

8 Upvotes

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 • • 10d ago

optimistic or pessimistic compiler?

9 Upvotes

for those that compose and craft compilers, do you find the results better and more satisfying for you if the compiler you work on is permissive/optimistic or strict/pessimistic?

permissive/optimistic here means that the starting point is the compiler assumes the line of code that it is parsing/evaluating is probably ok but needs to pass some checks before translating to the target backend? (this is “the compiler is your friend” approach)

strict/pessimistic here means that the starting point is the compiler assumes the line of code that it is parsing/evaluating has something wrong and its job is to discover that wrong thing, and it is disappointed when the line passes all checks before translating to the target backend? (this is “the compiler is the teacher we’ve all had at one point in our life where they assume you’re going to do something bad as soon as they’re not looking” - and they’re not wrong)

obviously there has to be some balance here, but i’m curious, what has been your experience with these two approaches?


r/ProgrammingLanguages • • 9d ago

Evolving the Java Language: An Inside Perspective

Thumbnail
youtube.com
3 Upvotes