ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
cenomla has quit [Read error: Connection reset by peer]
cenomla has joined #zig
aiwakura has quit [*.net *.split]
aiwakura has joined #zig
<GitHub137> [zig] andrewrk pushed 1 new commit to master: https://git.io/vbyni
<GitHub137> zig/master 8bc5232 Andrew Kelley: add labeled loops, labeled break, labeled continue. remove goto...
ltr_ has joined #zig
ltr__ has quit [Ping timeout: 255 seconds]
cenomla has quit [Read error: Connection reset by peer]
cenomla has joined #zig
redj has quit [Remote host closed the connection]
redj has joined #zig
cenomla has quit [Quit: cenomla]
arBmind has joined #zig
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<skyfex_> What's the easiest way to loop a fixed number of times in Zig? Something like for (0..4). Would it be possible to do something like "5.times {" in ruby? "loop(5) { .. }" maybe
<skyfex_> And can a function take a slice as an argument?
<skyfex_> Ah, a figured out that last question. I don't feel the documentation makes it clear/visible enough what the type specification for slice is
arBmind has quit [Quit: Leaving.]
skyfex_ has quit [Ping timeout: 260 seconds]
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
jjido has quit [Client Quit]
<andrewrk> skyfex, I agree with you about the docs
jjido has joined #zig
<andrewrk> for counting, use a while loop. var i: usize = 0; while (i < 10) : (i += 1) {}
<skyfex> Yeah, i know that way. I want the easier way ;P
jjido has quit [Client Quit]
<andrewrk> zig's stance on that is that One Way To Do Things is important enough to omit a shortcut to loop N times
<skyfex> I suppose the natural solution would be to make ranges a type (to make the a..b syntax more general and usable for more purposes), and to introduce some kind of enumerable interface, have for (..) work on any enumerable, and have ranges implement enumerable. But I don't know if zig aims for that kind of genericness
<skyfex> The other way would be to make the "foobar(..) |...| { ...}" syntax be usable for any function. Then lazy people like me could have a utility library that implements "loop" or any other kind of looping construct
<skyfex> It's tricky to make a dead simple language these days. It's harder to cut things out than getting ideas for things to put in
<skyfex> But I think if it's possible to implement some construct in a generic way without complicating the compiler too much, it might be worth doing
<skyfex> Any plans for lambdas or anything like it btw?
<andrewrk> skyfex, I do plan to allow you to create a function definition inside a compile-time function
<andrewrk> e.g. return a function from a function
<andrewrk> but I don't have a way to do closures yet. it's pretty tricky
<andrewrk> introducing a type for a range is not a bad idea
<andrewrk> then it would make sense to have for work with a range
<skyfex> It could be an interesting exercise to imagine what a "Zig++" could look like. If there was a design document for it, you could just point to it whenever someone says "why doesn't Zig have X"
<skyfex> I would perhaps put full closures in the "Zig++" category. Would make more sense if "Zig++" had some built-in support for garbage collection. But some limited anonymous function support could make sense in Zig
<skyfex> For something like foobar.map |x| { x*2 } you don't need to capture anything from the environment
<skyfex> If the only thing you can do with a closure, is to call it immediately in the function that takes it as an argument, that would also make it quite simple, while still being very useful
<skyfex> Then you wouldn't have to worry about things you refer to going out of scope I think
arBmind has joined #zig
clownpriest has joined #zig
<andrewrk> what would be the goal of zig++?
jjido has joined #zig
cenomla has joined #zig
<skyfex> well, that's up to anyone to imagine
<skyfex> but I think it speaks to C's strength that languages have been built on top of it
<skyfex> Objective-C and C++
<skyfex> My thought with the idea of "zig++" is just to mentally sort features that doesn't belong in zig, but could be added on if someone builds on the language
<skyfex> For me, I think Nim is close to what I'd imagine "Zig++" to be though
<skyfex> Most features I think of proposing, are just things I miss from Nim
<skyfex> Some people would probably want to add C++/Java/C# object-orientation, but I think that path is a mistake
<skyfex> I see someone on reddit suggested Zig should add a borrow checker, like from Rust
<skyfex> But I would say that goes in "zig++" category. It would be great if it was relatively easy to write a compiler for Zig, so if it becomes popular, you get different compilers with different strengths
<skyfex> I've understood borrow checking to be quite hard to implement
Chocobo has joined #zig
clownpriest has quit [Ping timeout: 248 seconds]
Chocobo has quit [Quit: Leaving]
<andrewrk> skyfex, borrow checking is also hard for programmers to use
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
clownpriest has joined #zig
_whitelogger has joined #zig