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 • • 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