ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
fjvallarino has quit [Remote host closed the connection]
fjvallar_ has joined #zig
fjvallar_ has quit [Ping timeout: 248 seconds]
tiehuis has joined #zig
stratact has quit [Remote host closed the connection]
fjvallarino has joined #zig
stratact has joined #zig
hoppetosse has quit [Ping timeout: 264 seconds]
Tobba_ has quit [Ping timeout: 245 seconds]
<stratact> Does zig have heap strings and vectors?
<andrewrk> stratact, yes in userland
<andrewrk> that would be for encoded utf8 strings
<andrewrk> std.ArrayList would be your heap allocated vector
<stratact> Gotcha
<andrewrk> we don't have a heap-allocated *decoded* string data structure yet
<andrewrk> but it would basically be an ArrayList(u21)
<andrewrk> with functions like toUpperCase which depend on a huge database of ICU data or whatever
<stratact> why u21, and not u8?
<andrewrk> for a decoded string? the maximum valid unicode point is U+10FFFF which means you need a 21-bit unsigned integer to represent a codepoint
<stratact> ah gotcha
<stratact> what if in the future the unicode standard were to add more code points for more characters to support?
<andrewrk> YAGNI
<stratact> heh, I had to look that up ;)
<andrewrk> unicode defines U+10FFFF as the upper limit and so far 10% of the available codepoints have been used up
<stratact> I see
<MajorLag2> except A) it was 16 bit at one point, hence surrogate pairs, and 2) they keep adding emoji.
<andrewrk> yeah. I still don't think we need to worry about the upper limit being exceeded until it actually happens though
return0e_ has joined #zig
return0e has quit [Ping timeout: 240 seconds]
<stratact> andrewrk: so um, another suggestion, could you add to the documentation about the ArrayList and Buffer types, because those are going to be pretty commonly used in a lot of code. People are going to want to know not just the primitive types but also the common userland types to make Zig appear more interesting to the newcomer
<andrewrk> my plan is for that to be part of the auto generated docs
xtreak has joined #zig
xtreak has quit []
<GitHub39> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNvkn
<GitHub39> zig/master d8295c1 Andrew Kelley: add @popCount intrinsic
<MajorLag2> oh neat, I have a use for that
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
fjvallarino has quit [Ping timeout: 260 seconds]
darithorn has quit [Quit: Leaving]
fjvallarino has joined #zig
mal`` has quit [Quit: Leaving]
mal`` has joined #zig
mahmudov has quit [Ping timeout: 255 seconds]
Richard has joined #zig
Richard is now known as Guest76710
Guest76710 has quit [Client Quit]
davr0s has joined #zig
very-mediocre has joined #zig
<very-mediocre> new site theme is lit :]
Bas_ has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kristate has joined #zig
_whitelogger has joined #zig
<Bas_> Is there a reason @bytesToSlice doesn't work at compile time?
Ichorio has joined #zig
<tiehuis> i think it should be allowed but it probably just hasn't been yet, probably related is @bitCast not working at compile-time on arrays which should be in the future: https://github.com/ziglang/zig/issues/421
Ichorio_ has joined #zig
Jezza__ has joined #zig
Ichorio has quit [Ping timeout: 240 seconds]
zolk3ri has joined #zig
Ichorio_ has quit [Ping timeout: 260 seconds]
Jezza__ has quit [Ping timeout: 260 seconds]
kristate has quit [Remote host closed the connection]
alexnask_ has joined #zig
<Bas_> Ah yes, I tried that as well in the meantime and noticed that currently doesn't work.
enoent has joined #zig
Ichorio has joined #zig
dza_ has joined #zig
dza_ has quit [Client Quit]
noonien has joined #zig
Ichorio_ has joined #zig
Ichorio has quit [Ping timeout: 260 seconds]
davr0s has joined #zig
Ichorio_ has quit [Remote host closed the connection]
Ichorio_ has joined #zig
Ichorio_ has quit [Remote host closed the connection]
very-mediocre has quit [Ping timeout: 252 seconds]
Ichorio_ has joined #zig
enoent has quit [Ping timeout: 252 seconds]
Jezza__ has joined #zig
Ichorio_ has quit [Ping timeout: 248 seconds]
Ichorio has joined #zig
Jezza__ has quit [Ping timeout: 264 seconds]
Ichorio_ has joined #zig
Ichorio has quit [Ping timeout: 240 seconds]
hio has joined #zig
hio is now known as hooo
nc-x has joined #zig
nc-x has quit [Ping timeout: 252 seconds]
mahmudov has joined #zig
tiehuis has quit [Quit: WeeChat 2.1]
kristate has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
hoppetosse has joined #zig
Tobba has joined #zig
andi3 has joined #zig
<andi3> regarding the issue with for( times(10) ) |_,i |{} from yesterday: wouldn't it be much more flexible to implement integrating over things, like also custom data structures, ranges, anything using coroutines and yield (combined into for loops)?
andi3 has quit [Client Quit]
kristate has quit [Remote host closed the connection]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
very-mediocre has joined #zig
Hejsil has joined #zig
<Hejsil> andi3, i think the `var it = ...; while(it.next()) |item| {}` basically gives us everything you would want from an iterate feature
<Hejsil> And this also allows for iterators that can return errors: var it = ...; while(try it.next()) |item| {}`
Tobba has quit [Ping timeout: 264 seconds]
Ichorio_ has quit [Remote host closed the connection]
Ichorio_ has joined #zig
hoppetosse has quit [Ping timeout: 264 seconds]
alexnask_ has quit [Ping timeout: 260 seconds]
andi3 has joined #zig
<andi3> But it’s much less work to implement iterators using coroutines instead of rolling an own iterator type every time
andi3 has quit [Client Quit]
hoppetosse has joined #zig
<Hejsil> I'm not sure I understand. With an iterator feature, you would still need to declare a type as "iterable" and implement "next" on this type
<Hejsil> And coroutines in zig are kinda boilerplaty as well. Look at the "range" example from this issue https://github.com/ziglang/zig/issues/1194
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
darithorn has joined #zig
alexnask_ has joined #zig
alexnask_ has quit [Ping timeout: 240 seconds]
Bas_ has quit [Ping timeout: 252 seconds]
andi3 has joined #zig
<andi3> https://www.youtube.com/watch?v=O9xn9h_874U3t=5m here is an example of how you save much code which in turn saves errors
andi3 has quit [Client Quit]
davr0s has joined #zig
<Hejsil> I don't see how this saves any more code than the current alternative
<Hejsil> You still need to write the next and make function
<Hejsil> It's the same
<Hejsil> I think Jblows examples with the functional "iterate" style could save a lot of code
<Hejsil> He even mentions it himself
hoppetosse has quit [Ping timeout: 256 seconds]
Bas_ has joined #zig
unique_id has left #zig ["Leaving"]
alexnask_ has joined #zig
darithorn_ has joined #zig
darithorn has quit [Ping timeout: 264 seconds]
Hejsil has quit [Quit: Page closed]
hoppetosse has joined #zig
hoppetosse has quit [Remote host closed the connection]
hoppetosse has joined #zig
hoppetosse has quit [Remote host closed the connection]
hoppetosse has joined #zig
hoppetosse has quit [Remote host closed the connection]
hoppetosse has joined #zig
darithorn_ has quit [Quit: Leaving]
<andrewrk> I watched a couple minutes of this but I didn't understand the thing that Hejsil is trying to point out
mahmudov has quit [Ping timeout: 240 seconds]
Tobba has joined #zig
quc has quit [Ping timeout: 240 seconds]
alexnask_ has quit [Ping timeout: 245 seconds]
mahmudov has joined #zig
varion has joined #zig
noonien has quit [Quit: Connection closed for inactivity]
hoppetosse has quit [Remote host closed the connection]
hoppetosse has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Hejsil has joined #zig
<Hejsil> I was linking to a place where he shows an "iterate" function which takes a visit function as an argument
<Hejsil> JBlow himself points out the problems with it
Ichorio_ has quit [Quit: Leaving]
quc has joined #zig
Ichorio has joined #zig
hoppetosse has quit [Read error: Connection reset by peer]
hoppetosse has joined #zig
varion has quit [Quit: Page closed]
davr0s has joined #zig
dbandstra has joined #zig
<Bas_> I was trying to find the reason why there is no function overloading in Zig. I found this: https://github.com/ziglang/zig/issues/980#issuecomment-386844093
<Bas_> It says: add(int, int) and add(float, float) in Zig can just be done through a add(Type: type, Type, Type), such that you call it like add(i32, 5, 9)
<Bas_> But that still means you can only do it once right? I mean, there's no way to extend functions to accept more types.
<Bas_> I'm used to C++ and recently I've been trying to write my code just with structs + functions (which have overloads). Somehow it feels a bit silly I've to go back to 'methods'.
<Bas_> So I'm curious about the reasoning behind it. I looked through a few issues, but couldn't really find anything about why.
<dbandstra> i am mystified by the whole idea of programming streams
<dbandstra> video streams i mean
<dbandstra> what kind of mental state do you have to be in to be willing to watch 3 hours of some guy sitting in his underwear and rambling about his toy projects?
very-mediocre has quit [Ping timeout: 252 seconds]
<Bas_> People are lazy, they'd rather have someone else do something than them actually doing anything themselves.
<dbandstra> then it's a still a waste of the time on the part of the video creator
<Bas_> Hmm....
<Bas_> Maybe he's lonely and wants attention?
<Bas_> Some people talk to their pet, others to the internet?
<dbandstra> i guess, but from what i could tell his language could be legitimately interesting
<Hejsil> Bas_ i think this applies to watching other people do anything
<Hejsil> Like let's plays or gaming streams
<dbandstra> but i don't really know because the only things i can dig up is "info collated from years of youtube videos"
<Bas_> Well sure... hmm... I was going to say that some things I can understand better. Like watching a car race or a football game. Because at least that's exciting and not something you can easily do yourself.
<Bas_> But then again maybe that also goes for programming?
<Hejsil> Well, you could play football yourself
<Bas_> The profs are supposed to be better at it ^^
<Bas_> Can you make a slice from a pointer?
<Bas_> Ah yes, I found it.
fjvallarino has quit [Remote host closed the connection]
fjvallarino has joined #zig
fjvallarino has quit [Ping timeout: 264 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<skyfex> Bas_: I think maybe the reason you don't have function overloading in Zig is that it's a low-level and explicit language. If you have two functions with the same name, what is actually the name of each of the functions?
<skyfex> You need some way to translate the non-unique name.. that's implicit magic
<skyfex> *translate the non-unique name into a unique name
<skyfex> It also makes it more complicated to have shared libraries
<skyfex> (i think)
davr0s has joined #zig
<skyfex> When discussing these thing, I have in the back of my mind what would be a "Zig++" feature.. i.e. if you'd make a language that is to Zig what C++ is to C, which features would belong to that language. Zig is a replacement for C, not C++ (although it can compete with C++ in many cases)
<skyfex> I guess a Zig-like way to do it might be to declare two names, to make it more explicit?
<Bas_> Yeah I know how you do it in C
<skyfex> What I mean is.. something like this:
<Bas_> you do my_type_add() instead of add() (or operator+() in C++)
<skyfex> fn add 'addFloat' (float, float)
<skyfex> fn add 'addInt' (int, int)
<Bas_> yeah or that
<skyfex> then you'd do add(3.0,2.0) in your code. It'd be translated to addFloat(..) as the actual symbol it calls, and that's what'd you'd see in the debugger
<Bas_> That's how C++ does it.
<Bas_> just it has to do add$@@$Float or whatever, because otherwise it might clash with some user defined function
<skyfex> Yeah, that's the magic/implict part
<skyfex> I think it's also not standardized? I seem to remember that different C++ compilers wasn't necessarily compatible in that regard
enoent has joined #zig
<Bas_> Nope, it's not.
<skyfex> It's possible to look at what Nim is doing too, it's a bit closer to Zig in principles
<skyfex> I really like Nim and Julia when it comes to these things
<Bas_> I looked at Julia, but never tried it out.
<skyfex> It's a bit odd in some ways, coming a bit from Matlab and R users.. but pretty solid, and I suppose it's 1.0 soon so might be worth looking at again
<skyfex> Personally I made a mental note to try to use it again when compiling to binary is finished and mature
<skyfex> Haven't checked the status of that in a while
<Bas_> Oh they're doing that now? I remembered it was more like matlab or something.
<skyfex> It's like a lot of things these days :P
<skyfex> gtg, good night
<Bas_> good night
alexnask_ has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
quc has quit [Ping timeout: 245 seconds]
Bas_ has quit [Ping timeout: 252 seconds]
alexnask_ has quit [Ping timeout: 268 seconds]
fjvallarino has joined #zig
dvn has joined #zig
enoent has quit [Ping timeout: 252 seconds]
Hejsil has quit [Quit: Page closed]
hoppetosse has quit [Ping timeout: 240 seconds]
quc has joined #zig
hoppetosse has joined #zig
zolk3ri has quit [Quit: Lost terminal]
hoppetosse has quit [Ping timeout: 245 seconds]