Live data from Hacker News

Zig: The Modern Alternative to C

infoworld.com

1–10 of 181 posts

Re: Zig: The Modern Alternative to C

#6
A quote from the article:

> A distinctive feature of Zig is that it does not deal with memory allocation directly in the language. There is no malloc keyword like in C/C++. Instead, access to the heap is handled explicitly in the standard library.

I guess it is all you need to know about the article quality.

Re: Zig: The Modern Alternative to C

#8
post #6

A quote from the article: > A distinctive feature of Zig is that it does not deal with memory allocation directly in the language. There is no malloc keyword like in C/C++. Instead, access to the heap is handled explicitly in the standard library. I guess it is all you need to know about the article quality.

The point that paragraph is trying to make but articulates imperfectly is that you explicitly pass an Allocator to the stdlib routines that allocate -- rather than having them allocate on the heap implicitly.

Re: Zig: The Modern Alternative to C

#9
post #3

What is Zig's async story? Is there something like Go's coroutines?

No, it's 'code transform' async-await as is fashionable these days, but with the advantage that it's 'color blind' (the compiler will do the async transform or not based on the caller's expectation).

See: https://kristoff.it/blog/zig-colorblind-async-await/

Re: Zig: The Modern Alternative to C

#10
post #8
post #6

A quote from the article: > A distinctive feature of Zig is that it does not deal with memory allocation directly in the language. There is no malloc keyword like in C/C++. Instead, access to the heap is handled explicitly in the standard library. I guess it is all you need to know about the article quality.

The point that paragraph is trying to make but articulates imperfectly is that you explicitly pass an Allocator to the stdlib routines that allocate -- rather than having them allocate on the heap implicitly.

Yes, but it still is a part of the standard library and how the standard library does things - a convention. Same as in C, as malloc is just a function. You could create a replacement library for C stdlib and it could also expect an allocator in the parameters if a given function could allocate.
Post reply on HN