#The things that i'm worrying about Ziglang

1 messages · Page 1 of 1 (latest)

wintry finch
#

Lack of documentation

Ziglang has literally no documentation. The whole documentation, even some parts of the examples do not work in current versions. Most of the time you have to look into another source or AI tools. Also, most of the functions in the std lib do not even have comment lines.

I'm using ziglang over 1 year as my main programming language. I built some stuff on it. I'm literally try to do everything with ziglang. But i started to get overfrasturated in Ziglang for various reasons. Here's some of them

Just check this error message. I don't have any idea about what is going on.

String handling

Ziglang does not have a built-in string implementation or a library like string.h.

No official package repository

Ziglang does not have an official package repository in it. Even they added some package management stuff in 2023 and that makes the ecosystem grow so slow besides if we compare with rust builtin package repository crates.io

No support for old versions,

In every release they change the features and you have to update everything from scratch in every single release. For example they highly changed std.net stream server 0.12.0 to 0.13.0 for some reason it became worse than before.

#

I really got frasturated ziglang because of this reasons. I guess i'll look at to c3lang

vagrant tartan
#

The language is called Zig…

gleaming depot
#

no package repo is an intentional design decision

#

zig does have builtin functions in the stdlib to handle strings

slow zealot
#
  1. There is some documentation. If there isn't docs for something, you can can often figure out how to use it by looking at tests or the source
  2. What are you looking for here exactly? Built in string types just make compromises and often have weird edge cases. std.mem, std.ascii, and builtins really replace all the usecases of string.h afaik
  3. I would say the slow ecosystem is due to breaking changes
  4. You don't have to update. The language is developing and Andrew has made it very clear he is willing to break things
gleaming depot
#

std.unicode also exists alongside std.mem and std.ascii

rocky cloud
#

to add to 3.
zig wont have an official package registry (afaik?), the entire point of the package system is to be decentralized.

#

4, it's a 0.x project, it's allowed to (and supposed to) induce breaking changes when updating minor version in 0 major version

gleaming depot
rocky cloud
#

yea, that's what i meant

wintry finch
#

How about error messages?

#

At least we could agree on it

rocky cloud
#

i believe they provide the necessary information for a medium skill zig user. i can agree that some of them can be a bit confusing the very first time you read it, but after you understand it, it's not a problem anymore.

slow zealot
#

You also forgot to post your example error message

wintry finch
# slow zealot 1. There is some documentation. If there isn't docs for something, you can can o...
❯ zig build       
install
└─ install 3cvm
   └─ zig build-exe 3cvm Debug native 1 errors
/Users/hootie/.cache/zig/p/1220f26d3185d87c40258791ff83a2e03b67e7a9a6973f7a790eabdee4f5e643e84b/clap.zig:939:60: error: no field named 'version' in anonymous struct 'struct{comptime string: fn ([]const u8) error{}![]const u8 = (function 'string'), comptime str: fn ([]const u8) error{}![]const u8 = (function 'string'), comptime u8: fn ([]const u8) error{Overflow,InvalidCharacter}!u8 = (function 'parse'), comptime u16: fn ([]const u8) error{Overflow,InvalidCharacter}!u16 = (function 'parse'), comptime u32: fn ([]const u8) error{Overflow,InvalidCharacter}!u32 = (function 'parse'), comptime u64: fn ([]const u8) error{Overflow,InvalidCharacter}!u64 = (function 'parse'), comptime usize: fn ([]const u8) error{Overflow,InvalidCharacter}!usize = 
#
/Users/hootie/.cache/zig/p/1220f26d3185d87c40258791ff83a2e03b67e7a9a6973f7a790eabdee4f5e643e84b/clap.zig:982:28: note: called from here
        const T = ParamType(Id, param, value_parsers);
                  ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/hootie/.cache/zig/p/1220f26d3185d87c40258791ff83a2e03b67e7a9a6973f7a790eabdee4f5e643e84b/clap.zig:677:24: note: called from here
        args: Arguments(Id, params, value_parsers, .slice),
              ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
    main: /Users/hootie/.cache/zig/p/1220f26d3185d87c40258791ff83a2e03b67e7a9a6973f7a790eabdee4f5e643e84b/clap.zig:676:12
    main: /Users/hootie/.zvm/master/lib/std/start.zig:618:37
    3 reference(s) hidden; use '-freference-trace=5' to see all references
error: the following command failed with 1 compilation errors:
/Users/hootie/.zvm/master/zig build-exe -ODebug --dep clap -Mroot=/Users/hootie/code/c3vm/src/main.zig -Mclap=/Users/hootie/.cache/zig/p/1220f26d3185d87c40258791ff83a2e03b67e7a9a6973f7a790eabdee4f5e643e84b/clap.zig --cache-dir /Users/hootie/code/c3vm/.zig-cache --global-cache-dir /Users/hootie/.cache/zig --name 3cvm --zig-lib-dir /Users/hootie/.zvm/master/lib/ --listen=- 
Build Summary: 0/3 steps succeeded; 1 failed
install transitive failure
└─ install 3cvm transitive failure
   └─ zig build-exe 3cvm Debug native 1 errors
error: the following build command failed with exit code 1:
/Users/hootie/code/c3vm/.zig-cache/o/bbb6cc37d63b7f55934980f8937c3622/build /Users/hootie/.zvm/master/zig /Users/hootie/.zvm/master/lib /Users/hootie/code/c3vm /Users/hootie/code/c3vm/.zig-cache /Users/hootie/.cache/zig --seed 0x251ddd45 -Zf84d53a562049bc
#

welp

#

i got sick errors like that

#

or you know when you forgot to format your print

#

or string without s

#

it does not saying the line of it

shadow pilot
shell root
#

probably because a language change broke it :P

shadow pilot
shell root
wintry finch
#

(imma cry)

#

i guess i will replace by ai

tardy lark
#

AI isn't replacing anything

knotty yarrow
#

...those are mostly good things tbh... high level string objects like std::string or Python strings are a trap, since proper string handling is inherently complex (who owns the memory, where is the memory, how long is that memory alive, what is the text encoding, should strings be immutable or mutable, should they be interned or not, copy-on-write or not, UTF-8, UTF-16 or UTF-32 encoded by default? should toupper/tolower and alphabetical sorting be supported only for ASCII or for all UNICODE strings etc... etc...), Zig has actually pretty good support for string processing once you realize that strings are just byte slices (e.g. the 'string.h' you're looking for is std.mem).

Not having a centralized registry is also a good thing, what would be good later when the dust has settled is a 'curated registry' for semi-official packages supported by the Zig team. But everything else should not be centralized IMHO.

The breakage between versions has actually settled down quite a bit. It's much better than between 0.10 and 0.12.

#

....from reading the C3 docs, their string handling doesn't look all that different. They just have the byte slice typedef'ed as 'String'.

warm smelt
tardy lark
#

"strict typedef"

warm smelt
#

If you say "typedef" for a C-like, people will assume an alias.

#

A distinct type is not an alias and follows different rules, which is fairly significant in this particular case.

dire fractal
#
  1. Zig has documentation. It's right on ziglang.org, the official website for the language, with prominent links. What you certainly mean is that it has bad SEO. Searching the entire web, or asking an AI, instead of going to directly to the official documentation and becoming familiar with it, is a technique that only works for languages that have been very popular for a long time. And even for those languages you'll find version-inappropriate information, stale information, or bad information. If you're going to be in tech you should get comfortable with official documentation. The xkcd joke about how you can be an instant expert on everything because you're an expert on "Googling", it was always a lie and you don't want to be that coworker.

  2. You can do everything, right now, that you would want to use with the string.h you looked for, but you don't know how to do it because you don't know where to look. Get familiar with the structure of the standard libraries, ask specific questions, and you'll get this stuff. A book like "String Handling in Zig From Scratch In 24 Hours" would be a helpful alternative but that book's relationship to the std docs is that of a museum tour guide's relationship to the museum. Tour guides would be nice, but you still have the museum.

  3. That'd be nice, and I've seen three websites for tracking Zig packages already,. Maybe one of them will take off well enough that 'zig fetch' and ziglang.org gain links to it as a fait accomplis. Fleshing out package management before getting a registry makes things a bit easier in the long run. Other communities (Perl, D, Nim) have had a lot of trouble with trying to make an only adequate solution more flexible after the roots had dug in.

  4. This is a problem but you should've been warned about it. Zig's not stable. Its featureset isn't stable. Things get removed as well as added, or changed a great deal, from the standard library and the core language.

#

I don't actually know where the 'warning' is. Maybe it's not as prominently displayed anymore. It was something like "if you use Zig, you should be prepared to participate in the development of the language."

#

Problem 4 is a problem that'll go away as the compiler's developed, and probably with big fanfare.
1-3 are all documentation/popularity problems. But the AIs still won't give good answers until 4 goes away. Anyone can improve the "string.h situation" as simply as writing up stuff like https://pleac.sourceforge.net/ on zig.news or the like.

knotty yarrow
warm smelt
knotty yarrow
warm smelt
#

Well, C could always fake the aliases with #define