News for hackers. Stuff that matters.
Re:Zinc, a systems programming language prototype by higherhalf on Wednesday March 12, 2025 @10:06PM (#43349713)
What makes this a "systems programming language", especially since it has "no pointers or references"?
Re:Zinc, a systems programming language prototype by fc417fc802 on Wednesday March 12, 2025 @10:17PM (#43349781)
Indeed, that makes it not a systems language by any definition I am familiar with.

> Reasonable C interop, and probably, initial compilation to C.

How do you achieve "reasonable C interop" without pointers, I wonder?

Re:Zinc, a systems programming language prototype by apgwoz on Wednesday March 12, 2025 @10:48PM (#43349938)
You cast integers to pointers and play with fire, of course!
Re:Zinc, a systems programming language prototype by fc417fc802 on Wednesday March 12, 2025 @11:54PM (#43350232)
Void*? Int. Char**? Also an Int. I take it back. This is true systems programming - the same type safety that raw assembly is known for.
Re:Zinc, a systems programming language prototype by pjmlp on Thursday March 13, 2025 @08:08AM (#43352456)
Ironically Assembly is safer than C and languages that descend from it, because although CPUs might have undefined behaviour when given undocumented opcodes, or operation modes, the CPU doesn't rewrite your code without telling you about it.
Re:Zinc, a systems programming language prototype by AnimalMuppet on Thursday March 13, 2025 @10:01AM (#43353460)
That's "safer" only against a very specific and limited set of dangers. But it opens the door to other dangers.
Re:Zinc, a systems programming language prototype by fithisux on Thursday March 13, 2025 @04:33PM (#43356977)
Yes it is. Great comment.
Re:Zinc, a systems programming language prototype by pjmlp on Thursday March 13, 2025 @08:06AM (#43352437)
Naturally with PEEK and POKE.
Re:Zinc, a systems programming language prototype by porridgeraisin on Wednesday March 12, 2025 @11:13PM (#43350058)

  int ptr
Re:Zinc, a systems programming language prototype by GoblinSlayer on Thursday March 13, 2025 @03:22AM (#43351006)
The term was introduced so long ago, it's basically prehistoric now. Pointers are needed only for system programming language, they can be absent in systems programming language.
Re:Zinc, a systems programming language prototype by DeathArrow on Thursday March 13, 2025 @03:31AM (#43351039)
I wonder the same, but aren't pointers just integers?

So if you store a memory address in the integer variable X, you just need a way to access that memory.

In assembly languages, usually, you have no pointers.

Re:Zinc, a systems programming language prototype by tialaramex on Thursday March 13, 2025 @04:34AM (#43351309)
Interestingly although all of C's other types are in fact just the machine integers wearing funny hats (e.g. char is just either a signed or unsigned byte depending on platform, float is just the 32-bit unsigned integers as binary fractions) the pointers are not actually just integers.

They could be, but it's much worse from a performance perspective if you just have these raw machine addresses rather than the pointers in the C language so actual C compilers haven't done that for many years. ISO/IEC TS 6010 describes the best current attempt to come up with coherent semantics for these pointers, or here's a Rustier perspective https://www.ralfj.de/blog/2020/12/14/provenance.html [today Rust specifically says its pointers have provenance and what that means, like that TS for the C language]

Now, if you read Ralf's post and want to argue about that I'm afraid there are already lots of HN discussions and your point has probably already been made so: https://news.ycombinator.com/item?id=25419740 or https://news.ycombinator.com/item?id=42878450

Re:Zinc, a systems programming language prototype by SkiFire13 on Thursday March 13, 2025 @03:45PM (#43356615)
> float is just the 32-bit unsigned integers as binary fractions

Note that float and double are a bit particular because they can use different registers! But yeah, when stored in memory they are the same 32/63 bit integers.

Re:Zinc, a systems programming language prototype by pjmlp on Thursday March 13, 2025 @08:07AM (#43352446)
Like we did in BASIC, with PEEK and POKE, just have to keep track what those numbers are for.