ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<MajorLag>
andrewrk, evidence that making `[]null const u8` the default and implicit casting to `&const u8` and `[]const u8` is the right move: I basically just implemented this behavior in a struct to make it smoother to talk to syscalls.
<jab>
do you guys get a massive amount of warnings when building?
<jab>
like: ld: warning: direct access in function 'llvm::OnDiskChainedHashTableGenerator...
<jab>
woo! got builds working
<andrewrk>
alright, done with day job
<andrewrk>
zig time!
<andrewrk>
MajorLag, noted
<andrewrk>
MajorLag, that's a keen observation that the same kind of code that could give you non-null-terminated string literals if the default was null-terminated, could give you null-terminated if the default is non-. I hadn't considered that
<andrewrk>
jab, yes I made libsoundio. I'm really just trying to make music, but I don't have a good enough language to build my digital audio workstation in yet ;)
<GitHub19>
[zig] andrewrk closed pull request #865: skeleton stage 2 support for 'zig build' (master...zig-build-stage2) https://git.io/vxaGE
<andrewrk>
you can also do something like: const foo = comptime { };
<andrewrk>
and then do any arbitrayr computation in the comptime block to come up with your static data
<curtisf>
Thanks, that seems obvious now, it might be a bit too late
cenomla has quit [Quit: cenomla]
jdufault has joined #zig
curtisf has quit [Quit: Page closed]
jdufault has quit [Ping timeout: 256 seconds]
tiehuis has joined #zig
return0e has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
Hejsil has joined #zig
tiehuis has quit [Quit: WeeChat 2.1]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
<Hejsil>
andrewrk, The self hosted compiler is trying to lookup the stage 0 libs in {cmake_dir}/zig_cpp/{libname}.a, but my stage 0 build outputs the libs into {cmake_dir}
<Hejsil>
Bug, or am I building stage 1 wrong?
<Hejsil>
I see the program. I need to make install for it to work
<Hejsil>
problem*
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk>
walac, that comment is incorrect. Deleting it now
<walac>
andrewrk: ok. Btw, any interest in converting the parser to a gen tool, like bison?
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
<andrewrk>
walac, nope. why?
<walac>
andrewrk: well, I found use a parser generator makes easier to build a correct parser given the grammar, and the code becomes easier to understand (that part is a personal view). The downside is to learn a new tool syntax
<walac>
I was thinking on making an experiment on converting the parser to bison and see how it goes
<andrewrk>
I think it makes it difficult to have error messages exactly how you want them
<andrewrk>
that also introduces another system dependency
<walac>
That's a good point, but I believe the C++ implementation will be replaced by zig one in the near future, right?
<jab>
This is beautiful: #define ICE_P(x) (sizeof(int) == sizeof(*(1 ? ((void *)((x)*0l)) : (int*)1))
<andrewrk>
walac, correct - the self hosted parser in fact already exists and supports a subset of zig syntax
<andrewrk>
it uses an arena allocator and no recursion
<andrewrk>
the API is exactly what we want, no global variables, it integrates directly with the tokenizer
<andrewrk>
it's kind of hard to want something else
<andrewrk>
jab, I don't understand - it looks like it dereferences a void * which should be a compile error
<walac>
andrewrk: for the zig implementation I think it justifies a hand-crafted parser, but for C++... that code will die anyway... Where is the zig implementation? Under src-self-hosted/ dir?
btbytes has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
return0e has joined #zig
btbytes has joined #zig
btbytes has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jab>
haha, i was thinking about doing that
<jab>
glad my efforts weren't wasted
return0e has quit [Ping timeout: 248 seconds]
<andrewrk>
tiehuis is a machine
jjido has joined #zig
cmwt has joined #zig
<cmwt>
I just learned about Zig. I was wondering if there has been any discussion over having variables and objects be `const` by default? I am just curious.
<Hejsil>
I don't think there is a default
<Hejsil>
Pick 'var' if you want mutablility. Pick 'const' if you dont
<curtisf>
does zig have "pointer to const", or does it behave more like Java's final / JavaScript's const where it only prevents modification of the value at the variable itself?
<Hejsil>
Yes, zig have pointer to const.
<Hejsil>
Taking pointer of a const, gives pointer to const. Taking pointer to var gives normal pointer. Normal pointer casts to const pointer, but not the other way around
<Hejsil>
"Normal". Let's call them mutable pointers instead
<cmwt>
@Hejsil, Thank you for telling me.
<curtisf>
I'm assuming a holder of a pointer-to-const cannot assume that the pointed-to data doesn't change, it's just a restriction on syntactically being able to modify the object through that pointer. Is that right?
<Hejsil>
Yes
<Hejsil>
Const pointers are not safe from concurrency
<Hejsil>
Also, const values can have fields that are mutable pointers
<jjido>
Does Zig have generators? They are also concerned with weak const-ness
<Hejsil>
andrewrk is working on coroutines, but I don't know how useful they will be for generators
<Hejsil>
I haven't played with them yet
<curtisf>
I'm going to be asking a lot of questions, thanks in advance for being helpful. What is the nicest way to write a loop 0 to len - 1? I wanted to iterate over two slices of the same length
<jacobdufault>
re coroutines, do the coroutines have an associated stack (ie, yielding in nested function calls)?