Copper – A minimal low-level programming language with OOP and generics

163 points - last Friday at 7:09 PM

Source

Comments

teo_zero yesterday at 11:55 PM
I'd like to come up with some constructive comments, but I find everything so inconsistent and alien to me...

For example, variable declarations use the pattern <colon> <type>, as in

  var a: Int32
But literals follow the opposite syntax, as in

  a = Int32: 42
The return type of a function is introduced by : in func definitions, but by -> in imported func declarations:

  func foo(a:Int):Int
  import func bar(a:Int) -> (Int)
Other construct that I find far from my habits:

  var w, h, d = 640, 480, 2
instead of the more obvious (for me):

  var w=640, h=480, d=2
Arguments are passed by ref, not by val. Good luck with recursion!
Joker_vD yesterday at 10:11 PM
Surprisingly, the most irritating nitpick for me is the choice of the file extension — surely that should've been ".cu", not ".co"? If I were developing an e.g. Iron programming language (hypothetically — although perhaps so named a language already exists), I'd pick ".fe" in a heartbeat.

Then again, I'm the kind of person who've chosen $'.\U0001F9CC' (that is, $'.\xF0\x9F\xA7\x8C') for a file extension of my own toy language so...

gorgoiler yesterday at 8:46 PM
It’s nice they tried with a more fleshed out exemplar. Polymorphism (“generics”) and interfaces (“OOP”) would have been even better to see, especially across any kind of visibility boundary enforced by the language (packages, and the like.)

Programming to an abstract interface — and in large codebases, enforced visibility controls — represent the middle ground everyone wants, in my experience, between “OOP” and “sir, this is C”.

ricardobeat yesterday at 6:27 PM
As a Crystal fan, really nice syntax. The documentation leaves open several questions:

What is the memory model here? What does it compile to? What makes it 'low level'? Is there a GC? Does it have ABI compatibility with C or a FFI?

bogdanoff_2 last Friday at 7:09 PM
Not mine, but I found this to be really interesting as a language created by one person for their own use.

Also really interesting are the author's blog with articles on language design (for example his thoughts on exceptions, and how he added them to his language, then decided against them), and the change log for the language, showing its evolution.

https://tibleiz.net/

https://tibleiz.net/copper/changes.html

pull_my_finger yesterday at 5:48 PM
I need to put a disclaimer to say that I hate when people hijack a post about foo to talk about bar, but:

> The language is not object oriented but it provides some features to facilitate object oriented designs.

It has classes and implicit `self`. Not nothing, but I don't think it's incorrect to say has any more OOP than general purpose languages like Lua or JavaScript in that sense.

Something like Pony[1] is a more mature and feature rich entry and has a much better OOP story.

All that said: a) I'm sorry for doing the thing I hate when other people do

b) Creating a language is a big undertaking, and it's super cool that they did it

c) I see it seems to already be written in Copper too, which is also very neat!

[1]: https://www.ponylang.io/

mshockwave today at 6:51 AM
if every `=` is always a copy of reference, are we losing some "rvalue" optimizations? (I think Stateful Objects / Stateless Objects are basically lvalue / rvalue, respectively) For example, if a struct is small enough, even smaller than a pointer, and we know its address is never taken, wouldn't it be more profitable to just copy by values to avoid another pointer dereference? Furthermore, if only a single struct field (or attribute) is used, wouldn't it be more profitable to just pass that field value instead of passing around the reference to that struct, assuming there is no ABI issue? (the classic scalar replace of aggregate)
nirei yesterday at 6:53 PM
How does it free memory? I don't get it. I browsed the docs a bit but didn't find a single reference to deallocation. There's alloc for heap allocation but no free?
sinuhe69 yesterday at 6:39 PM
I wish the author has written about the motives behind the language and why someone should choose Copper. We have in fact more programming languages than we actually can use.
deleted today at 3:02 AM
DenisM yesterday at 4:17 PM
Garbage collected? Couldn’t tell from the docs.
skybrian yesterday at 4:25 PM
It seems pretty tasteful, but I don't see anything about character sets. How does it support Unicode? What does a string of 16-bit characters represent?

There do seem to be some Unicode constants in the standard library:

https://tibleiz.net/browser.html?path=std&title=Standard%20L...

flossly yesterday at 4:51 PM
Looks like Crystal to me. But with stronger typing.

https://crystal-lang.org

Neat little language...

leecommamichael yesterday at 5:11 PM
Seems like Dart with indentation instead of braces.
vardump yesterday at 10:42 PM
Hmm... Copper, I guess it must be great for representing lists. :-)
stevefolta yesterday at 6:20 PM
Looks nice and small. Too bad it doesn't quite actually build (on Linux). Also, no string interpolation (AFAIC) and no kebab-case.

Here's my current stab at a small compiled language: <https://codeberg.org/stevefolta/lx-2025>.

godockly today at 1:10 AM
It's a bit like temple os :/
reactordev yesterday at 10:14 PM
What about binding to external C ABI? I can haz Vulkan?
digitaltrees yesterday at 8:21 PM
Seems really interesting
desireco42 yesterday at 9:02 PM
Really hard to make opinion based on few small examples but I can say I like what I see, Ruby like syntax definitely doesn't hurt language.

Multiple return values are kind of weird, but maybe it is just me. Overall this is something I will give a try.

Vishal_Max yesterday at 5:42 PM
The simplicity is appreciated.
mwkaufma yesterday at 6:41 PM
"Copper is a programming language that I use as a replacement to C."

That's used... to make what?

analog8374 yesterday at 4:55 PM
This might be my new favorite language. Deeply sane.
jdw64 yesterday at 3:41 PM
It’s similar to Python syntax.
Panzerschrek today at 5:07 AM
Is it memory safe? Or is it yet another "better C"?
blenser4 today at 8:07 AM
[dead]
railmaniac today at 4:52 AM
[dead]
ihateaislop today at 6:42 AM
AI slop
Fervicus yesterday at 7:18 PM
This seems to have a lot of potential, but there are important details missing. Hopefully the feedback from this thread will result in those questions getting answered by the author soon.
small_model yesterday at 6:58 PM
I think the days of releasing new programming languages is gone, it's like releasing a new punch card format. Humans don't code anymore and so programming language is really a choice LLM's make for you.