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/
<HollMax> inline for over declarations in SDL might be too much
<fengb> @compileLog for printing but it’ll stop compilation
<HollMax> yeah, that won't cut it.
<fengb> I think general IO is out of scope for comptime
<ikskuh> i kinda wonder when the first will try to implement ctre in Zig
<ikskuh> (compile time regular expressions)
<HollMax> are there any issues I'm missing? I'd assume this to be trivial in Zig (in comparison to most other languages)
<ikskuh> it will probably just take way too long to compile
<oats> I haven't looked closely at zig compiler internals at all. How does comptime stuff work? Is there a subset of the language that can be interpreted or something?
<daurnimator> ikskuh: I've been wanting to do a PEG in zig that works at compile time
<ikskuh> a PEG? crazy :D
<daurnimator> ikskuh: though I've also said in here before: re2 probably makes sense
<ikskuh> oats: there's zig IR which can be executed i think. it's not a subset, it's the full language feature set except for syscalls
<daurnimator> fengb: I saw that post and started wondering how we should do i18n in zig: should we be supporting fluent?
<ikskuh> daurnimator, what's "fluent"?
<daurnimator> ikskuh: https://projectfluent.org/
<ikskuh> looks cool
<ikskuh> and complex
<daurnimator> ikskuh: so, what are you doing today? :)
<ikskuh> heh
<ikskuh> today=10.04 2:26 am
<ikskuh> i'm going to bed soon :D
<ikskuh> otherwise: https://revision-party.net/
<ikskuh> virtual demopartying until monday
<ikskuh> oh and coding on dunstblick (UI framework)
xackus has quit [Quit: Leaving]
<ikskuh> i feel a bit bad that my current parser is LL(1) for the ui layout definition
<ikskuh> because i need that look-ahead only in a single place
xackus has joined #zig
xackus has quit [Client Quit]
xackus has joined #zig
<ikskuh> removing 2800 loc (well, including a flex parser) and replacing it with 1k LOC zig, including a handcoded parser
<BaroqueLarouche> ikskuh: wow
<ikskuh> this is an awesome step
<ikskuh> compilation time down again
<ikskuh> the new parser infrastructure and zigs error handling allow a much better in-place error handling than try-catch blocks
<ikskuh> also i got a new feature planned, but not-yet implemented
ur5us has quit [Ping timeout: 260 seconds]
<ikskuh> if i find an invalid identifier, i can now just scan for the next ; or } and be happy, because i know that i can continue parsing the file and emit more errors in one go
<ikskuh> and now: good night
<fengb> Good night!
<HollMax> since `zig c++` is a thing, how about including and calling C++ from zig?
<fengb> I might take some inspiration from this code
<HollMax> @ikskuh good nigh
<ikskuh> HollMax: i've explained it on the Discord just a moment ago
<ikskuh> sticking to C ABI is the sane option
<ikskuh> Calling "actual" c++ from zig would mean that zig needs the whole feature set of c++ with templates and everything
<fengb> Zig doesn’t know how to call C++ but both understand C. So create a wrapper function with extern “C”
<ikskuh> sticking to C abi means that you can call C++ code (I'm doing that a lot by now) but you are bound to the C type system
<ikskuh> also you're more flexibel with a C interface anyways, as you can also trivially attach C#, Nim, Python
<ikskuh> and many other languages that support C bindings (luajit has a nice FFI afaik)
<HollMax> I suppose I could do anything I could reasonably want once 383 gets in
HollMax has quit [Remote host closed the connection]
ur5us has joined #zig
<andrewrk> there's a good chance 383 will not be accepted
ur5us has quit [Quit: Leaving]
<Xavi92> I'd like to experiment with zig by using it on a PS1 (used mipsel-unknown-elf-gcc in the past). I have a couple of questions though
<andrewrk> PS1 is mipsel?? TIL
<daurnimator> andrewrk: another reason for 383 came up the other day: creating an enum from a list of struct fields
<Xavi92> It is a freestanding environment, so does .bss need to be cleared before main in zig?
<daurnimator> Xavi92: quite possibly
<companion_cube> ok, controversial idea: why not use npm's package.json for describing zig's modules? gives a lot of tooling for free
<companion_cube> (including github's tracking of dependencies)
<andrewrk> Xavi92, the operating system (in this case PS1) will call into some start function that you export from your zig code. You will want to clear the bss here before doing anything else. Example: https://github.com/andrewrk/clashos/blob/8ca226eb088d2a29f9a4875fd1245abb9842940b/src/main.zig#L114-L115
<daurnimator> Xavi92: https://github.com/im-tomu/fomu-workshop/blob/master/riscv-zig-blink/src/fomu/start.zig#L16 <== here is an example where I got freestanding working
<andrewrk> both examples probably have the same linker script trick
<daurnimator> andrewrk: I found I couldn't use @memset.... internally it generated something that put a constant in bss!
<Xavi92> Oh, just remember LLVM didn't support MIPS I: https://github.com/simias/psx-sdk-rs/issues/1
<Xavi92> But it looks like this has been patched recently
<pmwhite> Is there a way to wrap with zig fmt when there are a lot of expressions joined by boolean and.
<andrewrk> you can line break after binary operators
<Xavi92> andrewrk, daurnimator: thanks for the examples, good to know it's done the same way as in C
<andrewrk> daurnimator, hmm yeah I mean zig's codegen assumes bss is initialized, so it might be important to formalize why this is defined behavior or not in the lang spec
<andrewrk> e.g. maybe we can define @memset to not depend on .bss for the freestanding target or something like that
<daurnimator> andrewrk: but if it can be faster by using bss.... I wouldn't want to stop it
<daurnimator> andrewrk: it just means you have to use inline assembly in your _start
<andrewrk> yeah
<daurnimator> though one thing I wasn't sure about was if I need to use `asm volatile` or not
<daurnimator> e.g. would zig/llvm optimise it to something that uses BSS again?
<Xavi92> BTW, can't 'extern' be used inside a function? I see __bss_start and __bss_end being declared at file scope, but I'd like to move these definitions if only accessed from one function
<Xavi92> So these definitions are only visible inside that function
<andrewrk> `volatile` for asm means it has side effects, which clearing bss certainly does
<andrewrk> without that zig can delete the asm volatile if you don't use the result
<daurnimator> andrewrk: I thought `volatile` indicated that the compiler is not allowed to optimize the contents?
<andrewrk> Xavi92, you can do that by declaring a struct inside a function and using that namespace
<Xavi92> daurnimator: for inline assembly it could mean the compiler can remove code or reorganize it, IIRC
<andrewrk> we currently have the same definition as llvm: http://llvm.org/docs/LangRef.html#inline-assembler-expressions
<andrewrk> (here it is called "sideeffect")
<daurnimator> I'm happy for the optimiser to move it around...
<daurnimator> The side effects I should capture by adding a memory clobber I guess?
<andrewrk> you don't want the optimizer to move around your bss clear
<daurnimator> andrewrk: I don't mind if it e.g. does the rodata copy first
<Xavi92> andrewrk: I didn't get the point completely (sorry, discovered zig a couple of hours ago). Do you mean creating a struct (e.g.: Bss) with two u8 values and then a Bss instance with its values assigned to __bss_start and __bss_end?
knebulae has quit [Read error: Connection reset by peer]
xackus has quit [Ping timeout: 265 seconds]
<andrewrk> Xavi92, in zig, all files are structs, and declarations inside structs are namespaced globals. exported or external declarations are not namespaced, however
<andrewrk> const S = struct { extern var __bss_start: u8; extern var __bss_end: u8; };
<andrewrk> you can now reference them with e.g. `&S.__bss_start`
nephele has quit [Ping timeout: 260 seconds]
nephele_ has joined #zig
<Xavi92> andrewrk: whoa. It'll take me some time to process that
darithorn has joined #zig
<andrewrk> you can see some similar example code in the implementation of std.Thread.spawn
<Xavi92> andrewrk: so something similar to this? https://godbolt.org/z/8JOa99
<daurnimator> andrewrk: how goes release notes?
<daurnimator> andrewrk: also... we should organise a (online) celebration for the release :)
<andrewrk> stressful, especially with the recent developments of #4799
<andrewrk> I completely agree
<andrewrk> online release party
<fengb> Virtual beers for all?
<daurnimator> Real beers please
<companion_cube> real beer it is
xackus has joined #zig
<Xavi92> Is there any reason why https://godbolt.org/z/8JOa99 compiles to a call to zig_panic?
<andrewrk> don't forget to export _start
<andrewrk> you probably also want --release-fast
<daurnimator> Xavi92: also make sure you use trunk not 0.4.0
<andrewrk> also might want `callconv(.Naked)`
<Xavi92> daurnimator: oh, hadn't realize it was using 0.4.0. Thanks for the tip! That made it work
<daurnimator> Xavi92: also consider @ptrCast instead of @as there
<andrewrk> why's that?
<daurnimator> `*volatile [1]u8` isn't exactly correct now is it.
<andrewrk> @as([*]volatile u8, &S.__bss_start) should work
<daurnimator> `@ptrCast([*]u8, &S.__bss_start)` would be more correct IMO
<andrewrk> the volatile is needed, the store has a side effect
<daurnimator> andrewrk: i don't think you can use @as to get from a *u8 to a [*]u8?
<andrewrk> also it only guarantees not reordering according to other volatile operations, so you need a @fence(.Acquire) after it
<andrewrk> ah yeah in that case @ptrCast is fine. but be careful telling people to use @ptrCast over @as, because it's the other way around. The thing to change here was the dest type (and needing to use @ptrCast is a consequence, not the goal)
<Xavi92> I read the differences between @as and @ptrCast, but I'm still not sure why I should choose one over the other. Is @as safer?
<andrewrk> yes
<andrewrk> the flow chart is: always use @as (or other forms of automatic type coercion which are equivalent)
<andrewrk> if you can't, because of a compile error, then consider other options
<andrewrk> "Type coercions are only allowed when it is completely unambiguous how to get from one type to another, and the transformation is guaranteed to be safe."
xackus has quit [Read error: Connection reset by peer]
xackus has joined #zig
<Xavi92> andrewrk: why is the [1] needed on @as(*volatile [1]u8, &S.__bss_start), though? Isn't &S.__bss_Start returning a pointer to 1 element, for which '*volatile u8' would suffice?
<andrewrk> it's harmless now but @memset should probably be improved to emit a compile error for this, since you're asking to copy > 1 byte, but giving it a pointer that supposedly points at 1 byte
<Xavi92> andrewrk: so how could you cast from __bss_start to [*]T? From what I can read, &x returns a single-item pointer
<andrewrk> this is one of those occasions where you have more information than the compiler
<andrewrk> it's not really a one item pointer, is it? it's really a byte that is conveniently aliased to the start of bss
<Xavi92> Exactly
<andrewrk> right, so when you have more information than the compiler, is when @ptrCast or other less-safe-than-@as casts are relevant
<Xavi92> Byte or even word. The underlying type does not really mater, as it is never accessed directly
<Xavi92> Alright
<daurnimator> Xavi92: I mentioned that above: > `@ptrCast([*]u8, &S.__bss_start)` would be more correct IMO
<Xavi92> daurnimator: what about @ptrCast([*] volatile u8, &S.__bss_start) ?
<daurnimator> Xavi92: that would work too. Though I'm not sure why andrewrk is saying it needs the volatile....
<Xavi92> Sounds more correct to me - as andrewrk said, it has side effects the compiler should be aware of
<daurnimator> andrewrk: it's not MMIO: why would it need volatile?
<Xavi92> daurnimator: I think it's because you're modifying a whole range of items and the compiler could not be aware of that
knebulae has joined #zig
<Xavi92> Or probably it ensures @memset is not assuming any value from __bss_start to __bss_end, don't know
<daurnimator> Xavi92: `volatile` means that reads/writes to the memory have actual side effects e.g. due to MMIO; or because you're debugging with an oscilloscope and want to see an exact values written to exact locations
<Xavi92> Yup, those are the cases I'm also aware of when writing software in C for embedded devices
<Xavi92> Probably 'volatile' isn't needed in @memset
<andrewrk> ^ @memset can get deleted if zig can prove the memory is never read
<andrewrk> I suppose with writing to bss, such a proof would necessarily be invalid
<andrewrk> so I think daurnimator is correct
<Xavi92> Right, container 'std.os' has no member called 'fd_t' on mipsel-freestanding, for obvious reasons. Is there any way I can provide it, though?
<andrewrk> Xavi92, ah, yes, welcome to the experimental bring-your-own-OS-layer feature
<daurnimator> Xavi92: welcome to the world of "BYO os"
daex has quit [Ping timeout: 256 seconds]
daex has joined #zig
<daurnimator> Xavi92: note that that error message means that whatever you did expects an `fd_t` to exist: what operation are you attempting?
<Xavi92> Just experimenting so far. The micro kernel (aka BIOS or the epic boot screen) on the PS1 provides a working implementation of printf, so I was thinking of ways to use it from zig
<andrewrk> the null hypothesis is to just call that stuff explicitly and not try to integrate with zig's std lib OS layer
<Xavi92> The error obviously popped up when I attempted to use stdout.print(), just to see how the compiler would complain at the lack of such definition
<andrewrk> you can use the rest of zig's std lib without the OS layer. whatever you don't call doesn't get compiled in. so the data structures for example are all fair game
<Xavi92> Sure, but getting stdout.print() features would be a great addition
<Xavi92> Not that I'm going to implement that now, I'm just feeling curious
<andrewrk> the vision for this is that you would be able to make a "ps1" OS package and people would be able to depend on the package, and then put `pub const os = @import("ps1");` next to main() and it would make printing work and do the bss before main and stuff
<Xavi92> Sounds great
<daurnimator> Xavi92: you should will be able to create an `OutStream` that uses the BIOS' printf
<Xavi92> Alright
<daurnimator> Xavi92: you will function that writes bytes using your bios primitive; then do something like: `io.OutStream(File, PossibleWriteErrors, mywritefunction){}`
<daurnimator> uh, s/File/void/
v64 has joined #zig
<Xavi92> BTW, is it possible to define custom types for integer data types, like in C's typedef?
<Xavi92> Not that I like typedef, but sometimes uart_data_bits (contrived example) is more meaningful than u8
<Xavi92> Probably the correct term would be 'alias'
<fengb> You can make an alias with const foo = u8;
<Xavi92> fengb: great, thanks!
<fengb> Won’t be distinct though, unlike Go
<shakesoda> to get distinct you need a one field struct, right?
<Xavi92> I still don't really get the 'const' for type definitions. Are they supposed to allocate any memory?
<shakesoda> you can use types more or less the same way you use anything else.
<shakesoda> until 1717 is done, the only thing this isn't true of is functions really
<Xavi92> I mean, why not simply 'foo = u8' or 'alias foo = u8'? Similarly for 'const Point = struct {x: u8, y: u8};'
<shakesoda> that's just adding inconsistencies
<shakesoda> everything being the same is a feature
<fengb> const and var (and fn for now) are the only ways to declare an identifier
<Xavi92> Coming from a C background 'const' reads as read-only variable, not type definition. Of course, zig does not have to follow that convention
<fengb> const in zig just means it’s constant. It doesn’t actually mean stack. Some consts get shoved into the data section
<Xavi92> I see
<fengb> Others are comptime, which only exists to the compiler
<Xavi92> You could never define a struct as var, though, if only the type is being defined
<fengb> Types are comptime, as are literal numbers (unless they’re coerced into a runtime value)
<Xavi92> For example, 'var Point = struct {x: u8, y: u8};'
<fengb> Yeah I don’t think that’s allowed
<Xavi92> Alright thanks!
<shakesoda> clearly we need types that you can screw with at any arbitrary time, so you can write zig as if it had lua tables ;)
<shakesoda> disclaimer: i have utterly no idea how you'd make that sane, but i really do love lua tables
<daurnimator> Xavi92: you can at comptime
<Xavi92> daurnimator: something like 'var Point = struct {x: u8, y: u8};' you mean?
<daurnimator> Xavi92: `comptime var Point = struct {x: u8, y: u8};`
<daurnimator> and from there you could e.g. use an `inline for` loop to wrap it to some arbitrary comptime depth
<Xavi92> That's great
<Xavi92> Anyway, bed time guys
<Xavi92> Thanks a lot for your help! zig definitely is a very interesting project
<daurnimator> e.g. https://godbolt.org/z/5fscPE would be a legal way to write zig's mem.Span function
<daurnimator> (the actual one just `return`s directly; but if it was nicer to write it with a `var` `type` then we would be able to do so
<daurnimator> )
<Xavi92> zig's type introspection capabilities look really interesting
<daurnimator> Xavi92: types are just another... type of variable
<Xavi92> I see
<Xavi92> How does the compiler solve this? Using UUIDs for each type?
<daurnimator> Xavi92: what do you mean?
waleee-cl has quit [Quit: Connection closed for inactivity]
<daurnimator> Xavi92: some types (e.g. `type`, `comptime_int`, `comptime_float`) only exist at comptime
<Xavi92> Oh sorry, missed the comptime requirement
<Xavi92> Thanks for the clarification
xackus has quit [Read error: Connection reset by peer]
xackus has joined #zig
<Xavi92> See ya!
Xavi92 has quit [Remote host closed the connection]
<daurnimator> andrewrk: : CommandLine Error: Option 'mc-relax-all' registered more than once! LLVM ERROR: inconsistency in registered CommandLine options
<daurnimator> ^ trying to compile master locally..... (let me try and re-run cmake)
darithorn has quit [Quit: Leaving]
<andrewrk> this generally means a static library got compiled in twice
<andrewrk> e.g. 2 different dynamic libraries
<andrewrk> what os?
<daurnimator> linux x86_64
<daurnimator> trying to run cmake again it keeps finding my system llvm instead of the one I'm passing to CMAKE_PREFIX_PATH
<andrewrk> the only thing that changed in aaf99371b is it looks for -lclang-cpp before other stuff
<andrewrk> ugh, llvm's configuration is out of control, it does not have to be this complicated
<daurnimator> cmake is a bad build system
joey152 has quit [Ping timeout: 256 seconds]
<andrewrk> you can pass -DZIG_STATIC_LLVM=ON to skip trying -lclang-cpp
<daurnimator> `-DCMAKE_PREFIX_PATH=../../llvm-project/prefix` is what I'm meant to be passing right?
<daurnimator> where ../../llvm-project/prefix contains: bin include lib libexec share
<andrewrk> yes
<andrewrk> but I guess cmake is looking first there for -lclang-cpp and then to system default locations and finding it
<andrewrk> basically the "if we did not find -lclang-cpp" logic is a false negative
<andrewrk> this is actually not possible to fix. llvm has made it impossible to fix this
<daurnimator> luckily that wasn't it.
<daurnimator> problem was you have to add it to your path too: `PATH=~/src/llvm-project/prefix/bin:$PATH cmake -DCMAKE_PREFIX_PATH=~/src/llvm-project/prefix ..` worked
<andrewrk> that doesn't make any sense
<daurnimator> otherwise it runs system llvm-config
<andrewrk> I believe you but it's annoying that it works that way
<daurnimator> okay. still fails with `: CommandLine Error: Option 'mc-relax-all' registered more than once! LLVM ERROR: inconsistency in registered CommandLine options`
<andrewrk> I have half a mind to require the bootstrap repository for building zig from source just so we can side-step all the many incompatible ways llvm is packaged and configured
<daurnimator> that will not fly for distro packaging
<andrewrk> did you try -DZIG_STATIC_LLVM=ON yet
<daurnimator> right now I'm reverting to previous HEAD and checking it was this commit that broke it
<daurnimator> yep it was
<daurnimator> -DZIG_STATIC_LLVM=ON has same error
<andrewrk> it would help for me to see the linker line for all 3 of those cases
<andrewrk> should be able to do just `make VERBOSE=1`
<daurnimator> `cd /home/daurnimator/src/zig && /home/daurnimator/src/zig/build/zig0 build-lib src-self-hosted/stage2.zig -target native -mcpu=baseline --name zigstage2 --override-lib-dir /home/daurnimator/src/zig/lib --cache on --output-dir /home/daurnimator/src/zig/build --bundle-compiler-rt -fPIC -lc`
<andrewrk> oh, zig0 built successfully?
<daurnimator> apparently.
<andrewrk> ah, zig0 built successfully but incorrectly, I believe. `rm zig0` and show that linker line
<andrewrk> it's long
_Vi has joined #zig
<andrewrk> ok this is nuts
<andrewrk> -lclang-cpp includes *some* llvm static libs that we need, but not all of them
<andrewrk> if we don't include llvm static libs, we get the LLVM ERROR: inconsistency in registered CommandLine options
<andrewrk> if we don't include them, we get undefined symbol linker errors
<andrewrk> ok, reverting the commit. this is making me crazy
<daurnimator> back to #4992 ?
<andrewrk> 4992 can't work either, everything is fucked
<andrewrk> I'm just going to put in a cmake option that homebrew users will have to use
<andrewrk> btw c++ static initializers are also to blame for this
<wilsonk> wow, has anyone else built llvm/clang-10.0.0 with LTO+PGO optimizations? It took me hours on a 64 core machine so it isn't for the faint of heart, but it improved build times of llvm/clang-10.0.0 from 9:34 to 7:14 mins...buuuuuttt then building zig0 ends up in an infinite loop!?!??! WTH!! UGH
<wilsonk> so I can't even use it for zig now after all that build time...darnit!
<andrewrk> daurnimator, reverted
<daurnimator> andrewrk: thanks. can build now
<daurnimator> andrewrk: 7 issues left in the milestone; how you feeling?
<mikdusan> andrewrk: is it ok for me to create a "qemu-static" repo w/ docker, patches, script, sources?
<daurnimator> mikdusan: hmm? what does it do exactly?
<mikdusan> it's an alpine docker to build qemu-static for linux. I already do it from alpine vm, but decided to try this dang fangled docker thing :)
<daurnimator> mikdusan: who would use it?
<mikdusan> every linux build uses qemu for various target tests
<mikdusan> every *CI* build
<daurnimator> mikdusan: e.g. on arch I use install qemu-arch-extra and it has everything in it
<mikdusan> what version of qemu
<mikdusan> 4.2 is too old
<andrewrk> mikdusan, yep go for it
<daurnimator> mikdusan: that appears to be the latest upstream release
<daurnimator> mikdusan: https://download.qemu.org/ has a couple of 5.0 rcs; but 4.2 is the latest release...
<andrewrk> mikdusan, you can probably use ziglang/docker-zig as a template
<mikdusan> andrewrk: it's pretty much done. just prepping for upload
<andrewrk> nice
<daurnimator> mikdusan: as soon as 5.0 actually gets a release arch would package it
<andrewrk> daurnimator, the point is so the CI gets a newer qemu, so we can run the SIMD tests with it
<andrewrk> because older qemu was crashing
<mikdusan> and CI doesn't run archlinux?
<andrewrk> it's ubuntu yeah
<daurnimator> I guess I just don't see the point over e.g. a dockerfile that just does `FROM archlinux` `RUN pacman -Syu qemu-arch-extra`
<andrewrk> I don't understand what that would accomplish
<andrewrk> we already have it working now without docker
<andrewrk> and in fact it works in any linux distro, so we're not tied to ubuntu or arch
<daurnimator> but what mikdusan is proposing is to use an alpine base...
<mikdusan> alpine (static musl) is what makes it work everywhere
<daurnimator> mikdusan: can you compile it with `zig cc`? :)
<andrewrk> daurnimator, do you understand that we're downloading a binary tarball with every ci run?
<andrewrk> whew. finished going through commit logs. now I just have to flesh out all 91 sections of the page
<andrewrk> if I put in 36 hours before monday that leaves me with ~23 minutes to spend per section
<daurnimator> andrewrk: most CI systems (I suspect all that we use) support a "cache" directive where you can tell it to cache binary artifacts between runs. it's useful for large dependencies etc.
cole-h has quit [Ping timeout: 264 seconds]
Nilium has quit [Ping timeout: 256 seconds]
hspak has quit [Quit: ZNC - https://znc.in]
hspak has joined #zig
Nilium has joined #zig
_Vi has quit [Ping timeout: 265 seconds]
ur5us has joined #zig
nephele_ is now known as nephele
dermetfan has joined #zig
halbeno has quit [Remote host closed the connection]
halbeno has joined #zig
daex has quit [Ping timeout: 265 seconds]
daex has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
FireFox317 has joined #zig
ur5us has joined #zig
marijnfs has joined #zig
<marijnfs> how is the next release coming along?
<ikskuh> 7 open issues left
ifreund has joined #zig
<marijnfs> wow
<marijnfs> single digits, not bad
<marijnfs> hmm actually the new cmake has issues for me
<mikdusan> I believe the cmake stuff was rolled back very recently
<marijnfs> ah ok, yeah now i clear the whole build directory it configures again
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 260 seconds]
daurnimator has quit [Ping timeout: 246 seconds]
daex has quit [Ping timeout: 264 seconds]
daex has joined #zig
v64 has quit [Remote host closed the connection]
daurnimator has joined #zig
_Vi has joined #zig
dddddd has joined #zig
marijnfs has joined #zig
<daurnimator> oh cool, `std.PackedIntArray(bool, 256);` works
<daurnimator> maybe it should get a rename :)
<ifreund> just PackedArray?
marijnfs_ has quit [Ping timeout: 256 seconds]
<mikdusan> (f32,) works to get a type but I haven't tried any code coverage
Xavi92 has joined #zig
<Xavi92> Hi there :)
<ifreund> yo
<Xavi92> $ zig build-exe main.zig -target mipsel-freestanding -ffunction-sections -mcpu mips1
<Xavi92> :(
<Xavi92> LLVM ERROR: Code generation for MIPS-I is not implemented
marijnfs_ has joined #zig
daex has quit [Ping timeout: 256 seconds]
marijnfs has quit [Ping timeout: 240 seconds]
daex has joined #zig
marijnfs_ has quit [Quit: leaving]
decentpenguin has joined #zig
<FireFox317> that's sad Xavi92 :(
squeek502 has quit [Ping timeout: 256 seconds]
<decentpenguin> This may be a dumb way to do things, but is there a way to store a variable's type in runtime? I'm writing this (https://gitlab.com/snippets/1964721) but I can't figure out a way to make query() behave like queryAs() since I can't see how to store the type in EntityIndex
<fengb> Types can’t exist at runtime. You’ll have to invent some enum to manually map them
<decentpenguin> I see. Thanks.
gpanders has quit [Ping timeout: 250 seconds]
gpanders has joined #zig
daex_ has joined #zig
daex has quit [Ping timeout: 264 seconds]
AndroidKitKat has quit [Quit: バイバイ〜!]
AndroidKitKat has joined #zig
daex has joined #zig
daex_ has quit [Ping timeout: 260 seconds]
Yardanico has quit [Killed (Sigyn (Spam is off topic on freenode.))]
RagingDave has joined #zig
RagingDave has quit [Client Quit]
RagingDave has joined #zig
Xavi92 has quit [Remote host closed the connection]
Yardanico has joined #zig
gpanders has quit [Ping timeout: 265 seconds]
gpanders has joined #zig
dimenus has joined #zig
<dimenus> how old is the zig compiler that godbolt uses?
<dimenus> trunk I mean
<Yardanico> dimenus: it tells if you press the little "i" on the bottom of the right window (the assembly viewer)
<Yardanico> 0.5.0+543031db3
<Yardanico> seems to be a pretty recent commit from 21 hours ago
<Yardanico> i'm surprised they update stuff that often
<fengb> I wouldn't be surprised they just pull the nightly build
<fengb> I missed a preposition in there >_>
<dimenus> thanks Yardanico
zfoo has quit [Remote host closed the connection]
<ikskuh> hm, i'm hitting ud2 again…
TheLemonMan has joined #zig
gazler__ has joined #zig
marijnfs has joined #zig
layneson has joined #zig
gazler_ has quit [Ping timeout: 246 seconds]
<dimenus> i was just curious because the godbolt example produces a lot more code than my local one, though I'm not sure what flags godbolt automatically passes
FireFox317 has quit [Ping timeout: 240 seconds]
afontain_ has quit [Ping timeout: 246 seconds]
afontain_ has joined #zig
<dimenus> the zig version of http://emulators.com/docs/nx06_inc64.c in release-fast is as fast as clang (and significantly faster than gcc)
cole-h has joined #zig
waleee-cl has joined #zig
mikdusan has quit [Quit: WeeChat 2.6]
<dimenus> also produces smaller binaries, neat
Xavi92 has joined #zig
RagingDave has quit [Quit: quit]
<fengb> I'd hope it's just as good as clang :P
<Xavi92> fengb: what exactly :)
<Xavi92> ?
Akuli has joined #zig
<fengb> Zig uses clang to compile C so it should be just as good as clang
CommunistWolf has quit [*.net *.split]
hryx has quit [*.net *.split]
D3zmodos has quit [*.net *.split]
BaroqueLarouche has quit [*.net *.split]
pmwhite has quit [*.net *.split]
ifreund[m] has quit [*.net *.split]
pltrz has quit [*.net *.split]
BitPuffin has quit [*.net *.split]
tdeo has quit [*.net *.split]
nia has quit [*.net *.split]
APic has quit [*.net *.split]
lqd has quit [*.net *.split]
torque has quit [*.net *.split]
CommunistWolf has joined #zig
lqd has joined #zig
torque has joined #zig
D3zmodos has joined #zig
BaroqueLarouche has joined #zig
pltrz has joined #zig
hryx has joined #zig
pmwhite has joined #zig
ifreund[m] has joined #zig
BitPuffin has joined #zig
APic has joined #zig
tdeo has joined #zig
nia has joined #zig
pltrz has quit [Max SendQ exceeded]
pltrz has joined #zig
pltrz has left #zig [#zig]
mikdusan has joined #zig
<Xavi92> Why does 'const d = dir {.fd = undefined}; const f = dir.makeDir(d, "test");' return error.NotDir?
<Xavi92> Sorry for the newbie question
dtz has quit [Ping timeout: 246 seconds]
jasom has quit [Ping timeout: 246 seconds]
dtz has joined #zig
jasom has joined #zig
<TheLemonMan> what's `dir` ?
<mikdusan> as `d` is already available, `d.makeDir("test");` is easier to understand. `d` is undefined
<mikdusan> correction: `d.fd` is undefined and the OS doesn't like bogus file descriptor
nycex- has joined #zig
<Xavi92> TheLemonMan, mikdusan: Sorry. 'const dir = std.fs.Dir;'
<TheLemonMan> you're passing a bogus Dir handler, you probably want something like std.fs.cwd().openDir
nycex has quit [Ping timeout: 240 seconds]
<dimenus> fengb: I'm referring to an actual implementation in zig not zig cc
<Xavi92> Thanks. So 'std.fs.Dir.makeDir(d, "test");' is equivalent to 'd.makeDir("test")', right?
<andrewrk> dimenus, ah, neat :)
<fengb> Oh okay, I'm being dense :P
reductum has joined #zig
wootehfoot has joined #zig
<Xavi92> Given a function that returns !void, how can I assign another local variable according to its result?
<Yardanico> Xavi92: but !void means that it returns nothing (but can raise an error), how can you compare on it?
<Xavi92> Contrived example: 'const f = std.fs.Dir.makeDir(d, "test"); const a = if (f) |dont_care| {3;} else {6;};'
<Xavi92> Yardanico: okay, then how could a different value assigned to 'a' if no error happened?
<ifreund> Xavi92: I think you're looking for the `catch` keyword
reductum has quit [Quit: WeeChat 2.8]
_Vi has quit [Ping timeout: 265 seconds]
nycex- has quit [Quit: Quit]
jamii has joined #zig
nycex has joined #zig
<jamii> Hi. How can I make an empty slice?
<jamii> I thought `.{}` would coerce but doesn't seem so
<nycex> The ziglang.org build.zig example for linking against a zig lib doesn't work anymore on https://ziglang.org/#Zig-is-also-a-C-compiler
<nycex> that's the error i get
<layneson> nycex: put a & before the [_] of the second argument: &[_][]const u8 ...
reductum has joined #zig
<nycex> yeah that works thanks
wootehfoot has quit [Ping timeout: 246 seconds]
<andrewrk> nycex, thanks, will update
<jamii> Looks like `&[_]t{}` does the trick.
decentpenguin has quit [Quit: decentpenguin]
<nycex> but i don't know if i'm doing anything wrong but the build.zig does now compile but the example itself doesn't work, I did it like in the example and get the following:
<nycex> Looks like `&[_]t{}` does the trick. e/bernhard/dev/zig/segfaulthandler/test.c:1:10: fatal error: 'mylib.h' file not found
<nycex> #include "mylib.h"
<nycex> ^~~~~~~~~~~~~
<nycex> 1 error generated.
<nycex> or rather here, my clipboard is weird: https://paste.rs/0ta
wootehfoot has joined #zig
moo has joined #zig
<nycex> ls
wootehfoot has quit [Ping timeout: 250 seconds]
metabulation has joined #zig
<ikskuh> hmm
<fengb> Let's introduce him to Zig errors :)
moo has quit [Ping timeout: 258 seconds]
<ikskuh> we definitly need a libc for freestanding *grin*
<ikskuh> wanted to port a project to embedded platform, but it's missing a libc :D
<companion_cube> fengb: "The existing language that comes closest to this ideal is Zig" ?
<fengb> Oh I didn’t read that thoroughly :P
<fengb> ‘Also, they don't treat "silent dropping" as a compile error’ But we do...
<ikskuh> hm
<ikskuh> there was an option to "ship" my own libc, right?
<torque> Based on his examples, I think he means in a catch context
<torque> which I wouldn't consider to be silently dropping but heck
metabulation has quit [Quit: Leaving]
<ikskuh> andrewrk, is there a way to ship my own libc for a certain build artifact?
wootehfoot has joined #zig
<ifreund> ikskuh: isn't that just linking against your custom libc instead of using linkLibC()?
<ikskuh> nah
<ikskuh> because you also need your includes
<ikskuh> i need something like arm-freestanding-newlib
<andrewrk> ikskuh, you can contribute more functions to the freestanding libc. we do have one
<andrewrk> not sure I understand the problem yet
<ikskuh> what target to i have to set to link against freestanding libc?
<ikskuh> e_arm.setTarget(try std.zig.CrossTarget.parse(.{
<ikskuh> .arch_os_abi = "arm-freestanding",
<ikskuh> .cpu_features = "cortex_m3",
<ikskuh> }));
<ikskuh> right now i set this as my target
<andrewrk> it should be automatic when you use build-exe
<andrewrk> if you're doing build-lib we could add the equivalent of --bundle-compiler-rt
<ikskuh> Zig is unable to provide a libc for the chosen target 'arm-freestanding-eabi'.
<andrewrk> ah, hmm
<andrewrk> I really need to focus on release notes, but this is a use case that zig, with some minor improvements, can handle in a nice way
<ikskuh> yeah, n problem if it works right now
<andrewrk> gonna close IRC for a bit
<ikskuh> would've been cool if there is a zero friction solution
<ikskuh> but: release > my code
<ikskuh> yeah, sounds reasonable :)
plumm has joined #zig
<plumm> andrewrk: wanted to let you know circleci has ssh access
<companion_cube> `error: C pointers cannot point opaque types` (on 0.5) is that normal? in a cImport?
jamii has quit [Remote host closed the connection]
<companion_cube> ah nvm
<companion_cube> (jsut realized also that arch has a zig nightly package)
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
_Vi has joined #zig
<Snektron> <fengb "https://obdurodon.silvrback.com/"> I don't think it makes sense that a non-annotated function returns an error
<Snektron> although in the end its pretty much the same
<Snektron> I suppose you run into the problem where you accidently mark a function as error-returning while it doesn't return an error in practise
<Snektron> More preferable than the reverse im sure, but you can add a simple compiler check to prevent that anyway
Akuli has quit [Quit: Leaving]
<companion_cube> undefined reference to fcntl64 -_-
dermetfan has quit [Ping timeout: 265 seconds]
dermetfan has joined #zig
dermetfan has quit [Ping timeout: 260 seconds]
plumm has quit [Quit: Lost terminal]
reductum has quit [Quit: WeeChat 2.8]
<Xavi92> Is '-target arm-freestanding-none-cortexm0-v6m' valid?
ifreund has quit [Ping timeout: 240 seconds]
<Xavi92> Right, '-target arm-freestanding-none -mcpu cortex_m0' worked, but a lot of invalid instuction errors appear
<Xavi92> $ zig build-exe main.zig -target avr-freestanding-none -mcpu atmega328p
<Xavi92> Unreachable at /deps/zig/src/link.cpp:1719 in getLDMOption. This is a bug in the Zig compiler.
<Xavi92> (Have tested an empty main also on AVR, but raises a compiler bug, apparently)
r4pr0n has joined #zig
dimenus|home has joined #zig
dimenus has quit [Read error: Connection reset by peer]
<r4pr0n> andrewrk: a few days ago you told me how to enable the zig segfault handler in c programs. i tried that. is it normal that there is no stacktrace but rather `Panicked during a panic. Aborting.` because it's no zig code but c code?
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 240 seconds]
xackus has quit [Ping timeout: 265 seconds]
wootehfoot has quit [Ping timeout: 256 seconds]
_Vi has quit [Ping timeout: 265 seconds]
r4pr0n has quit [Quit: r4pr0n]