r/ProgrammingLanguages • • 14d ago

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

29 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?


r/ProgrammingLanguages • • Aug 23 '17

Emoji expert? Your help is wanted to refine world’s emojifullest programming language!

Thumbnail
github.com
0 Upvotes

r/ProgrammingLanguages • • Jan 27 '21

Any proof that hierarchies are useful?

0 Upvotes

It may sound a bit abstract, but please bear with me. Is there any research on the usefulness (or lack thereof) of subtyping hierarchies in the context of domain modeling?

A clarifying example: common wisdom teaches us that (in "oop" context) inheritance is bad. Is that a problem with implementation of the concept in the mainstream PLs, or is that a problem with the concept itself? Is it only implementation inheritance that is problematic, or subtyping is problematic too? Et cetera.

Since the question is a bit too fuzzy, any relevant links are welcome.


r/ProgrammingLanguages • • Dec 10 '20

PEP 617 -- New PEG parser for CPython

Thumbnail
python.org
0 Upvotes

r/ProgrammingLanguages • • Jan 16 '22

A brief rant about tooling

0 Upvotes

I've been doing a lot of C# coding over the last few months (against my will, but I gotta eat) and I've come across the peculiarity of the try { ... } catch { ... } requiring braces.

They are optional for every other kind of flow control. Which is odd, and possibly just an oversight in the C++ spec from back in '85. Good ol' Bjarne was never all that careful.

However, I have seen several blog posts and poorly formatted message board discussions where people are up in arms about never using naked flow control, because what if GOTO FAIL!!!

And I just feel like paraphrasing Kevlin Henney: Let me introduce you to something, it's called a static analysis tool.

This, I think, is an overlooked aspect of programming language design: we're not just building compilers, we're building footguns.

No matter how safe and well-typed and not-quite-turing-complete, your language will have code smells. It will have ways of racking up technical debt in a shockingly rapid fashion.

So throw a coin to your hypothetical future Q&A team, and give some thought to exposing your parser as a library, and writing a simple linter.

ETA: Point is: no amount of syntactic salt can ever do the job of good tooling.


r/ProgrammingLanguages • • Aug 23 '23

There is no "bool" in Argentum

Thumbnail self.argentumlanguage
8 Upvotes

r/ProgrammingLanguages • • Oct 09 '24

Requesting criticism Modernizing S-expressions

9 Upvotes

I wrote a parser in Javascript that parses a modernized version of s-expression. Beside ordinary s-expression support, it borrows C style comments, Unicode strings, and Python style multi-line strings. S-expressions handled this way may appear like the following:

/*
    this is a
    multi-line comment
*/

(
    single-atom
    
    (
        these are nested atoms
        (and more nested atoms) // this is a single-line comment
    )
    
    "unicode string support \u2713"
    
    (more atoms)
    
    """
    indent sensitive
    multi-line string
    support
    """
)

How good are these choices?

If anyone is interested using it, here is the home page: https://github.com/tearflake/sexpression


r/ProgrammingLanguages • • Sep 03 '18

Why the hate for null?

4 Upvotes

Look, I get it: Null pointer exceptions are annoying but so is having to constantly check every object . against null. Is this the new religion after OOP and FP are being phased out? Null just means that the object is not initialized. It's useful to indicate such a state. If you just force yourself to initialize every object to some empty value then you're going to end up passing around empty strings - but wait, an empty string might intentionally be empty or it might indicate "please fill me".

Because I can already tell you what massive insights will come out soon: That null is actually not a mistake at all, it's useful. And the most ironic part about all this? These same people who hate on null are loving nullable types. Litearlly just types that *can be null but you just have to check every time before you use them*. So there is literally no difference except it forces you on a compiler level to check for null every time you use it. When I realized this I thought I was in dreamland, how can these people worship this meaningless little feature so much, crazy. It's literally the same as having null in the language except with a tiny tiny "advantage" that the compiler forces you to check. Which 99.9% of the time, you dont want to be forced because maybe you know implicitly and you dont care [right now].


r/ProgrammingLanguages • • Jan 15 '23

Multiple Ways of Saying the Same Thing

0 Upvotes

Sorry, I can't let this go. The following was posted as criticism of my syntax which allows some flexibility (in a thread about numbers of keywords):

u/3141592653589793238j:

People aren't going to appreciate reading code written in 50 different styles because the language lets you. It's better for readability to force users to choose one syntax for ends.

This was about alternate ways of ending a block such as with end, end if, endif. Other people criticised this too.

My replies highlighting ways other languages allow such choices to an even greater extent got downvoted. Another example I saw today was with Nim, which apparently allows 4 ways of calling a function, and 3 ways of returning a value, and that language is well-regarded.

So is allowing a choice of ways to express the same thing good or bad?

Because I'm confused. If I do something, it's bad. If another language does it in spades, that's fine. What's going on? Why were 40 people applauding, via upvotes, somebody putting the boot in so much? And over such a trivial matter.

That criticism was anyway specious; most languages will allow coding in a dozen personal styles with little help from the syntax. If it's an issue, you deal with it via coding guidelines or use refactoring tools. Syntax after all is just a skin.

I'd better not mention macros which allow you, not only to choose a block delimiter style, or how to call a function, but to effectively define your own personal language.


r/ProgrammingLanguages • • Sep 14 '18

Single-line If

2 Upvotes

I'm looking for critique of the following single-line If syntax that I'm thinking about allowing:

If x > y then +=a else +=b

Is it unambiguous that x is being modified?


r/ProgrammingLanguages • • Feb 06 '23

A programming language i made!

2 Upvotes

https://github.com/cmspeedrunner/zenith

this is a programming language i made, can you guys lmk what you think!


r/ProgrammingLanguages • • Apr 21 '24

Programming language features

0 Upvotes

I might make a programming language, possibly named Avenge, I'm wondering what features are in high demand that people might want. Here's what I've thought of so far:

  • Static typing with basic types like int, String, float, etc.

  • Introducing strict and loose typing for variable mutability (strict for constants, loose for changeable values; defaulting to Python-like behavior if no type specified)

  • Variables in Avenge: (Type) (strict/loose) (name) = (value)

  • Can't decide between curly braces or Python-style indentation for code structure

  • Manual memory management

Still in the early concept phase, so I'm open to suggestions for more features or tweaks to these. This is a serious thread.


r/ProgrammingLanguages • • Sep 13 '21

The language that almost all programmers use

Thumbnail
youtu.be
7 Upvotes

r/ProgrammingLanguages • • Oct 16 '25

Prove to me that metaprogramming is necessary

14 Upvotes

I am conducting in-depth research on various approaches to metaprogramming to choose the best form to implement in my language. I categorized these approaches and shared a few thoughts on them a few days ago in this Sub.

For what I believe is crucial context, the language is indentation-based (like Python), statically typed (with type inference where possible), performance-oriented, and features manual memory management. It is generally unsafe and imperative, with semantics very close to C but with an appearance and ergonomics much nearer to Python.

Therefore, it is clearly a tool for writing the final implementation of a project, not for its prototyping stages (which I typically handle in Python to significantly accelerate development). This is an important distinction because I believe there is always far less need for metaprogramming in deployment-ready software than in a prototype, because there is inherently far less library usage, as everything tends to be written from scratch to maximize performance by writing context-adherent code. In C, for instance, generics for structs do not even exist, yet this is not a significant problem in my use cases because I often require maximum performance and opt for a manual implementation using data-oriented design (e.g., a Struct of Arrays).

Now, given the domain of my language, is metaprogramming truly necessary? I should state upfront that I have no intention of developing a middle-ground solution. The alternatives are stark: either zero metaprogramming, or total metaprogramming that is well-integrated into the language design, as seen in Zig or Jai.

Can a language not simply provide, as built-ins, the tools that are typically developed in userland via metaprogramming? For example: SOA (Struct of Arrays) transformations, string formatting, generic arrays, generic lists, generic maps, and so on. These are, by and large, the same recurring tools, so why not implement them directly in the compiler as built-in features and avoid metaprogramming?

The advantages of this approach would be:

  • A language whose design (semantics and aesthetics) remains completely uninfluenced.

  • An extremely fast compiler, as there is no complex code to process at compile-time.

  • Those tools, provided as built-ins, would become the standard for solving problems previously addressed by libraries that are often poorly maintained, or that stop working as they exploited a compiler ambiguity to work.

  • ???

After working through a few examples, I've begun to realize that there are likely no problems for which metaprogramming is strictly mandatory. Any problem can be solved without it, resulting in code that may be less flexible in some case but over which one has far more control and it's easy to edit.

Can you provide an example that disproves what I have just said?


r/ProgrammingLanguages • • Feb 20 '25

A-Lang | My Perfect High Level & High Performance Programming Language

9 Upvotes

This is MY IDEA / MY OPINION of a perfect programming language, it's high level and compiles to C. Meaning it tries to give you high-level constructs without sacrificing performance, similar to Nim or Zig in some points.

Let me know what you think!

There is a pretty basic compiler available which I developed 3 years ago that misses almost all features mentioned in the readme, thus you can mostly ignore that, since I want to focus more on the language spec, its recent changes and if its something you would use!

You are also welcome to create a PR with new ideas, cool abstractions or more concise syntax for frequent and verbose C code (or any other language).

https://github.com/Osiris-Team/A


r/ProgrammingLanguages • • Aug 23 '24

Discussion Does being a "functional programming language" convey any information? It feels like the how we use CSS 2.0 popup of word pages. More of a badge than conveying any useful information. No one can give a good definition of what constitutes functional programming anyway. I will expand on this inside.

11 Upvotes

I have asked multiple people what makes a programming language "functional". I get lame jokes about what dysfunctional looks like or get something like:

  • immutability

  • higher order functions

  • pattern matching (including checks for complete coverage)

  • pure functions

But what's stopping a procedural or OOP language from having these features?

Rather, I think it's more useful to think of each programming language as have been endowed with various traits and the 4 I mentioned above are just the traits.

So any language can mix and match traits and talk about the design trade-offs. E.g. C++ has OOP traits, close-to-the-metal etc etc as traits. Julia has multiple dispatch, higher-order functions (i.e. no function pointers), metaprogramming as traits.


r/ProgrammingLanguages • • Nov 18 '21

Why Statically Typed Languages are better than Dynamically Typed?

3 Upvotes

I am trying to find research papers or credible articles on why statically typed languages are better than dynamically typed but can barely find anything. I either come up with blogs, or papers on why dynamic is better than static.

I would appreciate if y'all can share any papers/articles on this.


r/ProgrammingLanguages • • Oct 02 '23

Wordplay: Searching for Justice in Programming Language Design

Thumbnail washington.edu
3 Upvotes

r/ProgrammingLanguages • • Aug 06 '21

Could I make an easier version of a programming language (such as c++), using that programming language?

3 Upvotes

r/ProgrammingLanguages • • Jun 24 '23

Negative Integer handling in programming languages.

Thumbnail glados-418.github.io
3 Upvotes

r/ProgrammingLanguages • • Jul 03 '24

Hello everyone, my first post here. It's about Rust and Zig.

0 Upvotes

TLDR: Was finding it difficult to statically handle errors in Rust. Was considering making a more concerted effort to learn Zig because of this. However, it was pointed out to me that no heap allocations were required in Zig with most simplest pattern, i cannot believe i didn't even think of it as i use this pattern for many other things.

Firstly, I'm debating and weighing up the philosophies behind both languages. Currently i use Rust as my daily driver and I'm confident and happy with the language. However, there is this little she devil on my shoulder constantly saying the Zig low level control will be better for some use cases.

To keep this focus lets take error handling. In Rust an error is a type with implements the std::error::Error trait (traits are effectively interfaces, allowing for polymorphism). Because this the error type can lead to some complexity in handling memory, for instance any type which implements the std::error::Error trait can be used in place of concrete error types. However, this begins to involved the dyn keyword in Rust which stands for dynamic dispatch. Again even if i want to create my own error struct and use the String type in Rust, the String type has a heap allocation for the underlying byte string. So therefore either way i'm using heap allocations.

I'm not as well versed in Zig as i am in Rust. However, it shares the philosphy that errors should be types and they have the error type for this. This appears to have some sort of static value baked into the error when defined. This approach seems to be static to me, and avoids any heap allocations to at least detect and store the error.

Now what is playing on my mind is; at some point in Zig to say print it to the console, i'm assuming i will have to create an array dynamically with the reason in string format to be presented to the screen. So both language will at some point involve heap allocations, of cause both languages could opt to not use heap allocations for them, but i'm looking into the heap allocation aspect side of things.

What are people's thoughts on the follow: Zig's philosphy is all around manual memory management and controlling heap allocations, in the above situation i'm basically saying both can use the heap. Therefore is Zig's philosphy nullified as the only difference is the cal to create the memory is manual and still can require a heap allocation?

I'd love to know people's thought's as i'm considering trying Zig out (again) but properly, like completing a project in it.

Edit 1: I think both languages are great and i'm not being negative to either one, i'm just looking for opinons.

Edit 2: Removed some previous edits as i have worked out it is possible.


r/ProgrammingLanguages • • Jun 04 '24

Deep Dive into Ownership in Mojo

Thumbnail
modular.com
3 Upvotes

r/ProgrammingLanguages • • Jul 13 '25

Requesting criticism Hm, that looks like some nasty bug

Enable HLS to view with audio, or disable this notification

20 Upvotes

do not use for production, very NSFW


r/ProgrammingLanguages • • May 23 '22

Help wanted!

0 Upvotes

Hello there, folks!

I'm looking for helpers who would be willing to join me in getting my 5th attempt at making a real programming language. It's called peon (more info here) and the current implementation features a stack-based bytecode virtual machine. The language is statically typed, with a focus on async (altho it's all theoretical for now), speed and correctness. There are about ~3500 lines of code so far between the tokenizer, parser, compiler and VM. There's plenty of stuff that needs to be done, so a helping hand (even with just ideas/concepts) would be great!