ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<benjikun> I wish there was more learning materials for zig
<benjikun> I mean, I can clearly see why there isn't; that would be a lot of work and sorta pointless at this stage where everything is changing
<hryx> The latest published VS Code extension is behind the current on GitHub -- I'd love if someone could publish the more recent changes (`orelse` and @ function coloring)
diltsman has quit [Ping timeout: 256 seconds]
<hryx> Anyone here in charge of it? According to the extension metadata, that's tiehuis
darithorn has quit []
jmiven has quit [Quit: co'o]
jmiven has joined #zig
_whitelogger has joined #zig
diltsman has joined #zig
_whitelogger has joined #zig
tiehuis has joined #zig
<tiehuis> hryx: sorry i've been a bit out of action, just updated the repository and will try keep it more up to date
<tiehuis> also, probably will be back in a few more weeks with more time, bit tired of programming lately but if anyone makes any PR's on my repos i'll try get to them quickly anyway
tiehuis has quit [Client Quit]
<hryx> Wonderful, thanks tiehuis!
<daurnimator> Ronja: why would you ever need to slice a string by unicode character offset (serious question)
<daurnimator> I'd argue that it's a primitive almost no one needs (exceptions are locale conversion utilities)
<Ronja> maybe I'm writing a library to conjugate Finnish verbs
<daurnimator> Ronja: then you'll want to work in graphemes, not codepoints
<Ronja> technically yes, but in the case of Finnish I am fortunate in the sense that graphemes == codepoints :)
<Ronja> and I do recognize that is ultimately the same bias that English speakers have in being able to get pretty far with just ASCII
porky11 has joined #zig
davr0s has joined #zig
Hejsil has joined #zig
<Hejsil> Grammar branch done!
<hryx> \o/
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
steveno has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<MajorLag> Hejsil, is there a summary of the grammar changes somewhere?
<Hejsil> All that changed from 0.3.0 is error->anyerror
<Hejsil> Expect for error sets and error.Name
<MajorLag> ok, so other than that, it was just formalizing the need for parans to disambiguate certain expressions?
<Hejsil> This new grammar allows fn a() if (something) A else B { } to be parsed as expected without any notable changes to the current syntax
<Hejsil> The grammar seperates Exprs and TypeExprs in a way that allows this to work
<Hejsil> Ooh, just found a mistake somewhere. This parses, which it shouldn't fn a() {}
<Hejsil> It's a bug in the impl somewhere it seems
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
renatorabelo has joined #zig
return0e has quit [Ping timeout: 240 seconds]
return0e has joined #zig
davr0s has joined #zig
walac has quit [Ping timeout: 260 seconds]
<bheads> Hejsil, nice!!! did you switch it to PEG?
<Hejsil> I did
<Hejsil> Everyone can be productive again, now that the evil villain "Hejsil" is not gonna break their code (for a while)
Hejsil has quit [Quit: Page closed]
<bheads> lol, dont worry we all love you :)
<bheads> Looks like the docs need to be updated again https://ziglang.org/documentation/master/#struct
belgin has joined #zig
walac has joined #zig
<oats> does andrewrk ever hang out in here?
<oats> just out of curiosity
SergeiMinaev has joined #zig
<nbjoerg> yes
<nbjoerg> he should be waking up nowish too :)
mattdavies has joined #zig
<mattdavies> Hi. I am messing with Zig to try and see if it is usable for me. I am having difficulty finding any documentation for it. Even looking at the source code is not giving up its secrets.
<mattdavies> For example: std.fmt.format
<mattdavies> I am not sure how to use it
<mattdavies> Some of its parameters are a mystery to me
<mattdavies> Is there any documentation, or library of examples?
Hejsil has joined #zig
<Hejsil> mattdavies, have you seen std.debug.warn. This is a simpler interface for printing to stderr
<Hejsil> std.fmt.format is a generic function for formatting
<Hejsil> it doesn't know what it's printing to, which is why you need to provide a write fn as an argument
<mattdavies> I have seen warn but it outputs to stderr
<Hejsil> std.debug.warn wraps this function
<Hejsil> Sec, i'll find an example for stdout
<mattdavies> So you're suggesting I should look at the source for warn
<mattdavies> That seems like a good idea
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<mattdavies> I've seen "std.io.getStdOut().write", but I want to pass a formatted string to it
<Hejsil> If you use master, then you can do std.io.getStdOut().outStream().stream.print("{}", "Hello World")
<mattdavies> wow lol
<mattdavies> any chance for a std.out :)?
<Hejsil> You should probably split it up :)
<Hejsil> std.debug.warn is brief because you probably don't care if you're verbose output failes to print
<mattdavies> I am getting an error that WindowsGetStdHandleErrs!File does not support field access on the outStream call
<Hejsil> Sorry, mine was a shortende version, lol
<Hejsil> Here is how you'd probably do it
<Hejsil> bheads, I think the docs are outdated because the windows build fails
<mattdavies> ok, got it working
<mattdavies> Settled on this:
<mattdavies> fn out(comptime fmt: []const u8, args: ...) !void { var stdout_file = try std.io.getStdOut(); var stdout_out_stream = stdout_file.outStream(); var stdout = &stdout_out_stream.stream; _ = stdout.print(fmt, args); }
<mattdavies> fn out(comptime fmt: []const u8, args: ...) !void { var stdout_file = try std.io.getStdOut(); var stdout_out_stream = stdout_file.outStream(); var stdout = &stdout_out_stream.stream; _ = stdout.print(fmt, args); }
<mattdavies> Not sure how to show code in IRC (never use it)
<mattdavies> So I was able to do this: try out("Hello {}", "World!");
<Hejsil> I see, yea you can do that. Idk if there is a cost assosiated with getting the handle every single time :)
<Hejsil> The reason we don't have such an out fn, is because on windows getStdOut can fail, and we don't want to have every call to print have that error in its signature
<Hejsil> But feel free to have your own helper :)
<mattdavies> But isn't that the same for debug.warn?
<mattdavies> surely getStdErr can fail too?
<mattdavies> Maybe a std.debug.out?
<mattdavies> Anyway... my helper will be just fine. The problem I see is that others trying to get to grips with Zig will hit the same issues
<mattdavies> I hope the documentation comes soon though, for Zig's sake
<mattdavies> I am porting a windows OpenGL application to try to get to grips with it
<mattdavies> So far, the win32 api coverage is good.
<mattdavies> I've yet to attempt to try OpenGL yet
<mattdavies> I will get there
<mattdavies> BTW, I am a profession video game developer, so I am evaluating it at this point
<bheads> nice, I think Andrew's plan is to have the stage 2 compiler create the stdlib docs.
<bheads> plus the stdlib is far from final
<bheads> mattdavies, are you one of the FTL devs?
<Hejsil> mattdavies, true, but std.debug.warn can't fail at all, so there is that :)
<Hejsil> Maybe we could have std.debug.out, which is the same for stdout
<Hejsil> But if you'r program can't output its results, then it probably should handle that somehow (exit with 1, at least)
<Hejsil> your*
<mattdavies> No I don't work on FTL
<mattdavies> Oh I agree that a out function outside std.debug should handle all errors
<mattdavies> but an equivalent of std.debug.warn for stdout would be nice.
<Hejsil> Hmmm, maybe
<mattdavies> By using std.debug, you're saying I don't care if this fails
<mattdavies> I don't have strong opinions either way tbh
<mattdavies> I have my helper and that's good enough
<bheads> +1 on std.debug.out
<Hejsil> True, but stderr is not really meant to be used for output anyways, so it matters less
<mattdavies> that's true
<Hejsil> Idk, I'm sure andrewrk have more on this
<Hejsil> I don'
<mattdavies> Some IDEs can grab stdout
<mattdavies> and not stderr
<Hejsil> t think i'd be to bad to std.debug.out
<bheads> maybe have std.debug be a nop in release mode
<mattdavies> :)
<Hejsil> Oooh, really
<Hejsil> And terminal can do it all!
<Hejsil> Hmmm, I don't think we want std.debug.out because some IDEs have bugs :)
<Hejsil> Sound like a bad reason to have a fn in the standard lib
<bheads> very true
<bheads> that should be an external lib
<bheads> Hejsil, do you think the new parser will support if statments without parans?
<bheads> oh well, not really a big loss
Hejsil has quit [Quit: Page closed]
MajorLag has quit [Ping timeout: 272 seconds]
belgin has quit [Quit: Leaving]
mattdavies has left #zig [#zig]
MajorLag has joined #zig
davr0s has joined #zig
<MajorLag> Wow, align really doesn't work the way I would expect it to. It's very limited.
<MajorLag> I feel like I should be able to do something like `cosnt X = align(16) u32;` and get a type 'X' that is always guaranteed to be aligned to 16, but even if I could express that to the compiler it just silently rounds alignment down to @sizeOf(T) anyway.
<MajorLag> So dealing with SIMD types requires ugly hacks, like using an allocator to ensure alignment, or the casting that DutchGh0st was doing.
MajorLag has quit [Read error: Connection reset by peer]
MajorLag has joined #zig
MajorLag has quit [Read error: Connection reset by peer]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
MajorLag has joined #zig
MajorLag has quit [Read error: Connection reset by peer]
MajorLag has joined #zig
davr0s has joined #zig
wootehfoot has joined #zig
steveno has quit [Remote host closed the connection]
steveno has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
porky11 has quit [Remote host closed the connection]
porky11 has joined #zig
SergeiMinaev has quit [Quit: Page closed]
MajorLag has quit [Read error: Connection reset by peer]
MajorLag has joined #zig
porky11 has quit [Read error: Connection reset by peer]
porky11 has joined #zig
davr0s has joined #zig
renatorabelo has quit [Quit: Page closed]
oconnor0 has joined #zig
oconnor0 has quit [Quit: Quit]
oconnor0 has joined #zig
<oconnor0> What is the motivation for changing `struct.{ }` to `struct { }`? I kind of liked the dot version, not that you should care what I think. :)
<benjikun> IIRC he originally changed it to the dot version because of some parsing problem but never liked the way it looked
<benjikun> I think I heard Andrew say that in one of the livestreams
wootehfoot has quit [Read error: Connection reset by peer]
Hejsil has joined #zig
<oats> oconnor0: I don't think your opinion is the one most people had :P
<Hejsil> I think most people want to type less, when more typing is not more readable
<benjikun> Isn't that the same amount of typing?
<oats> I still don't like the .* deref op, but I see why it's necessary :<
<Hejsil> Well, for initializers it's one more stroke (if you follow the recommended styling)
<Hejsil> Anyways, no one likes it, we changed it back
<Hejsil> Or, we changed the grammar so that we could change it back
porky11 has quit [Remote host closed the connection]
<benjikun> Is there a way to use unions like how they are in C
<benjikun> where it isn't just 1 active field
<Hejsil> Use and extern union
<oconnor0> Isn't space vs dot the same amount of typing? ;)
<Hejsil> Shhhh~
<Hejsil> I'm just a little stupid right now
<benjikun> lol
<benjikun> Why does extern work the way it does with `extern union`
<Hejsil> All externs follow the C abi, so they'll have the same layout and safety as those types
<benjikun> hm
Hejsil has quit [Quit: Page closed]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
porky11 has joined #zig
<MajorLag> I like the .* deref op myself. Unambiguous, and the postfix notations makes multiple derefs easer to both write and read.
<MajorLag> struct.{ was annoying at first because I use Allman bracing, but once I realized whitespace was insignificant I didn't mind it at all.
porky11 has quit [Read error: Connection reset by peer]
merry has quit [Ping timeout: 268 seconds]
MajorLag has quit [Read error: Connection reset by peer]
<benjikun> does anyone know of a zig program that uses arraylists so I could learn about using them from it?
MajorLag has joined #zig
<oats> MajorLag: so are multiple derefs like this: foo.*.*
<presiden> looks like an emoji
porky11 has joined #zig
porky11 has quit [Quit: Leaving]
davr0s has joined #zig
porky11 has joined #zig
<benjikun> I'm really looking forward to having the html doc generated for the std lib
porky11 has quit [Remote host closed the connection]
wink_ has joined #zig