ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
laaron has quit [Remote host closed the connection]
laaron has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
marijnfs__ has joined #zig
marijnfs_ has quit [Ping timeout: 245 seconds]
kristoff_it has joined #zig
shritesh has quit [Remote host closed the connection]
kristoff_it has quit [Ping timeout: 244 seconds]
shritesh has joined #zig
shritesh has quit [Client Quit]
curtisf has joined #zig
laaron has quit [Quit: ZNC 1.7.1 -]
laaron has joined #zig
<curtisf> Is there any update to date reference on targeting webassembly?
<andrewrk> Tetralux, if you want a small binary, use --release-small --strip
rjtobin has quit [Quit: Leaving]
laaron has quit [Quit: ZNC 1.7.1 -]
laaron has joined #zig
jrudolph has joined #zig
laaron has quit [Quit: ZNC 1.7.1 -]
laaron has joined #zig
curtisf has quit [Remote host closed the connection]
kristoff_it has joined #zig
avoidr has quit [Quit: leaving]
return0e_ has joined #zig
return0e has quit [Ping timeout: 246 seconds]
kristoff_it has quit [Ping timeout: 245 seconds]
samtebbs has joined #zig
alexander92 has joined #zig
alexander92 has quit [Ping timeout: 258 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
laaron has quit [Quit: ZNC 1.7.1 -]
laaron has joined #zig
laaron has quit [Client Quit]
laaron has joined #zig
laaron has quit [Client Quit]
laaron has joined #zig
vegai has quit [Remote host closed the connection]
fengb has quit [Read error: Connection reset by peer]
Demos[m] has quit [Write error: Broken pipe]
D3zmodos1 has quit [Remote host closed the connection]
jzck has quit [Read error: Connection reset by peer]
Snektron has quit [Remote host closed the connection]
BitPuffin has quit [Write error: Connection reset by peer]
laaron has quit [Client Quit]
mikdusan has quit [Ping timeout: 245 seconds]
BitPuffin has joined #zig
laaron has joined #zig
vegai has joined #zig
Demos[m] has joined #zig
D3zmodos has joined #zig
fengb has joined #zig
jzck has joined #zig
Snektron has joined #zig
<Snektron> Test
<mq32> Test failed.
samtebbs has quit [Ping timeout: 252 seconds]
<Snektron> Matrix was acting up
samtebbs has joined #zig
kristoff_it has joined #zig
<kristoff_it> Now that GitHub is letting everyone use build pipelines, a *super* cool project would be to have a build step in build.zig that creates the documentation from doc comments and then force-commits it to the _ghpages branch
<kristoff_it> so that every zig repo gets its own doc immediately available, without intermediary sites like
<daurnimator> kristoff_it: bit of a long path to that I think
<kristoff_it> daurnimator: yeah I guess, although once we have a package manager even a rudimentary docgen would be enough to get started. The rest can be handled via a simple GitHub Action
<samtebbs> kristoff_it: How do you see that interacting with actions?
shritesh has joined #zig
<shritesh> Not sure if it's the codegen or std.zig.render that's improved, but the wasm output from zigfmt-web is now 262K instead of 1.5M
<kristoff_it> samtebbs: you setup an action to trigger at every push, for example, and the action runs the tests. If the tests pass, you call a docgen step in zig build which creates a few artifacts in a dir outside of where the repo was cloned (e.g /docgen), then another GH action swtiches branch, copies the contents of /docgen and then pushes a new commit
<kristoff_it> it's basically what people already do with static websites
<daurnimator> kristoff_it: rudimentary docgen is a bit far off right now
marijnfs__ has quit [Quit: WeeChat 2.4]
<kristoff_it> daurnimator: what about the docs in
shritesh has quit [Remote host closed the connection]
<daurnimator> kristoff_it:
shritesh has joined #zig
laaron has quit [Quit: ZNC 1.7.1 -]
laaron has joined #zig
karrick has quit [Ping timeout: 268 seconds]
<samtebbs> kristoff_it: Yeah that would be a nice idea, we need a doc generator first though
laaron has quit [Quit: ZNC 1.7.1 -]
laaron has joined #zig
laaron has quit [Quit: ZNC 1.7.1 -]
laaron has joined #zig
return0e has joined #zig
return0e_ has quit [Ping timeout: 246 seconds]
<andrewrk> I posted dbandstra's game oxid to /r/programming
waleee-cl has joined #zig
Akuli has joined #zig
<daurnimator> andrewrk: for something like do you want to leave it open or should I e.g. close it?
<andrewrk> daurnimator, ideally we would identify the underlying cause of the crash before closing it, since the new DirectAllocator API probably just masked the symptoms. However it's pretty likely this case is covered by another report. I'm ok with closing it due to not being able to repro it
laaron has quit [Quit: ZNC 1.7.1 -]
<daurnimator> andrewrk: k. will close as fixed and likely a dupe of #2692
<andrewrk> sounds good
laaron has joined #zig
laaron has quit [Client Quit]
<daurnimator> andrewrk: whats your next task to tackle?
laaron has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
<andrewrk> (1) bugs & PRs to prepare for the release (2) making progress on this branch: which is a proof-of-concept of making the std lib able to switch between event-based or blocking with a single global config setting in the root source file
<daurnimator> (1) sounds fair enough :P 113 open bugs before 0.5.0
<andrewrk> yeah. they're not all going to get fixed
<andrewrk> but zig's stability can be greatly improved before the release
<shritesh> Are there any examples of build.zig linking dylibs on MacOS? I can't seem to find any.
<andrewrk> shritesh, I don't have an example handy but it's pub fn linkFramework(self: *LibExeObjStep, framework_name: []const u8) void
<shritesh> I tried that. But it seems to not respect exe.addLibPath
<andrewrk> ok yeah I just looked at the docs for LLD command line args and it's -F for framework search paths, and zig doesn't expose this option currently
<andrewrk> let me wire that up for you real quick
<shritesh> Thanks
<andrewrk> shritesh, are you able to test a branch for me?
<shritesh> Sure
<andrewrk> framework-dirs
<andrewrk> the cli option is -F. the build.zig option is addFrameworkDir
<shritesh> The -F is being passed
<shritesh> but I got Assertion failed. This is a bug in the Zig compiler.
<andrewrk> I reproduced it on my mac
<andrewrk> oh. dammit
<andrewrk> shritesh, fixed in the branch
<samtebbs> andrewrk: I would love to fix more bugs and contribute more but find it hard to navigate the codebase and understand what is causing a bug, do you have any tips?
<andrewrk> samtebbs, here's an idea, if you pick a couple bugs that you tried and were difficult to work on, tell me which one(s) they are. And I'll dedicate one of the livestream days to debugging it and showing how to navigate, understand the bug, and troubleshoot it
<shritesh> andrewrk: No longer getting the error. BUT, turns out, the library I'm trying to link doesn't have a framework, just a dylib :D
<andrewrk> shritesh, sometimes eliminating a red herring is the best path to the solution :)
<andrewrk> I would even go so far as to say nearly always
<samtebbs> andrewrk: That would be fantastic :) I'm in the UK so can't always watch them live but would definitely watch it when it goes up on YouTube
<samtebbs> I'll take note of some I looked at yesterday and let you know before the stream on Thursday
<vegai> does zig test somehow resolve the std library paths differently from build-lib?
<andrewrk> vegai, no
<samtebbs> Leaving work now but will drop in later
<vegai> I'm probably doing something wrong here, I'll paste my output
<andrewrk> vegai, your build-lib has no exports, it's creating an empty library. the import never happens
<vegai> zig version says "0.4.0+6ab8b2aa"
<vegai> ahh, I see
<andrewrk> you want const parse_float = std.fmt.parseFloat
<andrewrk> only inside the std lib can the std lib import its own files by path
<andrewrk> from outside a package you have to use the package's API
<vegai> yep, that did it. Thank you
<vegai> package in this case is "std"?
<andrewrk> yes
<vegai> great, I'm not totally lost :)
casaca has quit [Ping timeout: 246 seconds]
casaca has joined #zig
<daurnimator> huh. I notice std.fmt doesn't print comptime floats
<andrewrk> var args has a bunch of limitations currently
<daurnimator> Even e.g. `formatFloatScientific` doesn't
<daurnimator> or does it?
casaca has quit [Ping timeout: 244 seconds]
<daurnimator> huh. maybe it does. at least it does for 42.0
casaca has joined #zig
curtisf has joined #zig
kristoff_it has quit [Ping timeout: 258 seconds]
ntgg has joined #zig
return0e_ has joined #zig
return0e has quit [Ping timeout: 264 seconds]
<daurnimator> So.... possibly a big topic: I think zig needs a string type: there's far to many times that you want to distinguish between slice of u8 and something that's meant to be utf8 text
<daurnimator> *too
<daurnimator> I think I might propose that string literals and e.g. `` become a new "Utf8String" type. This type should implicitly cast to `[]const u8`, but not the inverse.
bastienleonard has joined #zig
<Tetralux> daurnimator: In my code, there's a possibility that I do `const string = []const u8;`
<Tetralux> .. Makes declaring an array of string easier xD
<daurnimator> Tetralux: so/okay?
<daurnimator> Tetralux: the Utf8String type I'm proposing would be part of builtin.
<Tetralux> Indeed.
<Tetralux> Though, I'd be inclined to use it everywhere.
<Tetralux> Though that would depend how transparent it was.
<daurnimator> well it depends on if you have a string or arbitrary bytes...
<Tetralux> I mean... if you have arbitrary bytes, sure you'd just use []u8?
<daurnimator> exactly
<Tetralux> So long as you can cast one to the other.
<daurnimator> I'm saying you should be able to cast from Utf8String to []u8 but not back the other way.
mikdusan has joined #zig
<Tetralux> How do you read a Utf8String from a socket then?
<Tetralux> Utf8String.initAndValidate?
<daurnimator> You would explicitly have to cast the bytes to Utf8String
<daurnimator> in debug mode that would include a check that they are actually valid utf8
<Tetralux> > You would explicitly have to cast: Okay good - that's what I was fishing for.
<Tetralux> As an aside, I would also suggest you have Utf32String and have it indexable.
<Tetralux> I would also consider calling it 'string' and 'string32' respectively.
<daurnimator> .... no
<daurnimator> the only reason Utf8String needs to exist as a builtin is that string literals would be it
<daurnimator> as we don't have (and never should have) utf32 string literals, then your Utf32String can live in the standard library or elsewhere
<curtisf> I guess the counter argument would be that you could just have a function which takes a comptime []const u8 and ensures it's correctly encoded and does the cast for you
ntgg has quit [Ping timeout: 244 seconds]
<Tetralux> The reason I say about Utf32, is that I'd consider using it for any program that does string processing.
<daurnimator> Tetralux: you should almost never do that
<Tetralux> It makes reasoning about the code easier.
<daurnimator> Tetralux: it's much faster to work in utf8 space. and you should be using a library for manipulating unicode strings
<daurnimator> if you're manipulating unicode strings by doing anything other than concatenating them..... you're going to probably be buggy
<Tetralux> I'd love to see a benchmark of the speed difference.
<Tetralux> But also
<Tetralux> Being able to index characters is very handy.
<daurnimator> Tetralux: citation required
<andrewrk> indexing characters is a footgun
<Tetralux> I mean
<Tetralux> Maybe I'm not understanding unicode correctly
<Tetralux> But
<Tetralux> Surely it's obvious that if you reliably index graphems, you're better than if you have to interpret varying-length sequences.
<curtisf> you can't "index characters", you can only index codepoints, hence footgun
<daurnimator> Tetralux: one codepoint does not always correpond to one grapheme. it's usually a bug to index a unicode string
<Tetralux> .. a u32 codepoint?
<daurnimator> yes
<Tetralux> Surely that contains every single character in existence.
<daurnimator> no
<daurnimator> I think the longest is 22 codepoints?
<Tetralux> 4 billion characters does not contain every possible combination of characters in existence?
<daurnimator> ﷽
<andrewrk> unicode focuses more on embracing all languages and locales, rather than on ease of implementation or any sort of consistency
<curtisf> A huge number of characters are encoded using multiple code points (I believe all of Korean's Hangul, for example, are encoded using two codepoints)
<Tetralux> curtisf: Yeah - I'm asking if that's the case still in utf32.
<daurnimator> Tetralux: ﷽ that is a single grapheme that is 22 codepoints IIRC.
<curtisf> UTF32 is an encoding of unicode
<curtisf> Unicode strings are sequences of codepoints
<daurnimator> Tetralux: utf32 just means 1 codepoint takes up 32 bits.
<curtisf> A hangul character is multiple codepoints. Its doesn't matter what encoding you use
<curtisf> ah, correction; most of Hangul is *also* encoded as single-codepoint-characters, but some, e.g., archaic characters aren't
<daurnimator> curtisf: yes there is composed and decomposed forms
<andrewrk> bottom line is: don't assume you can do anything with strings, without verifying that operation is sound
<andrewrk> and I mean anything - even comparing for equality has complications.
<andrewrk> I've been careful to call things "bytes" in the std lib rather than using the word "string"
<daurnimator> andrewrk: thoughts on my proposal above for Utf8String as a new builtin type?
<andrewrk> I don't think you successfully justified it. I suggest trying to revive one of the closed proposals for it
mattmurr has quit [Read error: Connection reset by peer]
mattmurr has joined #zig
<shritesh> I thought that's what std.unicode.Utf8{View,Iterator} were for
casaca has quit [Ping timeout: 258 seconds]
<daurnimator> The particular use case I'm hitting right now is that I'm jsonifying an arbitrary zig object: but when I hit something with `@typeOf(value) == []const u8` I don't know if I should serialise as an array or a string
<daurnimator> the type system doesn't currently have a way for a user to express that
casaca has joined #zig
<andrewrk> that's a good use case
<daurnimator> but also, it requires that I validate (at runtime) that a `[]const u8` is valid utf8. rather than having it encoded into the type system
rjtobin has joined #zig
<daurnimator> furthermore, serialising as array vs string based on whether a []u8 contains valid utf8 or not, is a footgun waiting to happen that I've immediately eliminated as an option
<andrewrk> it's relevant for std.fmt.format as well
<daurnimator> indeed.
<andrewrk> I'd like to explore the "tags" / field labels first, since that's a more general thing that also addresses this use case
<daurnimator> sidebar: how do you initialise an anonymous union? `union {Foo: u32, Bar: bool}(.Foo = 42)` doesn't work
<andrewrk> anonymous unions & structs need the accepted proposals for "struct literal" syntax in order to be useful
<andrewrk> it would be: .{.Foo = 42}
<daurnimator> anonymous structs work fine: `struct {foo: u32}{.foo = 42}`
<andrewrk> not in all contexts, for example as a function return value
<daurnimator> right
<daurnimator> I'm just trying to write some one-liner tests for various structs
<daurnimator> (and unions, and enums)
<mikdusan> andrewrk: yes tags would be interesting: `const String = ([]const u8)[:utf8];` and std.mem could still be used for many operations but would need specializations for mem.trim et al
<mikdusan> s/const//
<mikdusan> ah my example is all wrong. nuke it.
<Tetralux> I feel like there should be an encoding where each integer value is just another number or something.
<Tetralux> Cause that...
<Tetralux> That is kinda silly.
nitram91 has joined #zig
<nitram91> Hello, I'm trying to use file streams ( but I'm getting typecasting errors, what is ',anyerror)' ?
<andrewrk> nitram91, that's a type
<nitram91> welll yes
<andrewrk> I think you want to take the pointer to the stream field of the seekable stream
<andrewrk> const seekstream = &fs.File.seekableStream(a_out).stream;
<nitram91> but how am I supposed to use it ? How do I get it from a file ? I'm going through the zig's std source but I don't really understand
<nitram91> oh ok
<andrewrk> this is how we get "interfaces" without any language feature
<andrewrk> for now at least
<nitram91> yeah, that's what I'm starting to understand from reading the comments
<nitram91> Are there any docs regarding the "traits" in zig ?
<andrewrk> no
<andrewrk> just source
<nitram91> ok, I'll go through the source then
<nitram91> thanks
<andrewrk> good luck, feel free to ask questions
<Tetralux> You do a_out.seekableStream(); - You use that to seek.
<andrewrk> Tetralux, did you see that they posted a code example?
<Tetralux> Yeah
<Tetralux> The key point is
<Tetralux> That the thing you get from .inStream, .outStream, .seekableStream is how you get that functionality from the thing.
<Tetralux> Whereas, with real interfaces,
<Tetralux> They'd just be member functions on the File.
<Tetralux> It's kinda like casting the File to the SeekableStream interface.
<Tetralux> Kinda.
shritesh has quit [Quit: Leaving...]
<Tetralux> SeekableStream is a little different to the others.
<Tetralux> Short version: it's confusing xD
<nitram91> indeed it is
casaca has quit [Ping timeout: 258 seconds]
casaca has joined #zig
<nitram91> what I don't get is, if this pretty much works like an interface, then why do I get this warning ? note: pointer type child 'std.fs.file.SeekableStream' cannot cast into pointer type child ',anyerror)'
tav has quit [Quit: Connection closed for inactivity]
kristoff_it has joined #zig
shritesh has joined #zig
<nitram91> I changed my code to this but I'm getting another error: error: expected type '*,anyerror)', found '*,error{Unseekable,Unexpected,SystemResources,})'
<andrewrk> nitram91, those are different structs
<andrewrk> that second error is
<andrewrk> I'm still thinking about how to solve this. You can work around this with a ptr cast, because those types are guaranteed to be identical
kristoff_it has quit [Ping timeout: 246 seconds]
<daurnimator> hrm. has anyone actually used std.json for parsing? I don't see how to e.g. actually get the number out of a token?
<nitram91> when printing a struct, how do you print with newlines between each struct field ? (can I put anythiing in the format string to make it work ?)
<daurnimator> nitram91: I don't think there's an option for thast
<nitram91> darn it
* daurnimator frowns at the parser in std.json.... it's a per-byte push parser. I'm pretty sure that can never be efficient/competitive
<mikdusan> basically add a `fn format` to your struct
shritesh has quit [Quit: Leaving...]
<Tetralux> daurnimator: I'd be interested in measurements for that.
<nitram91> ok thanks mikdusan
shritesh has joined #zig
Akuli has quit [Quit: Leaving]
return0e has joined #zig
return0e_ has quit [Ping timeout: 245 seconds]
samtebbs33 has joined #zig
SimonNaa has quit [Remote host closed the connection]
<nitram91> andrewrk I have a question regarding some code (I'm trying to contribute to some TODO: implement me functions), can I ask a small question here or should I open an issue ?
casaca has quit [Ping timeout: 246 seconds]
<andrewrk> ask away
<andrewrk> open an issue if you don't get a response
<nitram91> andrewrk I'm trying to implement Elf.openFile in elf.zig and there is a comment on top of the function saying "Call close when done". Which I guess implies it should be closed using Elf.close. Is that really what is wanted, shouldn't the file only be closed by File.close and not by the Elf.close ?. (i hope im being clear)
casaca has joined #zig
Ichorio has joined #zig
<andrewrk> nitram91, there used to be implementations there and the API changed, that's why those are there. the reason Elf.close exists is that it may have other resources such as allocated memory to clean up
<andrewrk> Elf.close will probably call File.close
<andrewrk> if you call openFile then it should leave it open
<andrewrk> there used to be an Elf.auto_close field to distinguish
<nitram91> ok, makes sense
<daurnimator> how can I turn a *T into a slice of length one?
<curtisf> std.mem.Allocator.destroy does it, though it's not so pretty looking
<curtisf> maybe it's already wrapped up somewhere else in std
<daurnimator> `@ptrCast([*]u8, &c)[0..1]` works I guess...
<andrewrk> better to avoid ptr cast. you can do it with 2 implicit casts
<andrewrk> ([]T)(*[1]T)(&x)
<Tetralux> Those are implicit casts?
<andrewrk> yes. did I make a proposal for adding a field as a pointer property of single-item pointers yet? e.g. ptr.many would turn a *T into a *[1]T
<daurnimator> andrewrk: k. though TBH I think that's less readable. also I have to repeat `T`
<curtisf> probably it should be at least a function added to std.mem.?
<andrewrk> we already have slice.ptr which turns a []T into a [*]T
<daurnimator> andrewrk: how about a cast directly: `([]T)(&x)`?
<andrewrk> that's possible. but it sort of defeats the point of separating one-item pointers
<mikdusan> ptr.many? then if ptr is to a struct, field name must never == "many"
<daurnimator> andrewrk: FWIW I'm trying to pass a one-item pointer to read()
rappet has quit [Read error: Connection reset by peer]
rappet has joined #zig
<andrewrk> mikdusan, oh right. that's a bad idea
<andrewrk> daurnimator, yeah I'm aware of this awkwardness
<andrewrk> making *T cast to []T is not off the table, I'll still consider it
<andrewrk> but I want to make sure there are no footguns associated with that
<andrewrk> better to have some awkwardness than an (even rare) footgun
<daurnimator> FWIW it's not super bad. the `[]T` is already in the function signature, so I only have to write: `*[1]u8)(&c)))`
<mikdusan> +1
<daurnimator> but without you andrewrk I don't think I ever would have thought of the intermediary cast to `*[1]T`
<daurnimator> so need some sort of discoverability of that...
<andrewrk> yeah
<Tetralux> One way might be to make things like `usize(m)` be extended, so that you do it more often.
<Tetralux> Like `warn("{} / {} ({} %)\n", n, count, f64(n) / f64(count));`
<daurnimator> andrewrk: currently the compiler error is just `expected type '[]u8', found '*u8'`. Perhaps it should gain a note "did you want a slice of length 1? cast via '*[1]u8'"
<daurnimator> Tetralux: I have no idea what you're saying there...
<andrewrk> daurnimator, I agree, PR or issue welcome
<daurnimator> andrewrk: k.
<daurnimator> then bed for me :)
<andrewrk> I was gonna say
<Tetralux> daurnimator: .. because then you'd be more used to being able to do T(X), and it might therefore occur to you to try it in that circumstance.
<daurnimator> yeah... 6am
<andrewrk> goodness. get some sleep!
return0e has quit [Ping timeout: 244 seconds]
return0e has joined #zig
<samtebbs33> I think I'm having a brainfart here, but how do I get the address of an array? I've tried various combinations with @ptrToInt but the compiler always complains that "it can't evaluate the constant expression"
<andrewrk> &array
<andrewrk> can you show more of the output?
<andrewrk> it sounds like you're trying to get the address of an array at compile-time
<samtebbs33> It's within a test
<Tetralux> You mean you want *[]T?
<samtebbs33> Which no that I think of it, essentially is compile time
<andrewrk> within a test is not comptime
<Tetralux> ( .. zig test produces an exe which is then run)
<samtebbs33> Tetralux, andrewrk: Ah ok
nitram91 has quit [Remote host closed the connection]
<samtebbs33> So I had the array declaration outside of the test block which when moved to within the test block compiled fine
<andrewrk> samtebbs, ah yes that was it. global variable initializations run at comptime
<andrewrk> in theory that should still work. the new lazy value stuff got us closer to that working
<Tetralux> Wait - you couldn't take the address of a global array in a test?
<Tetralux> Yeah - that certainly should work at some point.
<andrewrk> address of a global array in a global
<Tetralux> Ah right, right. Just a dependancy-order thing then.
<Tetralux> "This array has to be set up before you can take its ptr."
<Tetralux> I'm curious about how the lazy stuff actually works.
<Tetralux> Like, it's _not_ like, "Oh - this thing isn't ready yet. I should come back to it later"
<Tetralux> Right?
<Tetralux> It's more, "You don't need to fully evaluate this thing in order to say 'I want the pointer to it's value.'"
<samtebbs33> andrewrk: It may not have worked because I'm on 0.4.0 in this project. I get some compiler segfaults/assertion failures when analysing build.zig if I use master
<samtebbs33> I still need to make a test case for that and report it actually
<mikdusan> ziguana lounges around all day long. he's real lazy and only does what he must.
<andrewrk> samtebbs, ah. I'd be interested in helping you get onto master before 0.5.0 is released. I'll start with the bugs you have open
dbandstra has joined #zig
rjtobin has quit [Ping timeout: 245 seconds]
<samtebbs33> andrewrk: Thanks :) I'll try to make a small test case then report it
<samtebbs33> The ones I currently have open aren't blockers, possibly with the exception of #2791
<Tetralux> Why can't you compare ?u64?
<Tetralux> Or presumably any two ?Ts for that matter.
nitram91 has joined #zig
<samtebbs33> Ok looks like #2791 is the same issue
<mikdusan> wanting to compare if_null or values or both?
nitram91 has quit [Remote host closed the connection]
kristoff_it has joined #zig
<Tetralux> mikdusan: For x, y: ?T => x == y
kristoff_it has quit [Ping timeout: 244 seconds]
<mikdusan> i wouldn't mind that feature as long as in that equality (x != null) && (y != null), the value equality follows the same rules as `T1 == T2`
<Tetralux> I was doing it on integers, so that would work.
<Tetralux> Also
<mikdusan> eg. `?u64 == ?u32` ok. but still want a compiler error `?f32 == ?u32`
<Tetralux> mikdusan: I was looking for `if (a == null and b == null) return true; if (a != null and b != null and a == b) return true; return false`
<Tetralux> But yes
<Tetralux> That's a valid use case too I'd imagine.
<Tetralux> But yes
<Tetralux> Also
<Tetralux> Has anyone else seemingly had problems related to list.popOrNull
<Tetralux> where list is std.ArrayList(?u64)
<Tetralux> where you'd do `list.popOrNull else unreachable`
<Tetralux> (.. meaning, I want to get the last elem, which may be null or a u64)
mahmudov has joined #zig
<Tetralux> But not being able to tell if it was empty, or if the elem was null.
<mahmudov> hi, any help for building
<andrewrk> mahmudov, do you see the error? LLVM is missing target AArch64. Zig requires LLVM to be built with all default targets enabled.
<mahmudov> yes andrewrk i couldn't figure out it so
<mahmudov> which cmake flag i need
<mahmudov> i used this
<mahmudov> as build script
<andrewrk> mahmudov, your llvm package has been mangled/forked/misconfigured
<andrewrk> zig is refusing to build against it
<mikdusan> (ewww that git error is distracting)
<mahmudov> hmm
<andrewrk> unrelated: this is the next step in the async/await proof-of-concept:
<andrewrk> mikdusan, oh, that's coming from zig's cmake isn't it? it's also doing the wrong thing, producing a + there
<mikdusan> just verified ERROR_QUIET is supported by your cmake 2.8.5 low-mark. that should hush up git fatal.
<mikdusan> what did you want instead of '+' behavior ?
<andrewrk> same behavior as if git is not found on the system, leave ZIG_VERSION as the value it is already initialized to
<mikdusan> ok. i'll do a PR after some trial runs.
<andrewrk> thanks!
<andrewrk> I'll spend some time on bugs & PRs before getting to 3157
<mahmudov> so i can't buid zig?
<andrewrk> mahmudov, not without LLVM
<mahmudov> i have already it
<Tetralux> .. Not without LLVM that has AArch64 enabled.
<mahmudov> got it
<Tetralux> .. Which is set up when LLVM is built.
<mahmudov> ok
<Tetralux> So, you either need to build LLVM yourself, or find a binary of it that has that stuff enabled, IIUC.
<mahmudov> clear Tetralux , thnks
<Tetralux> o7
<mahmudov> going to do
ltriant has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
Ichorio has quit [Ping timeout: 264 seconds]
<mikdusan> Tetralux: for #3158 are you getting: LLVM ERROR: Broken module found
<Snektron> Is it possible to detect an @cDefine from Zig?
<Snektron> Does that just define a symbol with the same name?
<Snektron> (i remember something about defines not working with zig translate-c, im not sure if it works now)
kristoff_it has joined #zig
shritesh has quit [Quit: Leaving...]
kristoff_it has quit [Ping timeout: 244 seconds]
<Tetralux> mikdusan: No.
<Tetralux> Snektron: @cDefine does the equivalent of #define in the C file IIRc.
<mahmudov> i re-compiled llvm with multi-target
<Tetralux> Try with Zig master branch.
<andrewrk> zig 0.4.0 source will not build with gcc 9.1.0
<andrewrk> mahmudov, I believe you want to be using -DCMAKE_BUILD_TYPE=Release or -DCMAKE_BUILD_TYPE=RelWithDebInfo
<andrewrk> that disables -Werror
<mahmudov> ok
<andrewrk> that should work with gcc 9
<andrewrk> or - as Tetralux noted, a master branch debug build. I don't see the purpose of a 0.4.0 debug build
<mahmudov> shoukd it need?
<mahmudov> should*
<andrewrk> I recommend to leave that on the default
<mahmudov> ok
<mahmudov> ok -DCMAKE_BUILD_TYPE=Release figure out
bastienleonard has quit [Ping timeout: 264 seconds]
<mahmudov> # zig
<mahmudov> : CommandLine Error: Option 'xcore-max-threads' registered more than once!
<mahmudov> LLVM ERROR: inconsistency in registered CommandLine options
<Tetralux> You did do git checkout master yeah?
<mahmudov> i used this
<andrewrk> looks like daurnimator added this option which should solve it: -DZIG_STATIC_LLVM=ON
<Tetralux> andrewrk: That isn't in 0.4 though, right?
<andrewrk> oh, yeah. that patch is in master but not 0.4
<Tetralux> mahmudov: It should be fine if you use (assuming not BSD) and then build that.
<mahmudov> ok
<Tetralux> Oh right - if you use that you won't have to build it
<Tetralux> If that still has problems for you, then you can use git and clone it from source - then build that.
<Tetralux> Hopefully one of those works.
shritesh has joined #zig
<mahmudov> i nned to build from source
<mahmudov> need*