r/ProgrammingLanguages • u/breadcodes • May 30 '26
Requesting criticism First time lang dev. How far would you change an existing language before calling it something else?
Essentially, I'm working on a Swift derivative for a specific target (LLVM backend targeting ARMv4T). At first, I thought, "I want to make Swift for the Game Boy Advance," but as time has gone on, I have taken several liberties and maybe defeated the purpose of Swift.
For example, I added a @volatile attribute to a new raw pointer type, which looks like:
@volatile(at: 0x0400_0000) var REG_DISPCNT: UInt16
// mode 3 framebuffer
// 240*160 BGR555 pixels at the start of VRAM
@volatile(at: 0x0600_0000) let vram: VolatilePointer<UInt16>
func plot(_ x: Int, _ y: Int, _ c: Color) {
vram[y * 240 + x] = c.raw
}and while I like this syntax for volatile pointers and array pointers... aren't I just recreating C?
I feel like maybe I'm not getting the "Swift way" of doing this. Should I just hide these types behind a standard library, and give access to these memory-mapped addresses via types that are more user-friendly? Should I always give access to these pointer types and let the user access as needed?
Then there's things like inline assembly support, or function pointers, or the fact that I don't accept conditional types yet, or arbitrary unicode variable/constant names, or globals, etc, etc
The end goal is not only a language, but a GBA-stdlib and a Butano-esque library written in my Swift-derivative, using Swift patterns. I can see the API for the latter two, but there are just some cases where you need raw assembly or volatile pointers to arrays for this hardware... should I just cover these myself via an API and not subject the user to these, as to keep with the Swift patterns? Should these require C externs via linking? Should I say screw-it and give a C-like way to access these pointers? I feel that the language should support it, but the "engine" should hide it, but then I create a diverging language and should call it something else.