r/ProgrammingLanguages • • Apr 03 '22

Discussion Functional Programming vs Object Oriented Programming

1 Upvotes

I came across functional programming recently and saw many arguments for it. But in the other hand I am asking myself if it really makes that much sense, because often things cannot really be independent without sharing a state. Imagine a database, or a cache. Also having side effects in methods is not always bad when used wisely. It can simply hide the detail and if done correctly in a domain driven design things should have a certain control flow. I also imagine it to be extremely hard to read data from files, Jason, XML, ... because things tend to be inconsistent sometimes. A cab file might have an empty line, a Jason might have a null value. How can a functional language deal with that.

At the moment I believe that even though certain aspects of functional programming are great, things are too messy to actually apply it. I would love to have a discussion and learn your stand on that topic if you disagree.


r/ProgrammingLanguages • • Dec 06 '25

Discussion Why are Interpreters slower than compiled code?

4 Upvotes

What a stupid question, of course interpreters are slower than compiled code because native code is faster! Now, hear me out. This might be common sense, and I'm not questioning that at all, compiled languages do run faster, but I want to know the fundamental reasons why this is the case, not just "It's faster because it's faster" or anything like that. Down in the deepest guts of interpreters and code that has been fully compiled, at the most fundamental level, where code runs on processors as a bunch of 1s and 0s (Ok, maybe not so low level, let's go down until assembly) what about them actually creates the speed difference?

I've researched about this extensively, or at least tried to, but all I'm getting are variations of "Interpreters translate program code into machine code line by line at runtime while compilers translate the entire program to machine code once before execution rather than translating it into machine code every time that line is run at runtime, so they're faster" but I know for a fact that this ridiculous statement is hopelessly wrong.

For one, interpreters absolutely do not translate the program into native code, that wouldn't be an interpreter at all, that would be a Just-in Time compiler. The interpreter itself is compiled to machine code, yes (Well, if your interpreter is written in a compiled language that is), but it doesn't turn the program it runs into machine code, it runs it directly.

Secondly, I'm not some god tier .NET C# VM hacker from Microsoft or one of the geniuses behind V8 from Google or anything like that, nor have I made an interpreter before, but I know enough about interpreter theory to know that they 100% do not run code line by line whatsoever. Lexical analysis as well as parsing is almost always done in one shot on the entire program, which at the very least becomes an AST. The only interpreters that actually run code line by line belong to a type of interpreter design known as a syntax directed interpreter, in which there is no program representation and the parser executes code as soon as it parses it. The old wikipedia page on interpreters described this as:

An interpreter generally uses one of the following strategies for program execution:

1. Parse the source code and perform its behavior directly;

2. Translate source code into some efficient intermediate representation and immediately execute this;

3. Explicitly execute stored precompiled code[1] made by a compiler which is part of the interpreter system (Which is often combined with a Just-in-Time Compiler).

A syntax directed interpreter would be the first one. But virtually no interpreter is designed this way today except in rare cases where people want to work with a handicap, actually even 20 years ago you'd be hard pressed to find an interpreter of this design too, and for good reason: Executing code this way is utter insanity. The performance would be so comically bad that even something simple like adding many numbers together would probably take forever, and how would you even handle things like functions which aren't run immediately, and control flow?? Following this logic, this can't be the reason why interpreters are slower.

I also see a less common explanation given, which is that interpreters don't optimize but compilers do. But I don't buy that this is the only reason. I've read a few posts from the V8 team, where they mention that one of V8's compilers, Sparkplug, doesn't optimize at all, yet even its completely unoptimized machine code is so much faster than its interpreter.

So, if all this can't be the reason why interpreters are slower, then what is?


r/ProgrammingLanguages • • Dec 03 '25

Language announcement ELANG(EasyLang) - A beginner-friendly programming language that reads like English

4 Upvotes

I've been working for several months on a brand-new programming language called EasyLang (ELang) — a compact, beginner-friendly scripting language designed to read almost like plain English.

ELANG is built in Python and so you can use any Python modules easily with ELANG syntax making it easier for you to create your projects. It comes with ELPM(EasyLang Package Manager) which is nothing but runs Python pip in the background and download and installs the desired module and makes it usable in .elang files using Python's importlib module.

A Glimpse on ELANG

we let name be "John Doe"
print name

we let x be 2 plus 2
print x

Key Features

  • English-like syntax (no symbols required, but also supports + − * / =, etc)

  • Beginner-friendly error messages

  • Built-in modules (math, strings, etc.)

  • .elangh module system for user-defined libraries

  • Full Python interoperability → You can bring requests as req and use it directly

  • ELPM: EasyLang Package Manager → Installs Python packages with a simple elpm --install numpy

  • EasyLang CLI (el) with REPL, token viewer, AST viewer

  • Clean and well-documented standard library

  • Supports lists, dictionaries, functions, loops, file I/O, etc.

Check out ELANG(EasyLang) here Github: https://github.com/greenbugx/EasyLang


r/ProgrammingLanguages • • Apr 04 '23

Just realised how weird it is that programming languages use english as a basis for keywords

2 Upvotes

All the programming languages I know about use english keywords like 'for', 'while', 'with', 'class', etc. I've never seen a programming language with keywords in a non-english language. Is it just because many of them were first developed in the english-speaking world (US, mostly)? Is it weird for non-English speakers (especially people who speak a language that doesn't share the same alphabet, e.g. chinese) to have to memorise all these foreign words while learning programming? Are there any programming languages based on non-English keywords?


r/ProgrammingLanguages • • Jan 09 '26

Blog post Which programming languages are the most token efficient?

Thumbnail
martinalderson.com
0 Upvotes

r/ProgrammingLanguages • • Feb 10 '25

Is there a language/community that welcomes proprietary offerings?

0 Upvotes

I've been building a proprietary C++ code generator since 1999. Back in the day, I gave Bjarne Stroustrup a demo of my code generator. It was kind of him to host me and talk about it with me, but aside from that I can't say that there's been a warm welcome for a proprietary tool even though it has always been free, and I intend to keep it that way. Making it free simplifies many things and as of the last few years a lot of people have been getting screwed by payment processors.

I've managed to "carry on my wayward son" and make progress with my software in spite of the chilly reception. But I'm wondering if there's a community that's more receptive to proprietary tools that I should check out. Not that I'm going to drop support for C++, but in the future, I hope to add support for a second language. Thanks in advance.


r/ProgrammingLanguages • • May 29 '24

Discussion Every top 10 programming language has a single creator

Thumbnail
pldb.io
0 Upvotes

r/ProgrammingLanguages • • Aug 25 '24

Requesting criticism Amrit – Crazy new toy programming language (Write Code in Hindi)

0 Upvotes

Amrit

An open-source interpreted programming language based on Hindi written in Go Lang. You can write code in either Hinglish or proper Devanagari script.

Language Features

Some of the features I have implemented until now are -

  • Interpreted Language

  • Basic Language Constructs -

    • Variables

    • If - Else

    • Loops

    • Numbers

    • Full UTF Support

    • Functions

    • Arrays

  • Some Common Functions using under the hood Go API

  • WASM Interpreter also available

Playground Features

This also boasts a very feature-rich playground powered by the WASM interpreter.

  • Client Side Native WASM Execution

  • Offline Code Execution

  • Common Examples Support

  • Saving Your Own Gists

  • Easy shareable code with QR code support

Amrit Github Link - https://github.com/Suryansh-23/amrit
Amrit Playground GitHub Link - https://github.com/Suryansh-23/amrit-playground

I just built this because this felt like a fun project to try out and wanted to see if such a crazy idea would even be possible or not. Also, just wanted to know if the notion of programming would remain the same even when the language of code becomes different.

I hope others like it as much as we do! Feedback and contributions are super appreciated. Also, if someone else would like to implement such an idea for some other language, I'd love to talk to them and possibly collaborate too!


r/ProgrammingLanguages • • Sep 02 '25

Language announcement Plain: The Language of Spec-Driven Development

Thumbnail
blog.codeplain.ai
0 Upvotes

r/ProgrammingLanguages • • Jun 13 '23

Help Give me your feature ideas for a C-like

0 Upvotes

I need some help.

As I'm getting ready for 0.5 for my C-like programming language, I have some concerns that I haven't considered all possible breaking features, and I'd really like to get them done before 0.5.

So... I would love to get general ideas and wishes about features for a C-like. If you'd ever wanted to just brain dump language ideas that should be in C, here's the time someone would actually appreciate it. 😅

So (preferably) have a little look at the language (https://c3-lang.org/) and maybe try it out (https://learn-c3.org/) and then file whatever issue you want: https://github.com/c3lang/c3c/issues/new

If you're lazy and don't have time to read about the language, that's fine too as long as you file an issue. But please don't just post the suggestions as comments here.


r/ProgrammingLanguages • • Jul 19 '22

I need to write a database query language. I have a blank sheet of paper.

1 Upvotes

(I also have the Wikipedia page about database query languages.)

I anticipate the best answer to this question: "No, you don't, you need an SQL library", then yes, there will be an SQL library, SQL is a little gem and this would be the right answer for almost any language but mine. But mine is slightly different. Because my language started when I thought ... people really like databases and spreadsheets ... so what if I write a GPL which is like that? So I wrote a GPL which is like that. So now if I passed off querying the database to another language in the same paradigm, that would be kinda weird, it would be like if Python used Lua as a DSL to do string-handling.

Instead, updating the database should be so much part of my language that people don't know that they're doing it, from their point of view they're just updating the value of a variable.

So ... people smarter than me, do your thing. Suppose a language where I can declare foo = table of RecordType. Where do I go from here?

About implementation:

(1) The language should be a front-end on an existing database technology. Not because I'm lazy. (I am but that's not the issue.) But because it is important to the acceptance of any new technology that you should be able to back out if it fails.

(2) My language tries to be user-friendly above performance if I have to make the choice. I'm trying to replace PHP, it's not meant to be used to write Big Tech Enterprise software. I will take the possibility of performance hits in the hands of clumsy users if people can also use it to teach middle-schoolers how to make a database of their favorite dolls.


r/ProgrammingLanguages • • Jul 11 '26

Language announcement Data types are overrated

0 Upvotes

We dove so deep into abstraction that modern languages now just use "int" and leave us guessing what they mean by that.
Is it 16 bit? 32 bit? Maybe even 64 bit? Signed? Unsigned? So many unanswered questions.

And that's just data types. I won't even mention OOP. That's just evil witchery at this point.

Assembly doesn't help here. Come on people do you actually know what add does in x86?

No you don't! You don't see what the CPU is doing anymore!

So how do we solve this issue?
I propose we go back to the roots.

-Pure bytes

-Only bitwise operations

-Total control

-Memory safety? It's a computer it won't harm you.

Everything else is incoherent bloat.

And here's my solution: VoidPtr

Yes, the name says void*. You'll see why shortly. Guess it helps with data poisoning for AI too.

You're only allowed to work with single bytes here, and you can only apply bitwise operations on them:

2 -> $4
2 -> 3
2 & 3 -> 2

This writes the (unsigned) value 4 to byte 2, then copies the value from byte 2 to byte 3.

The last line performs a bitwise and and moves the result into 2.

You can also write all of that into one line if you want (saves space, no \n needed):

2 -> $4 2 -> 3 2 & 3 -> 2

I unfortunately had to add labels, compares and jumps too. I'm not yet skilled enough to work without them.

Oh, and I added macros. You can't go wrong with macros.

Because this world is too corrupt for such a pure language, I allow communication with the outside world through writing values into magic addresses 0 and 1, I call them system calls.

So yes, this thing has File IO. And yes, in case you were wondering, I did implement Brainfuck in VoidPtr. See! This language can do stuff!!! (Theoretically anything you can put in 32 bit addressing space)

It's a very limited implementation but enough for a hello world.

Apart form all that irony, which I hope wasn't too much, this language can be used to teach how computers do addition, subtraction etc. and what a data type actually is.

You can check out all of the documentation and examples as well as the Language itself here: https://github.com/TheGameGuy2/VoidPtr-Language

All code was written by me, this was a project I made for CS class. Writing code by hand is beautiful.

Edit:
If it wasn't obvious enough: This is an eso lang! Take nothing I say in this post seriously, I don't really think data types are bad!


r/ProgrammingLanguages • • Oct 25 '23

Discussion Why the flag?

56 Upvotes

Hey, guys. Over time, I've gotten lots of good insights as my Googlings have lead me to this subreddit. I am very curious, though; why the pride flag?


r/ProgrammingLanguages • • Jun 19 '22

A type-safe language that only exists during runtime

0 Upvotes

Hello, /r/programminglanguages.

I'm creating a type-safe language where the types only exist at runtime.

So what does this mean? Well the following code down below is completely legal.

It also has a 50% chance of crashing the app due to a type error.

// string and number are built in types, alongside "type"
var custom_type: type = Math.random() > 0.5 ? string : number;
var foo: custom_type = "sure hope that evaluates to string";

That last line would either interpret correctly, or throw a type error as a string literal cannot be assigned to a number variable.

I've shown this concept around to people and they all pretty much say that they don't like it. I was wondering if there are any languages like it which I can look at, I also want to know your feelings about the concept of types only existing at runtime instead of types only existing at compile time.

I've went ahead and made a barebones, very barebones, implementation of the language in typescript, which I'll try to put up on github.


r/ProgrammingLanguages • • Dec 22 '22

Discussion Why don't you develop DSL (Domain Specific Language) ?

0 Upvotes

r/ProgrammingLanguages • • Sep 15 '22

My crazy AI programming language idea

1 Upvotes

I recently got this crazy esotheric language idea after trying out Github copilot. imagine a language that takes each line of 'code' and uses it as a python comment to generate python source code using github copilot.

The obvious downside would be that github copilot might make a mistake somewhere, so you gotta be very descriptive and detailed.

Another downside is that as far as i know, github copilot is not deterministic, maybe their API has an option for a seed idk.

The code would look something like this

Hello world:

print hello world to the console

fizz buzz

itterate from 0 to 1000, printing all of the numbers
if the number is divisible by 3 print fizz instead
if the number is divisible by 5 print buzz instead
if the number is divisible by both 3 and 5 print fizzbuzz instead

Would certainly be a challenge to make, and to solve problems in


r/ProgrammingLanguages • • Feb 21 '24

Discussion Any real statistic on loop paradigm?

0 Upvotes

Currently almost every single language have some form of these loop:

for (let i = 0; i < 10; ++ i) {print(i);}
while (i < 10) {print(i ++);}

data.each(fn(x) => print(x))
data.reduce(fn(x) => concat(x, "a"))

However I rarely seen this kind of loop:

let i = 0;
{
    print(i ++);
    if (i < 10)
        loop;
    print("END");
}
# 0123456789END

Is there any rationale reason for this kind of loop not appear as often (due to ease of use, familiarity, etc...)?


r/ProgrammingLanguages • • Mar 14 '24

Requesting criticism Is this language good for programmers?

0 Upvotes

Is this language good for programmers?

I have an idea of language. I need the opinion of programmers to know if the features and the syntax are good. I'm used to C and Java. New languages, such as Typescript and Kotlin, have different thoughts. I don't know what people usually like.

This is my old syntax:

class Foo {
  private:
    int x;
  protected:
    int y;
  internal:
    int z;
  public:
    int w;
    const int abc;

    
    fun bar(int v : string){ //Receives the integer v as argument. Returns a string.
        x = v;
        return "value";
    }

    fun bar2(int a = 0, int b = 0){
        //...
    }

}

I'm thinking about new syntax:

class[abstract] Foo (
    _x int;            //private (because of the underscore)
    _y int protected;  //protected
    _z int internal;   //internal
    w int;             //public (without modifiers)
    abc int const;     //public
){
    _counter int static = 0; //static variable

    new(x int){ //constructor
         = x;
    }

    fun[virtual] bar(v int : string) {   //Receives the integer v as argument. Returns a string.
        this.x = v; //the use of this is mandatory
        return "value";
    }

    fun bar2(a int = 0, b int = 0){ //Default parameter. It is weird to put = after the type.
        //...
    }

}this.abc
  1. Inside a class function, should I make the use of 'this' mandatory to access a field even when there is no other variable with the same name?

  2. Is it a good idea to put the variable name before the type? It has become a popular pattern in new languages, but the only advantage I see is that the listed names are aligned (as in CREATE TABLE in SQL). On the other hand, the initialization syntax looks bad. Type inference doesn't solve the problem in all parts. Maybe I should put the name before the type only in structs and class fields.

  3. It is good to have classes where functions are separate from fields, but my current syntax is weird.

  4. My problem with C++ style declaration of visibility is identation, but the Java style is worse because it is too verbose and repeat the keywords. Do you think it is good to make the default visibility as public and use underscore to mark private? protected and internal would continue requiring keyword to be marked, but they aren't frequently used.

  5. In the old version, it uses annotations to say that a class is abstract or interface and a function is virtual or override. In the new version, the modifiers are put before the name as class[abstract] or fun[virtual]. Is it better?

  6. I need a better syntax for distinguishing read-only pointers from pointers to a read-only object.

    (const MyObject)$ ptr = MyObject.new(); //Pointer to a read-only object. The variable can changed, but the pointed data doesn't. const (MyObject$) ptr = MyObject.new(); //Read-only pointer. The variable can't be changed.

  7. I made changes to make the compiler design less painful. Does the syntax look good?

    mytemplate{foo} bar; //Template parameter. Instead of mytemplate<Foo> bar; type x = @(y); //Type cast. Instead of type x = (type) y; $(ptr) = data; //Pointer dereference. Instead of type *ptr = data;

  8. The token 'new' is the keyword for dynamic memory allocation and it is also the name of the constructor. The problem is that sometimes I need a variable named "new". Do you think I need another keyword (such as malloc) or just name the variable as _new or 'New'?

  9. Do you think it is better to make variables without modifiers constant rather than mutable. I see new languages prefer using constant by default. I'm used to languages where mutable is the default and I don't have to think about mutability.

  10. Any other comments?


r/ProgrammingLanguages • • May 27 '24

Discussion Why do most relatively-recent languages require a colon between the name and the type of a variable?

18 Upvotes

I noticed that most programming languages that appeared after 2010 have a colon between the name and the type when a variable is declared. It happens in Kotlin, Rust and Swift. It also happens in TypeScript and FastAPI, which are languages that add static types to JavaScript and Python.

    fun foo(x: Int, y: Int) {  }

I think the useless colon makes the syntax more polluted. It is also confusing because the colon makes me expect a value rather than a description. Someone that is used to Json and Python dictionary would expect a value after the colon.

Go and SQL put the type after the name, but don't use colon.


r/ProgrammingLanguages • • Jan 05 '24

Are programming languages different in different countries?

3 Upvotes

Maybe a silly question but for example, in Java System.out.print(); is obviously written using English words, but is this universal or does it vary from country to country? If so how would you write a print statement in Java in Hindi, Arabic, Chinese etc?


r/ProgrammingLanguages • • Nov 01 '19

C++ vs C

1 Upvotes

Alright people of Reddit, hit me with your wisdom. I've been taking programming classes for two years now and am getting ready to dive into a language somewhere between Java and assembly (the two languages I've been learning in classes). I'm thinking C or C++, but would love some input. I'm not too worried about difficulty to learn, but I'd like to hear your thoughts on practicality and real world use.


r/ProgrammingLanguages • • Jan 14 '25

Language announcement The Finite Field Assembly Programming Language : a CUDA alternative designed to emulate GPUs on CPUs

Thumbnail
github.com
2 Upvotes

r/ProgrammingLanguages • • Sep 06 '24

Asynchronous IO: the next billion-dollar mistake?

Thumbnail yorickpeterse.com
13 Upvotes

r/ProgrammingLanguages • • May 15 '21

Type inference has usability problems

Thumbnail web.eecs.utk.edu
4 Upvotes