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/
<marijnfs> so many commits
marijnfs has quit [Quit: WeeChat 2.4]
<andrewrk> yeah it's not trivial to fundamentally change how expressions work
marijnfs__ has joined #zig
marijnfs_ has quit [Ping timeout: 258 seconds]
curtisf has joined #zig
<mikdusan> fyi llvm-8.0.1 is about to get tagged. i've been using zig against llvm-8.0.1-rc1 for 2 weeks now without issue
<mikdusan> *on macOS
<andrewrk> 600/616 behavior tests passing
<emekankurumeh[m]> this is exciting
<THFKA4> ship it
<emekankurumeh[m]> are you going to stream tommorow andrewrk? if so, maybe you should save the last test for the stream.
<andrewrk> haha fun idea
<scientes> get some baloons
<marler8997_> andrewrk: no, thanks for the info, I'll update my tool to use that
<andrewrk> 602/616
<marler8997_> why does the ziglang.org site redirect all http requests to https?
<andrewrk> best practice
<marler8997_> the server is denying download access from the python urllib downloader because it hasn't enabled cookies :)
<marler8997_> silly
<andrewrk> how do you know that?
<marler8997_> the html response I got
<andrewrk> I don't have any html responses configured
<andrewrk> *sigh* this looks like another "feature" enabled by default by cloudflare
<marler8997_> best practices right? :)
<andrewrk> marler8997, I believe that setting is disabled now
<marler8997_> my script is getting further now, looks like it's disabled now
<marler8997_> using the json format is much nice, removed like 20 lines of python parse code
<marler8997_> the json format is a bit weird though
daex has joined #zig
Ichorio has joined #zig
very-mediocre has joined #zig
<very-mediocre> andrewrk: you might be interested in https://news.ycombinator.com/item?id=20229632
<andrewrk> still no source
<very-mediocre> the source will be released on the 22nd
<very-mediocre> just wanted to give you a heads up since this language had come up before in discussions
<very-mediocre> there's this unrigorous air about it that's bugging me, everything seems really simple I feel like there must be gremlins under the surface somewhere
curtisf has quit [Ping timeout: 256 seconds]
<torque> lol the compiler checks online for updates before compiling https://github.com/vlang/v/issues/284 this seems like a very good sign of things to come
<very-mediocre> yow.
ltriant has quit [Quit: leaving]
_whitelogger has joined #zig
marmotini_ has joined #zig
<andrewrk> I said my piece on HN. as tempting as it is, let's try to keep it zig-focused & productive in #zig
<andrewrk> (if there are any actually good ideas V has they are of course on topic)
<very-mediocre> sure
<mmx87> andrewrk, this seems a bit much? Is this intended?
<andrewrk> mmx87, I'm aware of the uninitialized value jump in llvm's dwarf code although I haven't submitted a patch to them yet
<andrewrk> if you're referring to the "leaks" don't forget that the OS frees all the memory when you exit()
<andrewrk> stage1 compiler will never bother freeing memory. the self-hosted compiler is a long-running process and so will manage memory without leaks
<mmx87> >don't forget that the OS frees all the memory when you exit()
<mmx87> Yeah, I know. I was just curious.
daex has quit [Ping timeout: 268 seconds]
daex has joined #zig
<andrewrk> fair enough :)
fsateler has quit [Ping timeout: 258 seconds]
fsateler has joined #zig
Ichorio has quit [Ping timeout: 250 seconds]
<ki9a> bootstrapping is tricky :)
<ki9a> andrewrk: are you happy with llvm?
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
marmotini_ has quit [Ping timeout: 248 seconds]
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
return0e has quit [Ping timeout: 245 seconds]
return0e has joined #zig
very-mediocre has quit [Ping timeout: 256 seconds]
FireFox317 has joined #zig
<FireFox317> Does someone know which of the 2 options I suggested in the issue I should implement for this issue? https://github.com/ziglang/zig/issues/2062
<FireFox317> ^ That sentence is weird xd
kristoff_it has joined #zig
avoidr has joined #zig
<samtebbs> FireFox317: Option 2 is the best option IMO since option 1 seems like a temporary workaround
<FireFox317> samtebbs: With option 2 you mean the separation of the object files inside the library? I think I'm gonna wait on andrewrk's response anyway
<samtebbs> FireFox317: Yeah you should wait, it's probably the best option though :)
st4ll1 has joined #zig
<samtebbs> Is it ok to ping a PR/issue when it's been a week or more since the last feedback? I don't want to bother andrew too much since he has a lot to give his time to.
marijnfs has joined #zig
<marijnfs> zig in sublime text is nice
<marijnfs> can i define anonymous functions?
<BitPuffin> marijnfs: you can define anonymous structs and put functions in them
very-mediocre has joined #zig
uso_ has joined #zig
kristoff_it has quit [Remote host closed the connection]
st4ll1 has quit [Ping timeout: 246 seconds]
very-mediocre has quit [Ping timeout: 256 seconds]
FireFox317 has quit [Quit: Page closed]
curtisf has joined #zig
<curtisf> is there a way to use @field to modify a struct? to accomplish something like this? https://hastebin.com/lehotuqiqu.cs
<curtisf> Oh, that actually works, I must have messed something else up
curtisf has quit [Ping timeout: 256 seconds]
halosghost has joined #zig
fengb has joined #zig
Akuli has joined #zig
marmotini_ has joined #zig
st4ll1 has joined #zig
mikdusan1 has joined #zig
mattisme has quit [*.net *.split]
mikdusan has quit [*.net *.split]
THFKA4 has quit [*.net *.split]
return0e has quit [Ping timeout: 245 seconds]
<samtebbs> Does anyone have any interest in working on a zig equivalent of creduce? I think forking creduce and adapting it to Zig would be viable but I'm not sure how to do so in the best way.
<scientes> samtebbs, everyone here has more to do they have time for
<scientes> oh, yeah that looks cool
<scientes> sorry, didn't know what it was
<scientes> llvm calls the same thing bugpoint
<halosghost> do y'all mean this? https://embed.cs.utah.edu/creduce/
<halosghost> that does look very cool
<samtebbs> There's a git repo at https://github.com/csmith-project/creduce
<samtebbs> It could be useful for reducing reproducable code when submitting a bug report
<samtebbs> etc.
<scientes> it would need to use the stage2 parser
<scientes> so it can keep step with language changes
<samtebbs> scientes: Does bugpoint support arbitrary languages? If that is the case then adapting that could be better
<scientes> i don't know, but probably not
<scientes> i think it is llvm only
<scientes> but it would be useful at the same time, so a unified interface would be nice
<scientes> llvm-ir
return0e has joined #zig
<andrewrk> ki9a, llvm provides a huge part of the compiler. it allows us to have many targets, inline assembly, and debug info on posix & windows. the downsides are it is a huge, cumbersome dependency, and it's the bottleneck in compilation speed of debug mode builds
<daurnimator> There are only so many mature code optimizing backends. Creating one is rarely done without a huge multiyear academic project
<scientes> not to mention maintinance
<daurnimator> not to mention new architectures
<scientes> llvm should be improoved
<scientes> that benifits everyone
<daurnimator> LuaJIT is probably the only one I've seen that was created by one person; and where new architectures came calling
<scientes> gccgo too
<fengb> I've been having trouble with latest running tests on a mac: https://gist.github.com/fengb/36b81ad1529ab5a082021201bb43587e
<scientes> oh that isn't backend
<samtebbs> *leaving work, will rejoin later*
samtebbs has quit [Quit: leaving]
<daurnimator> fengb: tried with master? you have 0.4.0 in your trace there
<fengb> Really weird thing is, fd_t is referenced in functions before and after this line
<daurnimator> fengb: also are you hitting https://github.com/ziglang/zig/pull/2711 ?
<fengb> I named it 0.4.0+[hash]
<fengb> Ahhhh maybe that's it
<scientes> llvm really isn't that bad
<daurnimator> scientes: agreed. I think it would be a waste to duplicate that effort right now. we have better things to work on
<scientes> or ever, other languages want improvements too
<fengb> I think LLVM has some poor C++ idiosyncrasies, but I imagine having more frontends will help guide its efforts
<scientes> only sensible thing would be to add a gcc backend
<scientes> but that would require a lot of work in llvm, like getting llvm's assembly syntax identical to clang (which emulate's gccs)
<AlexMax> I've been really wanting an excuse to translate my C hobby project to Zig, because C's various idiosyncrasies are really starting to bug me, and I always feel a little uneasy about the code I write in it, not ever being completely sure that I'm handling error code paths properly.
<andrewrk> scientes, if zig becomes popular enough, I think people will enjoy creating alternate compilers
<andrewrk> the simplicity makes it more approachable than e.g. making a rust compiler
<AlexMax> However, I recall discussions around the rustification of bzip2, and one of the legitimate beefs I saw floating around was portability, precisely because LLVM just doesn't quite have the reach of GCC and doesn't have the history of most platforms of the past having a C compiler.
<scientes> I can see people writing a differn't zig interpreter for comptime
<andrewrk> I agree that is legitimate beef. But I think there are enough incentives set up for people that it is likely for LLVM to gain more backends
<AlexMax> I always thought that Nim's strategy of simply compiling to C code was quite a clever workaround, but I imagine that's a gigantic can of worms to open.
<fengb> Completely asinine idea: compile to wasm then convert to C
<andrewrk> AlexMax, zig is actually trying to compete with C, that's the main problem with that strategy
<andrewrk> I mean, replace C
<scientes> no new general purpose architecture that doesn't have a llvm AND gcc port can be successful
<scientes> embedded is different
<scientes> compiling to C is quite painful
<AlexMax> Yeah, and I feel like if the goal is long-term replacement, LLVM is the correct play for the primary compiler. But compiling to C might be useful for just getting your foot in the door in a closed ecosystem that knows some propietary C compiler and nothing else.
<andrewrk> fair point
<halosghost> I don't agree
<scientes> nah
<halosghost> compiling-to-c means you bite a ton of C's baggage
<scientes> those platforms are not worth the effort
<scientes> and hsail is here
<halosghost> I quite like C, but compiling to it means you get a ton of issues that you'd almost certainly rather not have
<halosghost> (it's one of the reasons I only looked at nim incidentally; many of the choices they made in their C codegen were major turn-offs for me)
<andrewrk> I think LLVM should have a C target. I believe it used to have one
<AlexMax> Yeah, I noticed that Nim had to pass a bunch of -f flags to the C compiler presumably to make it behave in expected ways.
<scientes> and some of those propriatary compilers are c89-only too
<daurnimator> target web assembly and then use a web assembly VM written in C ;)
<halosghost> AlexMax: and, to be fair, that's how you have to interact with C if you want consistent behavior everywhere; but that's part of the problem
<AlexMax> And even though Nim outputs C, how often do you suppose that proprietary and outdated compilers are actually exercised.
<fengb> andrewrk: how comprehensive should translate-c bitfield be? I saw an issue about packed attributes, but would it okay to ignore for first pass?
<andrewrk> part of the philosophy of what zig is doing is unraveling a few layers of abstraction which have become old and leaky, and then rebuilding them in a modern way
<halosghost> AlexMax: proprietary compilers? all the time
<halosghost> perhaps not with nim
<daurnimator> zig targeting C *is* a good idea though I think. `zig translate-c` exists, why not the other way?
<andrewrk> daurnimator, sure and I want it to be implemented in LLVM
<halosghost> but msvc (which isn't really a C compiler even though folk think of it as one) and icc are quite common in the production world
<daurnimator> andrewrk: I actually think it would be better to use that as a demo usecase of "zig is not tied to LLVM"
<andrewrk> fengb, that's what translate-c does now, it demotes structs with bitfields to opaque types
<daurnimator> andrewrk: have zig be able to output: LLVM IR, GCC trees, C.
<fengb> I mean, I want to implement actual bitfields
<AlexMax> halosghost: Sorry, I should have clarified. I was thinking more along the lines of those weird compilers you see with embedded chips.
<halosghost> AlexMax: ahh
<daurnimator> AlexMax: another interesting use case is targetting MISRA C. It's the only way into parts of the car and aerospace industries
<andrewrk> fengb, ah. incremental improvements are great as long as they don't have false negatives. does that make sense? e.g. don't attempt a translation of a type that would be unsound
<halosghost> daurnimator: that's much more compelling of an idea imo
<fengb> That makes sense. I'm just not familiar with all the __attributes__ that can happen, but I can dig into it
<halosghost> daurnimator: having said that; I cannot, for the life of me, find a freely-available MISRA compilance-checker or a MISRA-only compiler
<halosghost> daurnimator: or even, for that matter, the MISRA spec
<halosghost> daurnimator: do you have links I could use? I've been wanting to get a copy of any of those three things for quite a while
<andrewrk> I am warming up to the idea of having alternate backends besides llvm. but not for a while into the future. I do want to make an attempt for one of these ultra fast debug build compilers that go straight to machine code
<daurnimator> halosghost: I once had one back in university (10+ years ago....) can't remember what is was called.
<halosghost> daurnimator: I would be equally happy with a CERT compliance checker
<halosghost> but I can't find that either without paying a phenomenal amount
<fengb> andrewrk: regarding `zig fmt a && b`, I have a quick port to the stage2 tokenizer, but there's not a good way to generate a useful error atm
<AlexMax> To be clear, I'm looking at the problem strictly from a retrocomputing angle. My hobby project is a libretro core, and RetroArch runs on tons of odd platforms whose toolchains probably haven't been updated in a decade or more. I might be in that 1% of situations where if I want to remain potentially portable to those platforms, I don't really have a choice but to stay with C. I'm part of that 1%, and I
<AlexMax> totally understand if targeting that 1% is probably not worthwhile use of time.
<fengb> I think the tokenizer needs a way to generate errors with messages similar to how the C++ code does it. Thoughts?
<AlexMax> But embedded applications might be another story, and are probably a lot more common than me.
<andrewrk> fengb, I made the design decision that the tokenizer won't emit errors. but it can emit an "Invalid" token
<andrewrk> so the parser will have to notice the invalid token and display an appropriate message
<fengb> It's currently doing "error: expected Semicolon, found Invalid"
<fengb> Oh... push the logic into the parser then?
<andrewrk> you can also just add a token for a double ampersand, and then not do anything with it in the parser
<fengb> Alternatively, would it make sense to tokenize as '&&'
<andrewrk> yeah
<fengb> Ah okay, wasn't sure if that would be considered hacky
<andrewrk> and then there should be a way to make the parse errors nicer, perhaps in general, or perhaps with some special case code for &&
<fengb> Thanks
<AlexMax> If you're writing code for an RTOS for some tiny chip with a proprietary compiler, how would Zig get its foot in the door? That's an open question, not rhetorical.
<andrewrk> fengb, eh, if it doesn't harm perf, and the logic is straightforward enough, I'm not sure it's even possible to put hacks in tokenizers & parsers
<andrewrk> the logic is what you want it to be, if it's a flow chart with && then so be it
<andrewrk> and it's so easy to test
<andrewrk> I'm not really worried about code quality there
<andrewrk> AlexMax, my best answer would be: a fork of LLVM adding a backend for the chip, and a fork of zig adding the arch
<andrewrk> proprietary compiler means they aren't sharing their work; the work must be duplicated - those forks are the least amount of work to get there
<andrewrk> zig's MIT license would increase the chances that they also provided a proprietary zig compiler for the chip
<scientes> or for now, an unmaintained one
<andrewrk> as much as I would prefer things to be open source, that is allowed
<gamester> Is this intended? https://pastebin.com/FWzEQBp4
<andrewrk> gamester, yes, you can override the integer tag type of the enum like this: enum(u16)
<andrewrk> (or any integer type)
<andrewrk> that should be a compile error hint
<andrewrk> if you have time I would appreciate an issue for adding that hint
<andrewrk> alright closing IRC for a bit to get more tests passing
mattisme has joined #zig
<gamester> done
kristoff_it has joined #zig
<emekankurumeh[m]> fengb: I think there was a rust program that did something similar. they would compile c to wasm then turn the wasm to rust
wootehfoot has joined #zig
Ichorio has joined #zig
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
Marumoto has joined #zig
Marumoto has quit [Client Quit]
cameris has joined #zig
Marumoto has joined #zig
kristoff_it has quit [Remote host closed the connection]
samtebbs has joined #zig
jjido has joined #zig
daex has quit [Ping timeout: 248 seconds]
samtebbs has quit [Quit: Lost terminal]
<tralamazza> yes it blinks
<tralamazza> sorry too happy
jevinskie has joined #zig
FireFox317 has joined #zig
<FireFox317> tralamazza: Yeahh nice man! The bluepill?
<tralamazza> yup
<tralamazza> i will update the repo
<tralamazza> lld works fine too so far
<tralamazza> pure zig
<FireFox317> Could you share a link to the repo? I'm curious how you did the startup code in zig
<tralamazza> FireFox317: do you have a blue pill to test?
<ki9a> andrewrk: well aware of the advantages of llvm. I have a commercial compiler using it too. Just feel i spend more time fighting llvm issues, speed and updates than actual work these days
<FireFox317> Nope, I have a nucleo stm32f4 board, but I can try to test it on there
<tralamazza> FireFox317: you might have to change the clock init
<FireFox317> tralamazza: Looks nice!
<tralamazza> ty
<scientes> andrewrk daurnimator https://lwn.net/SubscriberLink/791393/e16d74a8fda9107d/ C, Fortran, and single-character strings
<daurnimator> scientes: heh yeah I saw the gcc bug when it was first filed
Akuli has quit [Quit: Leaving]
marmotini_ has quit [Remote host closed the connection]
<marijnfs> how do i add a include dir for c-code?
ross_k has joined #zig
<tralamazza> is there a way to place a variable at a specific memory address?
<tralamazza> (besides linker section trickery)
<ross_k> Hi, I asked the other day about getting my project building on zig 0.4.0. I'm a bit further after downloading the latest master, but getting stuck at this error:
<FireFox317> tralamazza: I don
<ross_k> here's my build.zig: https://pastebin.com/kZ1ycAm4
<FireFox317> I don't think there is, there is an open issue for that, but I couldn't find it that quickly
<ross_k> Tried with and without the line: exe.linkSystemLibrary("c");
<fengb> ross_k: can you do `zig targets` and see what zig thinks your native is?
<ross_k> x86_64 is native... but I think the issue is that it's trying to use the libc that ships with zig (musl) which is linux only
<emekankurumeh[m]> what is the ABI?
FireFox317 has quit [Ping timeout: 256 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ross_k> ABI in my build.zig is msvc
<ross_k> and also in zig targets
<ross_k> (as the native one)
<emekankurumeh[m]> can you try it without explicitly setting the target?
<ross_k> Sure
<ross_k> okay, it gets past that error but now says it can't find windows.h in one of my C imports: https://pastebin.com/fujCSaDj
<ross_k> I didn't need to specify the include path in zig 0.3.0 so wouldn't think that's different now?
<ross_k> (maybe just a side effect of not setting the target)
<marijnfs> how do you normally integrate tests. I have a test part in my source, but I need to rely on paths being set by my build.zig
<marijnfs> and it seems 'zig test' only works if you put the src file directly, which is then missing include dirs
<emekankurumeh[m]> can you run 'zig libc' and show what your libc file looks like?
<ross_k> emekankurumeh: https://pastebin.com/CagXUtju
<ross_k> this matches the file zig-cache\native_libc.txt
<emekankurumeh[m]> is windows.h actually there then?
<mikdusan1> marijnfs: have you tried b.addTest
fengb has quit [Ping timeout: 256 seconds]
<ross_k> emekankurumeh[m]: windows.h isn't there, it's part of the windows SDK
<ross_k> which is installed on my system
<ross_k> (and zig 0.3.0 can find it)
halosghost has quit [Quit: WeeChat 2.5]
Ichorio has quit [Ping timeout: 250 seconds]
<marijnfs> mikdusan1: cool let me try, though i add a includedir to the exe, so not sure how the builder knows it
wootehfoot has quit [Read error: Connection reset by peer]
<marijnfs> another issue, I include a c header, and it uses an enum to define some constants and reused the same number
<marijnfs> and then the cImport file created by zig gives problems, because zig doesn't like reused numbers
<mikdusan1> i think open issue https://github.com/ziglang/zig/issues/2115
samtebbs has joined #zig
ross_k has quit [Quit: Page closed]
<marijnfs> mikdusan1: thanks test thing worked
<marijnfs> mikdusan1: yeah i'll hack the header for now
ross_k has joined #zig
<ross_k> submitted a github issue with the details of the libc thing: https://github.com/ziglang/zig/issues/2720
<ross_k> thanks for the help, hopefully I'll get it sorted out soon
ross_k has quit [Quit: Page closed]
<andrewrk> all behavior tests passing in result location branch. still more regressions to fix though
<mikdusan1> still zig0 only right?
<andrewrk> I'll do a stream tomorrow
<andrewrk> yeah, stage2 additions still have a regression to fix. looking into that next
<andrewrk> well first I'm going to get some food
<andrewrk> it's good to do the behavior tests first because all the regressions after that become additional behavior tests
ltriant has joined #zig
samtebbs has quit [Quit: leaving]
<scientes> yes
Tetralux has quit [Ping timeout: 244 seconds]
samtebbs has joined #zig
<andrewrk> scientes, I'll make sure your mulAdd PR gets merged before this, don't worry
Tetralux has joined #zig
jevinskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jevinskie has joined #zig
<samtebbs> Say I have a variable assigned to @typeOf(root.main).ReturnType which I know has a @typeId() of builtin.TypeId.ErrorUnion
<samtebbs> How would I extract T from that, if the return type is !T ?
<samtebbs> The issue for reference: #2721
<mikdusan1> @typeInfo(that).ErrorUnion.payload
<mikdusan1> hmm .ReturnType.Paylod also works?
<samtebbs> mikdusan1: Thanks!
<samtebbs> mikdusan1: That works too
marijnfs has quit [Quit: WeeChat 2.4]
samtebbs has quit [Quit: Lost terminal]