ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
quc has quit [Ping timeout: 245 seconds]
hoppetosse has quit [Ping timeout: 276 seconds]
darithorn has left #zig ["Leaving"]
<stratact> andrewrk: does Zig have generic functions?
<andrewrk> stratact, yes. any function which has a comptime parameter
<stratact> thanks, I'll look into comptime
<stratact> andrewrk: I got a minor suggestion about the array syntax. Would it be possible to replace the use of curly braces around the items, with square brackets, cause square brackets just looks "nicer" in modern syntax
<stratact> unless it's for a C compatibility thing?
<andrewrk> stratact, that might be a natural consequence of when we add tuples
<stratact> andrewrk: I'm in agreement with what alexnask said in that issue
<andrewrk> noted
Ichorio has quit [Ping timeout: 256 seconds]
dbandstra has joined #zig
very-mediocre has joined #zig
xtreak has joined #zig
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
fjvallarino has quit [Ping timeout: 265 seconds]
daritest has joined #zig
darithorn has joined #zig
daritest has quit [Remote host closed the connection]
kristate has joined #zig
fjvallarino has joined #zig
dbandstra has quit [Quit: Leaving]
kristate has quit [Remote host closed the connection]
kristate has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
kristate has quit [Ping timeout: 260 seconds]
davr0s has joined #zig
darithorn has quit [Remote host closed the connection]
mahmudov has joined #zig
quc has joined #zig
JinShil has joined #zig
toomuch has joined #zig
hoppetosse has joined #zig
alexnask_ has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hoppetosse has quit [Ping timeout: 240 seconds]
davr0s has joined #zig
xtreak has quit [Remote host closed the connection]
JinShil has quit [Quit: Leaving]
zolk3ri has joined #zig
SimonN has quit [Remote host closed the connection]
xtreak has joined #zig
xtreak has quit [Read error: No route to host]
xtreak has joined #zig
mahmudov has quit [Ping timeout: 245 seconds]
xtreak has quit [Ping timeout: 264 seconds]
noonien has joined #zig
very-mediocre has quit [Ping timeout: 252 seconds]
zolk3ri has quit [Ping timeout: 256 seconds]
zolk3ri has joined #zig
unique_id has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mahmudov has joined #zig
<unique_id> Hi. I've been here before under a different nic. Don't remember it. Anyways, I think it's time I start writing some code in zig :)
<unique_id> I find it really difficult to choose between a "better C" and a "better C++" (c++20 and onwards). Both are great choices.
<unique_id> though one comes with a life long learning curve while the other one forces me to learn casting again :)
<MajorLag2> You get used to the casting pretty quick. Thing about it is, you ask yourself: "is there a cost, or potential hazard, to casting between these types?" and if the answer is yes then it shouldn't be implicit. So it's worth re-learning I think.
<unique_id> Yeah I need a break from C++. I haven't had good experience with importing C headers so I'll do some manual translation instead.
hoppetosse has joined #zig
<unique_id> How do I look at the code zig generates when importing c headers?
<unique_id> So I can learn the way c headers are translated
<unique_id> I could have sworn there was something, maybe some utility?
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
<MajorLag2> `zig translate-c file.c`. This will dump to stdout, so you may want to redirect.
davr0s has joined #zig
alexnask_ has quit [Ping timeout: 264 seconds]
toomuch has quit [Ping timeout: 252 seconds]
mahmudov has quit [Ping timeout: 248 seconds]
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
<ltr__> can we currying with zig?
fjvallarino has quit [Ping timeout: 240 seconds]
Avinash has joined #zig
<andrewrk> ltr__, I don't think so
fjvallarino has joined #zig
alexnask_ has joined #zig
alexnask_ has quit [Ping timeout: 268 seconds]
Ichorio has joined #zig
darithorn has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
<GitHub130> [zig] andrewrk closed pull request #1195: Fix crash on assertion for enum switch values (master...switch-enum-fix) https://git.io/fbpOR
<GitHub29> [zig] andrewrk pushed 4 new commits to master: https://git.io/fNeC9
<GitHub29> zig/master 1a5bd88 Andrew Kelley: alternate implementation of previous commit...
<GitHub29> zig/master 9cff23d Isaac Hier: Fix assertion crash on enum switch values
<GitHub29> zig/master 9395162 Isaac Hier: Debug enum issue
Avinash has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
quc has quit [Ping timeout: 265 seconds]
l1x has joined #zig
Bas_ has joined #zig
Avinash has joined #zig
<andrewrk> I'm confused. I just pushed changes to ziglang.org but it seems the css style sheet is not being applied to the HTML
<andrewrk> ok fixed. it was s3cmd using python-mime library which didn't get the correct value for css files
<darithorn> was just gonna say it wasn't loading any CSS for me then it all of a sudden was fixed
<darithorn> i like the new look :)
<andrewrk> thanks to r2453
<stratact> andrewrk: 👍
daritest has joined #zig
daritest has quit [Remote host closed the connection]
daritest has joined #zig
daritest has quit [Remote host closed the connection]
hoppetosse has quit [Ping timeout: 260 seconds]
daritest has joined #zig
Avinash has quit [Quit: Textual IRC Client: www.textualapp.com]
daritest has quit [Remote host closed the connection]
daritest has joined #zig
<Bas_> Hey hey, I recently found out about Zig and it looks really promising. Pretty much what I wanted from a language.
<andrewrk> hi Bas_
<Bas_> I was wondering if you guys have any equivalent to restrict in C. And all I could find about aliasing was this https://ziglang.org/documentation/master/#Type-Based-Alias-Analysis
<Bas_> Which also made me wonder why there is an exception for u8
<Bas_> I know it's the same in C/C++
<andrewrk> Bas_, yes, we have `noalias` which you can put in front of a parameter
<andrewrk> looks like it's not documented, so I made a note to myself to add those docs
<Bas_> Ah cool.
<andrewrk> see also https://github.com/ziglang/zig/issues/1108 which proposes a way to have noalias be the default (with safety checks)
<Bas_> Nice, iirc Fortran does the same.
<Bas_> Another thing I couldn't really find an answer to was generics and how it handles custom types. For example if I want to print my custom struct, can I somehow make printf do that?
<andrewrk> ah good question, I don't remember if there is an issue open for that. zig's compile-time reflection is powerful enough to support printing custom types, plus I believe there is a plan to have std.fmt.format() call a custom formatting function if it exists. let me check
<andrewrk> Bas_, so if your custom type has a `format` method then you can use std.fmt.format() on it (std.fmt.format is used by all the formatted print functions such as std.debug.warn)
<Bas_> Ah alright.
<Bas_> Ah I see. I really like how you can just code stuff, instead of having to use arcane template magic or anything.
<andrewrk> I do think the comptime stuff came out quite nicely :)
<Bas_> Yes, it definitely looks good.
<Bas_> One other thing. Are there any plans for having multiple return values?
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
<andrewrk> Bas_, yes, that would be this issue: https://github.com/ziglang/zig/issues/208#issuecomment-393777148
<andrewrk> I don't think I mentioned it in the proposal but you'd be able to use `var a, var b = foo()` syntax to unpack a tuple return value
<Bas_> Awesome.
mahmudov has joined #zig
daritest has quit [Remote host closed the connection]
andi3 has joined #zig
<andi3> new website style looks great !
<andi3> maybe this is stupid but is there any stdlib docs yet/ plans?
davr0s has joined #zig
quc has joined #zig
<andrewrk> plan is to implement that in the self hosted compiler
<andrewrk> which I'm working on full steam ahead
<andrewrk> potentially even the docs before any other kind of compilation
Hejsil has joined #zig
<stratact> andrewrk: you being the developer, I like how open you are to users suggestions, where not many folks from other languages aren't, so that's a plus for Zig imo
<andrewrk> I'm super open to the discussion but sadly I have to say "no" to a lot of ideas because one of the main selling points of zig is simplicity and lack of features
<stratact> yeah of course, I mean within suggestions to fit Zig's goals
<andi3> ok really good to hear
<andrewrk> my goal right now is to have the self hosted compiler watching all the source files - even for doc generation - and automatically recompiling
<andrewrk> so you would be able to edit docs in your editor, press save, and then refresh your browser and the docs would be updated
<stratact> sounds cool
<Bas_> Oh cool, you have a building build system!
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
daritest has joined #zig
daritest has quit [Remote host closed the connection]
<Hejsil> Curse you compiler bugs! I want this to work!
<Hejsil> I think slice to void crashes the compiler
<MajorLag2> clever
daritest has joined #zig
<Hejsil> We don't need no "range" for
<Hejsil> It seems the compilerdoesn't like `for` on void slice
<Hejsil> This works though http://termbin.com/hkoi
<andrewrk> I'll have a look
<andrewrk> oh that's really clever
<andrewrk> i'll fix the bug
<Hejsil> Btw, FixedBufferAllocator is a great easy way to see how much something allocates
<andrewrk> yep
<andrewrk> did you see as well, std.debug.FailingAllocator?
<Hejsil> Yes i did
<andrewrk> to test your error handling
<Hejsil> Ye, I should probably do that to
<Hejsil> And the static build of Zig is great CI!
<andrewrk> oh nice! that makes sense
<andrewrk> Hejsil, did you see that I have a proof of concept of multiplexing coroutines onto a thread pool working?
<Hejsil> I did
<Hejsil> Exiting stuff
<andrewrk> unfortunately we can't tell how fast it is yet because there's an outstanding llvm bug that is forcing us to disable optimizations for async functions
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
<GitHub152> [zig] andrewrk pushed 2 new commits to master: https://git.io/fNeyM
<GitHub152> zig/master 1cf7511 Andrew Kelley: add compile error notes for where struct definitions are...
<GitHub152> zig/master 6d793c0 Andrew Kelley: langref: add more internal links
<stratact> So in Zig, are all types themselves except without pointers, copyable? Like there is no "move" in which you can't access the types again?
<stratact> *access the values
<andrewrk> I want to get to a place where we can say: "the only hidden memcpys occur at variable declarations", but we're not there yet
<andrewrk> but that's correct that there's no concept of "move" at the language level
hoppetosse has joined #zig
<andrewrk> if you assign one struct to another, it does a memcpy
<stratact> Understood
<bodie_> just make rvalue references a thing :^)
<andrewrk> there is some more design work to do here though. I want to make certain things guaranteed to not copy
<andrewrk> for example I want to guarantee that returning a struct from a function, the adress of the struct in the body and at the callsite will be the same
<andrewrk> this is not currently the case
<stratact> That sounds really challenging, you'd probably have to allocate for that?
<stratact> oh wait, the function could be inlined?
<andrewrk> nope, for example one way we could do it is named return values, and the caller passes a pointer
<stratact> that sounds interesting
<stratact> oh okay, the concept came from Go: https://tour.golang.org/basics/7
<andrewrk> I actually didn't know this was possible
<andrewrk> the point of giving them a name is to make them addressable, so you can rely on field addresses being correct after the function returns
<stratact> That will be fantastic to have :)
<bodie_> I think named return values in Go are just sugar
<bodie_> for a var declaration
<bodie_> it is convenient for avoiding an extra line in certain very short lambdas and such
skyfex has joined #zig
noonien has quit [Quit: Connection closed for inactivity]
<Bas_> Isn't that pretty much how return value optimization works? Instead of (in C++) int foo(); it basically becomes void foo(int& return_value); and it assigns to the return value instead of returning it.
<andrewrk> Bas_, indeed, however it's not guaranteed in C or C++
<andrewrk> and what I want is for zig users to be able to rely on it semantically
daritest has quit [Remote host closed the connection]
<andi3> it actually is in c++17
<Bas_> I don't like this magic. And there are all kinds of rules. Just write it the second way to be sure ^^ no need to let smartass compilers figure it out for you.
<Bas_> (or not if you do it slightly wrong)
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
andi3 has quit [Ping timeout: 252 seconds]
fjvallarino has quit [Ping timeout: 256 seconds]
fjvallarino has joined #zig
<Bas_> Is there a way to get a stack trace on windows? I get TodoSupportCoffDebugInfo =(
<andrewrk> Bas_, I'm afraid that's one of the high value big features that zig needs
<andrewrk> windows stack traces
<andrewrk> Hejsil, here you go, have your times() function
<GitHub98> zig/master 4ad4cd2 Andrew Kelley: fix iterating over a void slice...
<GitHub98> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNe5I
<Hejsil> Wuuh!
<stratact> Fast
<andrewrk> here's a more idiomatic times() implementation: https://github.com/ziglang/zig/issues/1203#issuecomment-403151594
<andrewrk> an undefined void value. I wonder what it is??
<andrewrk> could it be... the only possible value that void can be?
<Bas_> haha
<Hejsil> Du we have some runtime checks in case i use an undefined void? :)
<Bas_> Can anyone explain the difference between these two? expected type '[*]align(8) u8', found '*[]align(8) u8'
<andrewrk> Bas_, do you have a small code example? I just changed the way that error message works
<andrewrk> oh, it took me a moment to see it
<andrewrk> the first is an unknown length pointer to u8
<andrewrk> the second is a pointer to a slice of u8
<andrewrk> Bas_, try b.ptr
Ichorio has quit [Ping timeout: 245 seconds]
<andrewrk> if you looked at a memory diagram of those, the first would have 1 arrow, the 2nd would would have 2 arrows
<Bas_> thanks, that worked.
<Bas_> I see
alexnask_ has joined #zig
geocar has joined #zig
zolk3ri has quit [Remote host closed the connection]
<Bas_> So I only have two things I'm not happy about. The sublime text syntax doesn't understand how to find functions or toggle comments and I've no stacktrace. ^^
<GitHub26> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNeNc
<GitHub26> zig/master e19f0b5 Andrew Kelley: remove outdated semantic analysis documentation
<andrewrk> afk, back in a few hours
isolier has quit [Read error: Connection timed out]
isolier has joined #zig
<Bas_> Great, I ported my hashing algorithm without too much trouble.
<Bas_> I'll try around a bit more this weekend. :)
Bas_ has quit [Ping timeout: 252 seconds]
Hejsil has quit [Quit: Page closed]
stratact has quit [Remote host closed the connection]
stratact has joined #zig
alexnask_ has quit [Ping timeout: 256 seconds]
<MajorLag2> Windows traces are a constant thorn in my side. I've done a lot of warn() debugging. Sadly, it's kind of a difficult issue since Microsoft only distributes the DIA dll with VS and BuildTools, meaning zig can't rely on its presence and can't include it, so the only option seems to be reading the pdb ourselves.
daritest has joined #zig
daritest has quit [Remote host closed the connection]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]