ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<Snektron> >it's also good that "use" is beeing removed as a keyword in 0.6
<Snektron> im not quite sure what to thing about usingnamespace though
<mq32> it's better to have some longer name than the generic "use"
<Snektron> The name feels kind of weird
<mq32> i can't name a function called "use" use without using @"use"
<mq32> now i have code that looks like this:
<mq32> program.useProgram();
<mq32> which is redundancy in perfection :D
<Snektron> but i suppose it helps to deter people from using it
<mq32> yeah
<Snektron> Shaders?
<mq32> yes
<mq32> i also thought about usingnamespace after tgschultz said he didn't like it
<mq32> i think something like "import symbol_a, symbol_b from package;" would be more explicit and clutter "global namespace" less
<Snektron> I always find it weird to write wrappers around opengl functions with members
<Snektron> like, glUseProgram isn't quite a member function
<mq32> why? OpenGL is a quite straightforward object oriented API :D
<mq32> even more if you use GL_ARB_DIRECT_STATE_ACCESS
<Snektron> it gets especially nasty with things like buffers, though it gets better with the recent versions
<Snektron> but you can't really use those if you want to release anything
<mq32> i have a generic unbind, which just does glBind*(0);
<Snektron> object oriented would imply that it uses inheritance for extension, which is not quite the case i'd say
<Snektron> What the point of having a generic unbind? That just adds overhead
<mq32> nah, object orientation does not imply "inheritance", that's just one form :D
<Snektron> but yeah vulkan is the complete opposite, where you have to make a lot of explicit calls
<Snektron> im hoping zig can help to deal with that a bit
<Snektron> I wrote a project using Vulkan-Hpp and that had a few annoying things
<andrewrk> mq32, oh, `use` is supposed to not be a keyword anymore. I haven't made that change yet since the 0.5.0 release
<mq32> andrewrk, yeah i know :)
<Snektron> You can always just rename it to something similar. I suppose .bind() would convey the purpose
<mq32> yeah, true
<mq32> but i'd like to stay as close as possible to the real naming
<Snektron> Or rename it use_()
<Foxfir3> sorry for noobsie question. just checked my arch install on the rpi4. 32 bit. auch. Found a zig version that runs, but I get errors. Its expecting 64 bit. now what?
<mq32> andrewrk, what is your opinion on a "usingnamespace" with explicitly imported members?
<mq32> is it worth writing a proposal? :D
<Foxfir3> hardware is 64 bit though. seems like the Zig armv7 are 64bit.
<mq32> Foxfir3, is your arch running in 64 bit mode?
<mq32> i don't have much expertise on that area, but i heard that you have to boot the linux kernel with aarch64 support
<Foxfir3> mq32: dang! I never even though of such a thing. how do I fix that?
<mq32> i don't know :/
<Foxfir3> mq32: okay. thanks for the tip :) I'll check with the Arch guys.
<fengb> Zig should work with 32bit though
<Foxfir3> fengb: went as far as 'zig version', and trying to build the hello world example. @compileerror("unsupported arch")
<mq32> oh
<Foxfir3> fengb: expecting 64u. and then I assumed the issue could be the os? no?
<mq32> so this is actually some error in the standard library
<mq32> i think there's an issue for that?
<fengb> A lot of userland may not be ready but the compiler should be
<Foxfir3> aha.. that explains
<Foxfir3> okay: container 'std.os.linux' has no memb
<Foxfir3> er called 'Stat'
<fengb> We haven’t had many arm 32 users so you might be a guinea pic :P
<Foxfir3> Im willing :D
<Foxfir3> fengb: wait.. why is It calling std.os.linux there?
<fengb> stdout is an OS abstraction
<Snektron> Foxfir3: what version of Zig are you on?
<Snektron> I added some stuff for arm32 in 0.5.0 and a basic "hello world" should be working
<Snektron> A lot of features are still missing support
<Snektron> I ended up writing the project i was doing in C since i turned it into a uni project
<mq32> :O
<mq32> you should spread the word of zig, not betray us! *grin*
<Snektron> Would if i could
<Snektron> I mean i could probably, but that would include spending much more time on it (and uni is already eating up most of my time) and convincing my mates of using a language of which the compiler crashes when you try to do something with it
<mq32> haha
<mq32> damn you and your arguments
<Snektron> I did convince one of them to watch one of andrews talks and he was interested
<Snektron> It surprised me, since hes usually not a fan of new languages
<mq32> imho zig has a special place between all the new languages
<Foxfir3> Snektron: 0.4.0 (community arch package)
<Foxfir3> Snektron: oh. Thanks. I'll get the 0.5.0 version from the site then. Could'nt compile the repo 0.5.0 version. Thanks :)
<Snektron> If youre building from the aur it installs all required dependencies
<Snektron> I found Zig quite easy to build, much better than the majority of projects i come across
<Snektron> I wonder why that stuff is always so hard
<Snektron> I blame cmake
<Foxfir3> Snektron: AUR can be entertaining at times. Might be 10 seconds. Might be half an hour :D
<mq32> Foxfir3, true dat. or sometimes, might be 10 hours
<mq32> like mingw-w64-gcc or similar :D
<Snektron> Avr-gcc was pretty quick to compile
<Snektron> Took only like a minute
<mq32> yeah, but that's afaik gcc 4
<mq32> so kinda "old"
<mq32> i should get some sleep, it's late already...
doesntgolf has quit [Read error: Connection reset by peer]
doublex_ has joined #zig
doublex has quit [Ping timeout: 245 seconds]
return0e has quit [Remote host closed the connection]
marijnfs has quit [Ping timeout: 246 seconds]
marijnfs has joined #zig
doublex_ has quit [Read error: Connection reset by peer]
doublex has joined #zig
cheesy has joined #zig
slice has quit [Ping timeout: 264 seconds]
marijnfs has quit [Ping timeout: 276 seconds]
marijnfs has joined #zig
Ichorio_ has joined #zig
Ichorio has quit [Ping timeout: 264 seconds]
companion_cube has quit [Ping timeout: 264 seconds]
gruebite has quit [Ping timeout: 264 seconds]
Ichorio_ has quit [Ping timeout: 245 seconds]
companion_cube has joined #zig
doublex has quit [Ping timeout: 240 seconds]
doublex has joined #zig
doublex has quit [Quit: Quit]
doublex has joined #zig
_whitelogger has joined #zig
return0e has joined #zig
chemist69 has quit [Ping timeout: 250 seconds]
return0e has quit [Ping timeout: 268 seconds]
chemist69 has joined #zig
mahmudov has quit [Ping timeout: 265 seconds]
return0e has joined #zig
return0e has quit [Ping timeout: 240 seconds]
doublex has quit [Remote host closed the connection]
doublex has joined #zig
knebulae has quit [Read error: Connection reset by peer]
_whitelogger has joined #zig
mahmudov has joined #zig
gustav_o has joined #zig
<daurnimator> Snektron: 0.5.0 is in community-staging pending llvm 9 rebuilds
<gustav_o> is there consensus on whether tests should be placed inside structs or not? If they are, they can use nested structs with less namespacing and they also get spatially closer to the implementation, but one needs to add a comptime reference to the structs for the tests to run..
Foxfir3_ has joined #zig
marijnfs has quit [Quit: WeeChat 2.6]
<Foxfir3_> update on the rpi4. in theory the archarm zig package is corret, assuming the 64bit cpu, which is that. But since there is no no 64 bit binary blob from RPi foundation, the result is a 32 bit system on a 64 bit cpu. So that's that.
<gustav_o> is there consensus on whether tests should be placed inside structs or not? If they are, they can use nested structs with less namespacing and they also get spatially closer to the implementation, but one needs to add a comptime reference to the structs for the tests to run..
<gustav_o> wops, sorry ppl
<Foxfir3_> 64 bit will arrive.. at some point. but as It stands, I see no reason why anyone should adapt to Broadcomm and RPi foundation.
samtebbs has joined #zig
return0e has joined #zig
<Foxfir3_> the bizare situation is that I might be able to compile a zig programme on the RPi3B+, but not the RPi4
<Foxfir3_> Ideally there should be a check, to prevent the package from installing. maybe lscpu or something like that
Foxfir3_ has quit [Quit: Lost terminal]
Foxfir3 has quit [Quit: Lost terminal]
Foxfir3 has joined #zig
gustav_o has quit [Ping timeout: 260 seconds]
mahmudov has quit [Ping timeout: 268 seconds]
<Snektron> Wait so the rpi 4 cant run a 64 bit os?
<mq32> Snektron, afaik it can, but nobody has fixed their distros to actually support it
samtebbs has quit [Ping timeout: 240 seconds]
porky11 has joined #zig
kenaryn has joined #zig
<kenaryn> Hello guys. Please what is the difference between a 'null' and an 'undefined' value? (except that the former can belong to a list of optional types).
<tdeo> > undefined means the value could be anything, even something that is nonsense according to the type. Translated into English, undefined means "Not a meaningful value. Using this value would be a bug. The value will be unused, or overwritten before being used."
<kenaryn> I am sorry, I did not remember it from the official documentation, thank you.
<kenaryn> Can you explain to me in a few words the difference between 'void' and 'null' please? I know 'void' is a value meaning "absence of value" but I can't distinguish it from 'null'.
<tdeo> void is a type that cannot hold any value, while null is a value indicating that there is no value
<kenaryn> Thanks, you are kind.
<Foxfir3> more RPi4 update for Zig. Raspian buster supports 64 bit. so Zig should be able to build on that distro. While ArchArm is in the wind. Don't knoiw about FedoraARM yet.
tempnickdontmind has joined #zig
<tempnickdontmind> would there be any problems with linking the current std docs in the FAQ or is it too early for that?
<kenaryn> Nice to hear it buddy, Zig is conquering new targets.
<mq32> tempnickdontmind, i think it's still a bit too early for that as the docs aren't complete yet (e.g. missing windows documentation)
<kenaryn> It could be a first step in a continuous improvement methodology.
<kenaryn> And could decrease the work load once the documentation is complete.
tempnickdontmind has quit [Ping timeout: 268 seconds]
Ichorio has joined #zig
marmotini_ has joined #zig
mps has joined #zig
FireFox317 has joined #zig
marmotini has joined #zig
marmotini_ has quit [Ping timeout: 265 seconds]
marmotini has quit [Ping timeout: 265 seconds]
gustav_o has joined #zig
<kenaryn> Please does |_| equals |err| ?
<mq32> you are not to ignore error codes
<kenaryn> In fact, what does |_| mean?
<kenaryn> I will reformulate: does |_| tell the compiler to not ignore error codes? or was it addressed to me as a person?
<FireFox317> |err| means that you can do something with the error in the next block, for example check which error occurred and |_| means that you won't get that information in the block, so you don't care what error was returned
<kenaryn> Thank you for instructing me. The official documentation is amazingly interesting and quite difficult.
doublex has quit [Ping timeout: 264 seconds]
doublex has joined #zig
marmotini_ has joined #zig
wootehfoot has joined #zig
Akuli has joined #zig
<marler8997_> looks like 4G of ram just doesn't cut it these days if you want to compile LLVM/CLANG
<marler8997_> I've had to restart my clang build 3 times because it keeps running out of memory
<daurnimator> marler8997_: indeed. also seemed to take a few hours :(
Ichorio has quit [Ping timeout: 245 seconds]
<Cadey> i got HTTP client requests working with olin+zig! https://gist.github.com/Xe/7fcde4a6aa0e54c2543d6b5f923054bf
<daurnimator> oh woot; llvm9 made it into arch extra; and zig 0.5.0 has now hit community :D
<daurnimator> Cadey: o.o writing http headers like that isn't intentional
<bgiannan> daurnimator, 👍
marmotini_ has quit [Quit: Leaving]
<nrdmn> is there any way to use @memberType with a member's name instead of its index?
<daurnimator> nrdmn: have you looked in std.meta?
<nrdmn> daurnimator: thanks, std.meta.fieldInfo is what I was looking for
porky11 has quit [Ping timeout: 264 seconds]
<nrdmn> Can I get the return type of a function from within that function?
<nrdmn> I have a function that returns an array. The length of the array depends on arguments passed to the function. Currently I do the calculation of the length twice, once in the return type declaration and once in the function body
<daurnimator> nrdmn: no I don't think so
<daurnimator> nrdmn: I've seen before making a helper function to figure that out; but it is ugly
<daurnimator> I see it as one of the motivating use cases for inferred return types
<daurnimator> you might want to post your example on the inferred return types issue
<nrdmn> that's another solution I thought of
return0e has quit [Read error: Connection reset by peer]
<Cadey> daurnimator: it works great though!
<daurnimator> Cadey: so you're meant to add method, authority and other http/2 pseduo headers as well
<Cadey> daurnimator: i'm explicitly trying to do HTTP/1.1 though
<daurnimator> Cadey: yes.
<daurnimator> Cadey: the rest of http isn't written yet
<Cadey> yeah
<Cadey> i realize
<daurnimator> it was pending the async work.... and now I just haven't had time
<Cadey> at the least it works :^)
<daurnimator> I don't think we have an async 'write' yet do we?
<daurnimator> Not that it matters. I might write the h1_connection layer right now :)
<Cadey> i need to figure out how to best implement olin support into the zig stdlib
<daurnimator> At least to stop you from using that hack ;)
FireFox317 has quit [Ping timeout: 264 seconds]
gruebite has joined #zig
<gruebite> what's the different between `!i32` and `anyerror!i32`?
<Cadey> gruebite: IRIC the former implies the latter
<Cadey> IIRC*
<daurnimator> gruebite: in a return type?
<daurnimator> gruebite: the former infers the possible errors in your function
<Cadey> daurnimator: what i'd really like is the ability to get the bytes of a HTTP request so i can write it to the olin HTTP resource
<daurnimator> Cadey: right, so you want to write what I've been calling an "io provider"
<Cadey> that sounds right :D
<daurnimator> at this point in time its all in my head I think :P
<Cadey> daurnimator: so the way i have HTTP requests/responses working with this thing is that i write the request bytes to a file descriptor, flush it once i'm done to have it perform the whole HTTP transaction and then read the response bytes back
<Cadey> the design was inspired by go's http.RoundTripper: https://godoc.org/net/http#RoundTripper
<daurnimator> Cadey: you should flush after each header block and each body chunk
gustav_o has quit [Remote host closed the connection]
<daurnimator> for a general http client, request bodies can be infinite in length
<Cadey> yes, i'm aware this isn't the most compliant
<daurnimator> Cadey: give me 30 mins.... I'll write something and send a PR
<Cadey> it's less a generc HTTP client and more of a "oh my god can i finally do this???" thing
<Cadey> :+1:
<Cadey> generic*
<Cadey> mmm
<Cadey> cool
Ichorio has joined #zig
Ekho- is now known as Ekho
VLetrmx has quit [Quit: leaving]
<daurnimator> welp. my computer died compiling zig
<daurnimator> back again now and I think I've compiled it
<daurnimator> but that was an unproductive hour
mahmudov has joined #zig
return0e has joined #zig
kahiru has quit [Ping timeout: 276 seconds]
waleee-cl has joined #zig
kenaryn has quit [Quit: WeeChat 2.3]
<daurnimator> andrewrk: why is std.http.headers not in the generated docs?
<daurnimator> ==> it has tests...
<daurnimator> Cadey: sigh; without the "io provider" piece done I'm a bit lost
<Cadey> daurnimator: does zig have functions as data?
<daurnimator> Cadey: yes...... but I recall there's something weird about async functions as data
<daurnimator> and this is a prime example of exactly where we want async functions
<Cadey> andrewrk: what is the zig equivalent of go's interfaces?
<Cadey> would it be like a vtable or something?
rjtobin has joined #zig
<Snektron> Can Zig's frames be used to implement closures?
doublex has quit [Read error: Connection reset by peer]
doublex_ has joined #zig
doublex_ has quit [Read error: Connection reset by peer]
doublex has joined #zig
doublex has quit [Ping timeout: 240 seconds]
doublex has joined #zig
doublex has quit [Ping timeout: 276 seconds]
porky11 has joined #zig
<mq32> Cadey: interfaces can be done with @fieldParentPtr and embedding the interface in the "implementing class". See std.mem.Allocator / std.heap.FixedBufferAllocator for an example
<mq32> Snektron: i had an idea how to implement this by creating something out of a function pointer and a loop
<mq32> i'll try to hack a PoC together
* daurnimator is getting confused between the various "outstream" functionality around
<daurnimator> none of them quite do what I want.. and having trouble picking the right starting point
<mq32> huh
<mq32> can somebody explain why arguments in FnArg have "arg_type: ?type" as a field?
<mq32> is this for arguments that use comptime derived args?
Akuli has quit [Quit: Leaving]
<daurnimator> mq32: I guess for when is_generic is set?
<daurnimator> mq32: i.e. `var`?
<mq32> yeah, probably
<mq32> Snektron: okay, i've hit language restrictions :D
emekoi has joined #zig
emekankurumeh[m] has joined #zig
<emekankurumeh[m]> i don't if it's because i got a new computer or what, but the zig compiler has been feeling extremely fast lately
emekoi has quit [Remote host closed the connection]
<daurnimator> emekankurumeh[m]: probably the new computer :P
<daurnimator> hmmmm. writevAsync doesn't exist
<daurnimator> sigh.... our write wrapper ignores short writes
doublex has joined #zig
doublex has quit [Quit: Quit]
doublex has joined #zig
<Snektron> i like the documentation
<Snektron> though field documentations feel like they take a bit too much space
<Snektron> and some funcitons are documented as taking or returning var while thats different in the code
<emekankurumeh[m]> i hate syntax highlighting so much
<Snektron> why
<nrdmn> syntax highlighting in general?
<emekankurumeh[m]> writing it
<mq32> hmm
<mq32> <Snektron> though field documentations feel like they take a bit too much space
<mq32> +1
<mq32> i have still some problems with understanding async functions
<mq32> i can't quite grasp where the function will return to when suspending
<Snektron> caller?
<nrdmn> what do you need for syntax highlighting, anyway? The standard library already has code for tokenization
<mq32> but which caller? :D
<mq32> because if i await something, this is also a suspension point
<mq32> so if i'm three calls deep in the stack, i will still suspend to an explicit async invocation
<Snektron> is there any functionality for generating sources in zig's build tool
<Snektron> i don't see any
<Snektron> except run steps, but that will just regenerate the source every time and that might be a bit annoying
<daurnimator> mq32: you return to the point that used `async` or `resume`
<mq32> hm, okay
<mq32> have to do some tests to understand how the codeflow will actually look like :D
<mq32> so "await" will just suspend once and will then assume that on the next return the awaited value is ready?
<marler8997_> so, zig supports rvalue references then?
<mq32> huh, do you have an example for that?
<marler8997_> I can do this someFunc(&anotherFunc())
<mq32> oh crazy :D
<mq32> but seems legit to support this
<mq32> makes a lot of stuff easier
<marler8997_> Yeah, wasn't expecting it to work, but it did
squeek502 has quit [Ping timeout: 240 seconds]
<mq32> hm
<mq32> i ran into an interesting case here
<mq32> error: function is not comptime-known; @asyncCall required
<mq32> so calling a (sync) function pointer in an async function does not seem to work directly
porky11 has quit [Quit: Leaving]
reductum has joined #zig
kurufu has joined #zig
Ichorio has quit [Ping timeout: 245 seconds]