We are building a new systems programming language
drewdevault.com
drewdevault.com
for (let i = 0z; i < len(greetings); i += 1) {
for (let greeting in greetings) { for i := 0 to len(greetings) do
and if bigger increments are desired, e.g. for i := 0 to len(greetings) step 2 doIt may introduce some extra syntax/keywords though, which could be against what seems to be a minimalist approach (from the sample).
for greeting in greetings do
is more readable if nothing interesting is done with the counter itself. for x of Some_Array loop
for i in Some_Array’Range loop
Allowing you to do the appropriate thing for your situation.As a matter of fact, Object Pascal/Delphi uses the for in syntax when it doesn't matter.
The transformation into a while loop is a handful of lines of code (unless your implementation language sucks). It's not difficult for simple iterators (but can get dense for more generic constructs like generators).
Yes.
> but probably it's a lot more work
No, at least not if you want to limit yourself to arrays, this is a trivial thing for a compiler frontend to handle. For example, the parser could already translate the "iterator for" loop syntax into exactly the same representation as it would produce for the "counter for" loop syntax.
The javac compiler for java does this: It transforms loops over arrays using iterator syntax into "normal" counter loops. Loops using iterator syntax over non-arrays are compiled to use iterator objects.
I think the answer is probably yes until such time that people choose a language over C as the default for those use cases.
It still hasn't happened although C++, Rust, and even Go are chipping away at it.
Rust does want to be useful in the same niches where both C and C++ are useful, among other niches and languages in those niches.
Although the resulting library is a little bit heavy (1-2MB) because it bundles the Go runtime and GC, and initializes it on first load.
Unless they're all on the same page (because why not?), there must be something compelling about it.
From that perspective, it makes about as much sense designing a framework versus a language, relative to a library.
The question then to justify a new language is to justify whether it could have been done with about as much benefit, but on a higher tier (thus, lower effort, for both the developer and the user)
First:
> we want the first release to be a complete, stable, production-ready programming language with all of the trimmings
so arguably drew is ahead of zig. My understanding is that Zig is being open now (there's a major breaking syntax change in the pipeline), but will be very conservative about what goes into 1.0, so there is a lot of tying off loose proposals and finishing out the language, and documenting everything ahead of getting to 1.0. That's going to a while with such a large community as zig's.
Second:
I'm guessing this new language will have less complexity in the "comptime" space. The syntax is really close. If I had drew's ear, I would almost have him write the spec to match Zig and market it as Zig--.
Coda
I'm a huge zig fanboy, and if it is up to being a "competition" I would guess that zig will do better. 1) Andrew is extremely skilled at figuring out? (marshalling?/delegating?/not overdoing?) the social/branding/growth of the language. 2) having had a more open initial design, Zig will cover far more interesting ground than drew's language. 3) I don't know if this is deliberate or accidental, but it seems to me Zig is following microsoft's "Embrace, Extend, Extinguish" philosophy quite well, with a holistic view of not just building a better language, but also replacing C toolchain components: killing make/automake/cmake, replacing cc, and now replacing ld, these are huge painpoints in the C ecosystem... On the other hand maybe it's not best to think too hard of programming languages as 'competing entities'.
For any systems language, interop with C is the litmus test.
With that in mind, this new language should not require 15,000 lines of standard library. A type-safe wrapper for libc should be enough...
The standard C library is not great. There's a lot of dangerous cruft in there (gets), as well as cruft with various gotchas (sscanf; see the recent hoopla about it being linear in the length of the string even if you just want to read a fixed-length prefix). It absolutely makes sense to design new, safe, consistent libraries along with a new language.
THAT SAID, I shudder at the idea of people writing yet another library for "Hashing • encryption • key derivation • TLS • etc".
The syntax has a very Golang flavor and looks very clean.
A strange question though: Would those of us who are bald (like me) be eligible to contribute?