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/
<daurnimator> translate-c can only translate C. not C++ :P
<fengb> I think ForLoveOfCats is saying that async await denotes concurrency dependencies. What would be the strategy for executing tasks in parallel?
<jaredmm> Right, but running zig build with a cImport including winuser.h popped that bad boy out.
<jaredmm> The C definition in winuser.h would be
<fengb> Will Zig provide a thread pool, mutex locking, etc
<jaredmm> `typedef struct tagMOUSEHOOKSTRUCTEX { MOUSEHOOKSTRUCT DUMMYSTRUCTNAME; DWORD mouseData; } MOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX;`
<ForLoveOfCats> After re-reading the docs on async/await my confusion still stands. In the docs async/await is framed as a way to call coroutines but not to perform chunks of work in parallel. However the factorial Zig vs Go repo presents it as a solution to build parallel logic. I have a chunk of work I know I can execute in parallel, async/await does not seem to be an approach specifically to that yet the demonstration frames it as a way to
<ForLoveOfCats> achieve parallelism.
<daurnimator> so its really a missing error
<andrewrk> fengb, I can make a simple example of executing 2 async functions in parallel
<andrewrk> ForLoveOfCats, do you want an example of parallelism with or without the event loop?
<ForLoveOfCats> I don't want to take up much more time, can you just tell me which zig implimentation in the Zig vs Go repo demonstrates parallelism in a Zig-y way?
<jaredmm> It shouldn't be trying to run the C++ code in the header, though. `#ifdef __cplusplus`
FireFox317 has joined #zig
<fengb> Oh I’m more curious about the patterns going forward
<ForLoveOfCats> Hmmm mayhaps it has something to do with `std.event.Loop.startCpuBoundOperation();`
<ForLoveOfCats> I had seen that file but overlooked the event.Loop start line
<ForLoveOfCats> I'd seen that namespace in the std docs but there is zero documentation on it
<ForLoveOfCats> it looked like something that would be used for, event based programming
<andrewrk> the other important line is line 5. it works if you take out line 5, but it becomes not parallel anymore
<ForLoveOfCats> Why should the IO mode affect how my application logic runs?
<ForLoveOfCats> That is another confusion point of mine
<pixelherodev> I think there should be a distinction between I/O mode and execution model
<pixelherodev> Should be possible to e.g. run a program in parallel with single-threaded I/O
<pixelherodev> ... ah wait, never mind that would be dumb
<pixelherodev> Sorry, I'm going to take a nap before participating in this discussion further :P
<FireFox317> andrewrk: how would you make the render.zig async compatible? it is using recurssion, so i have to allocate the frame i guess, however there are 200 callsites of `renderToken` so there has to be a lot of allocation for the frames...
<andrewrk> fengb, ForLoveOfCats: here's a simple example of executing 2 async functions in parallel, with the patterns going forward: https://clbin.com/nGlRY
<andrewrk> I added a couple more 0's to the numbers, and I can see 2 cpu cores spin up at the same time
quetzalb has joined #zig
<companion_cube> how does the loop know the cpuBoundOperation is done?
<fengb> Hmm... what will happen with too many cpu bound async functions?
<andrewrk> you waste time sending jobs to the thread pool when you were already in a thread that could have just done the next job
<quetzalb> Is there a why to create a struct at comptime by iteratively adding fields? For example, I'd like to have a function that takes a type and returns a type with the same fields but perhaps an additional field or methods.
<pixelherodev> Return a struct that `using namespace` the original maybe?
<andrewrk> fengb, generally: only put that function call in when the automatic parallelism due to I/O isn't properly maxing out your cpus
<fengb> I’m thinking what if there are 2 libraries that are being “smart” and ships off work = number of CPUs
<ForLoveOfCats> So if setting io_mode to evented makes async/await actually parallel (which doesn't really make sense from the name?) what does startCpuBoundOperation actually do? I gather that it marks that thread as cpu intensive but how does that affect the operation of the thread pool?
<andrewrk> did you look at the implementation? it's 5 lines
<andrewrk> fengb, generally, libraries should probably not call startCpuBoundOperation(), since an application can always call it before calling an expensive library function
ave_ has quit [Quit: Connection closed for inactivity]
<quetzalb> pixelherodev, thanks! I didn't find documentation on "using namespace" but I will try to dig around and see how it is supposed to work!
<ForLoveOfCats> I did not, I read the doc comment on the std docs which told me nothing (with my limited understanding of how everything works) and looking at the said 5 lines I still know little. Is it pausing all other threads? I feel like that is the wrong interpretation
<andrewrk> quetzalb, related issue: https://github.com/ziglang/zig/issues/383
<andrewrk> usingnamespace is discouraged for the same reason that issue is not "accepted" yet
<fengb> The docs are mostly nonexistent :P
<andrewrk> but hey, no judgement here if it solves your use case
<pixelherodev> What reason is that?
<andrewrk> ForLoveOfCats, I think your next step on the journey of understanding async/await in zig is to try to grok the code in std/event/loop.zig. if you have specific questions about any particular line of code I am happy to help. "layperson" documentation will be available at some future date but it's not available now
<jaredmm> It looks like __cplusplus is going to be defined by Clang. Is there a way to tell Clang "no CPP" and should that be turned on for translate-c?
<jaredmm> off*
<quetzalb> andrewrk, it looks like usingnamespace brings across const definitions but not fields perhaps. I tried this with no love: const Foo = struct {
<ForLoveOfCats> I have so many questions but the more I ask the less I feel I understand. Such as: Why does the magic const being set to enable all this insist that it is just for IO? In what way is general purpose parallelism evented? I do think that I need to grok the source but it sucks to have to read and understand all the source under std.event when I've already done all the work to make my codebase ready for parallelism and all I need at
<ForLoveOfCats> this point is to actually run the dang thing in parallel.
<andrewrk> quetzalb, that's correct - usingnamespace is for importing declarations into the current namespace
<ForLoveOfCats> I will stop asking questions at this point as I don't wish to take up any more of anyone's time at the moment. I'll have to set aside an afternoon later this week to sit down and read that source
FireFox317 has quit [Ping timeout: 265 seconds]
<pixelherodev> Can always go with the "don't bother understanding it beyond 'this is magic keyword that solves all problems' for now" option
<ForLoveOfCats> That's almost never the right solution lol
<andrewrk> jaredmm, did you perhaps give your C file a `.cpp` extension?
<ForLoveOfCats> I don't *want* to have to understand the implimentation, but it is in a "the documentation is the source" state right now so I'm going to have to
<quetzalb> Ok. A workaround I'm using for now is embedding the first struct in the second. Slightly awkward but works e.g. struct { foo: Foo, y: u8 }
<jaredmm> andrewrk, no, it is a .h file including Windows headers.
<fengb> I think it’s a little confusing to double up evented IO and parallel execution
<andrewrk> jaredmm, `zig translate-c empty.h` does not define __cplusplus
<andrewrk> ForLoveOfCats, you can have general purpose parallelism with async/await without zig std lib's evented I/O abstractions. my offer stands to give you an example of that
<pixelherodev> I'm interested in that!
<andrewrk> quetzalb, I am a fan of that strategy
<ForLoveOfCats> Wat? How?
<andrewrk> quetzalb, in my opinion the extra verbosity is worth the lack of head-scratching when reading someone else's (or your own in the future) code
<ForLoveOfCats> I am so dang confused at this point
<fengb> Everything in Zig is possible without stdlib
<ForLoveOfCats> Lol that's not what is being said
<andrewrk> yes it is
<ForLoveOfCats> andrewrk: Do you mean by building my own abstraction over async/await frames as the solution?
<andrewrk> let me just put this example together
<andrewrk> it's a good gist to have handy anyway
<ForLoveOfCats> Hmmmm, I was under the impression that you simply meant not using the event loop, not something that didn't rely on the std at all (which of course is possible :stuck_out_tongue:)
quetzalb has quit [Ping timeout: 260 seconds]
<andrewrk> ooh, I can replace `catch unreachable` with `catch resume`
<andrewrk> so if you are out of memory for a new thread, then it just continues executing in the same thread
<ForLoveOfCats> So you are starting an async function, immediately suspending, getting the frame, spawning a new thread with std.Thread.spawn, then resuming the frame from within the new thread
<ForLoveOfCats> and then sequetually waiting on each one
<ForLoveOfCats> that gets me almost nowhere further than I was before building my own abstration over std.Thread
<andrewrk> well this is an example of parallelism without std.event.Loop
<ForLoveOfCats> well attempting to is a better description, the no more than single argument to the thread restriction is annoying and hard to work around in a pleasing way
<andrewrk> what?
<ForLoveOfCats> Thread.spawn only allows a single argument to the function being run in the new thread
<andrewrk> so make a struct
<andrewrk> Thread.spawn(.{two, args}, func)
<ForLoveOfCats> I said to work around in a pleasing way, requiring my functions to manually use a single struct argument is not pleasing. Calling an autogenerated wrapper function in the thread which takes a single generated struct which then @call's the actual function with the arguments from that struct is much more pleasing
<ForLoveOfCats> but at the same time impossible without being able to build said struct at comptime from a `[]FnArg`
ForLoveOfCats has quit [Quit: Konversation terminated!]
dddddd has quit [Remote host closed the connection]
<andrewrk> pixelherodev, ^ not sure if you saw the gist above
waleee-cl has quit [Quit: Connection closed for inactivity]
<pixelherodev> I'd missed it; thanks
<pixelherodev> andrewrk, so the *only* dependency there is std.Thread?
<andrewrk> yep. check the strace
<pixelherodev> Hmm
<pixelherodev> With the bring-your-OS layer... I just had a terrible idea
jicksaw has quit [Quit: ZNC is kill]
jicksaw has joined #zig
<daurnimator> andrewrk: FWIW that autojson OutOfMemory stuff: is really working around a tautological comparison: `const e = @as(error{Foo,Bar}, error.Foo); if (e == error.OutOfMemory) { // do something }`
<andrewrk> yes I see that - it's quite clever. I was only concerned that OutOfMemory might not be the only error required to be bubbled up
<andrewrk> come to think of it, why do the other errors get ignored?
<daurnimator> andrewrk: we want to ignore type failures: e.g. if you say parseNumber("adf") -> you'd get error.UnexpectedToken.
<daurnimator> because you're really trying to construct a function `parseNumberOrString("adf")` out of `parseNumber("adf")` and `parseString("adf")`
<andrewrk> I see
<daurnimator> yeah
jrl has joined #zig
Snetry has quit [Ping timeout: 272 seconds]
<andrewrk> something really beautiful just occurred to me: combining https://github.com/ziglang/zig/issues/1907 with https://github.com/ziglang/zig/issues/2879
<andrewrk> oh, and combined with https://github.com/ziglang/zig/issues/3089
Snetry has joined #zig
<andrewrk> so you use zig as a drop-in replacement for a C compiler, but you specify the operating system version range you want to support, and the libc is specialized for that OS range
Snetry has quit [Ping timeout: 260 seconds]
Snetry has joined #zig
<fengb> Is there a nice way of creating a 0 length slice?
<fengb> I was trying to be fancy with `@"type": []struct {} = .{}`
<andrewrk> why not void?
<andrewrk> you can also do @as([]T, &[0]T{})
<fengb> Simplifying. The struct has fields inside and it's anon
<fengb> I'll use an inline for. Gonna brute force this until I figure out what I'm doing >_>
mahmudov has quit [Remote host closed the connection]
slowtyper has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
<pixelherodev> Hadn't seen 2879 before
<pixelherodev> Interesting
<andrewrk> fengb, what do you think about the 0 suffix instead of Z? to indicate null termination
<andrewrk> std.fmt.allocPrint0
<andrewrk> std.os.getenv0
<fengb> Oh I was joking. x86 appends z so I think it’s mostly fine
<fengb> Although... I think I like 0 as a suffix more heh
<mikdusan> std.os.getenvNullz
ur5us has joined #zig
marmotini_ has joined #zig
<daurnimator> yeah I like 0 as a suffix
<daurnimator> feels familiar because of -print0 as a `find` argument
marmotini_ has quit [Ping timeout: 260 seconds]
marmotini_ has joined #zig
araspik has joined #zig
araspik has quit [Ping timeout: 260 seconds]
alexnask has joined #zig
metaleap has joined #zig
slowtyper has quit [Ping timeout: 240 seconds]
slowtyper has joined #zig
alexnask has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 248 seconds]
araspik has joined #zig
<mikdusan> std.os.getenv⁰ /s
<daurnimator> andrewrk: was waiting on your reply to https://github.com/ziglang/zig/pull/4233#issuecomment-576060359
jjido has joined #zig
ur5us has joined #zig
araspik has quit [Ping timeout: 260 seconds]
drp has joined #zig
<metaleap> i hit a not-minimalrepro-able (I tried) zig compiler bug .. https://github.com/meta-leap/langserv/commit/ccf93dcd325858b6e9ab08c0a71225280f1f7b7f#diff-6a738f789bc748f4e81e77182cd63e02R17 left me a todo to try reproing again in the future but leaving it here in case anyone's curious in cases-of-oddity =)
return0e has joined #zig
eddyb[legacy] has quit [Ping timeout: 248 seconds]
l1x has quit [Ping timeout: 248 seconds]
cbarrett has quit [Ping timeout: 248 seconds]
eddyb[legacy] has joined #zig
cbarrett has joined #zig
l1x has joined #zig
LER0ever has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
araspik has joined #zig
Xatenev has joined #zig
<Xatenev> hi
<daurnimator> Xatenev: hi
<Xatenev> is it planned to move away from llvm in the future?
<Xatenev> just curious because someone wrote that in another channel but wasn't sure.
<daurnimator> Xatenev: no. no plan to move away; but we do intend to have alternate "backends"
<Xatenev> daurnimator, understood, thanks :)
<araspik> What's the rationale between having a global error set? It seems contradictory to the general convention of moving away from global resources (e.g with allocators).
<daurnimator> araspik: so that all errors fit into specific maximum size.
<araspik> But apparently Zig already has a method for providing unique integers for a given error name; Couldn't it do that without exposing `anyerror`?
<araspik> IMO, instead of `anyerror` as part of the return type it should just automatically deduce the composition of the different possible error sets to return.
<metaleap> araspik anyerror is useful for fn-protots / function-types / signatures.
<metaleap> "give this shape of callback .. but i wont prescribe the errors you can return to me"
<metaleap> ah, func-pointers i mean was the moniker i was looking for here =)
<araspik> Okay, thanks for explaining that metaleap
<araspik> However, question: If there are conflicting doc comments on different error sets, which one would the global set use?
<daurnimator> araspik: I have a feeling things will get cleaned up once we know the outcome of https://github.com/ziglang/zig/issues/2647
<araspik> yeah, that looks very promising
<araspik> But I can see how it would conflict with `anyerror`
araspik has quit [Ping timeout: 260 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Xatenev> https://bpaste.net/Q2EA can someone explain me why i get "error: cannot assign to constant" on line `self.head = newNode;`
<Xatenev> self.head shouldn't be constant I think?
<mikdusan> `fn append(self: *SinglyLinkedList, ...)`
<Xatenev> oh
<Xatenev> mikdusan, do I still have to .* deref self then?
<Xatenev> because I dont get a compile error if i dont
<mikdusan> on it's own yes. but accessing via dot operator is sugared -- ie. not necessary
<Xatenev> what do you mean "on its own yes"
<Xatenev> i dont understand that :E
<Xatenev> oh nvm
<Xatenev> understood
<Xatenev> you mean var s = self.*; vs self.something
<mikdusan> let's say `self: *BigInteger` or something; you'd have to `self.* = another_big_int;`
<mikdusan> yes
<Xatenev> thx mikdusan
<Xatenev> mikdusan, they dont seem to do it in the docs here https://ziglang.org/documentation/master/#toc-struct
<Xatenev> self: Vec3
<Xatenev> so both are fine, one is "mutable" one isn't?
<mikdusan> correct, the `*` indicates it can be modified
<Xatenev> understood, thx
daex_ has quit [Ping timeout: 265 seconds]
<Xatenev> yay all tests passed
<Xatenev> i love the simplicity of the test suite in zig
daex has joined #zig
<Xatenev> is it possible to say that an expression is ignoreable from inside a function?
<Xatenev> say i have a linkedlist with .append() that returns the node
<Xatenev> I dont want the caller to have to assign the node to something
<mikdusan> _ = ignore_me;
<Xatenev> yea i know that
<Xatenev> but i mean can i do it from inside the fnuction?
<Xatenev> so you can just do list.append(i32, 1);
<Xatenev> something like @Ignoreable
<Xatenev> I think its not possible :) i will use _ then
<Xatenev> sorry, one more question - in the example on https://ziglang.org/documentation/master/#Zig-Test , it prints the name of the test that ran successfully
<Xatenev> I only get All 1 tests passed
<Xatenev> how can i make it print the name of the test too?
<mikdusan> be careful that append() doesn't return an error. if it does, you should do something like `_ = try a.append(...);`
<Xatenev> mikdusan, yeap im doing that :)
<Xatenev> e.g. i have test "append" { } i would expect 1/1 test "append"... OK
<mikdusan> what does your test block look like?
<Xatenev> mikdusan, https://bpaste.net/4YDA
<mikdusan> ah you know I was curious about same, but was too lazy to look into if any flags exist. for now,
<mikdusan> just do something like `zig test foo.zig |& cat`
<mikdusan> if zig detects tty/console it's being much quieter
<Xatenev> ah so its printed to stderr
<Xatenev> i se
<Xatenev> e
<Xatenev> thank you :)
<mikdusan> so yeah it's currently verbose if tty is detected. the only other way I see to get around it is to set env var for the test command:
araspik has joined #zig
<mikdusan> (export TERM=dumb; zig test hello.zig)
marmotini_ has quit [Remote host closed the connection]
jzck has quit [*.net *.split]
jzck has joined #zig
<daurnimator> Xatenev: so why are you rewriting SinglyLinkedList? :)
<Xatenev> daurnimator, learning the language a bit
<Xatenev> daurnimator, i always just implement some common algos and data structures
<Xatenev> (ive seen the singlylinkedlist in the std) :P
<mikdusan> if you're going to impl some data structures, I wouldn't mind seeing a b-tree, b+tree and maybe some cow versions of those too :P
<Xatenev> mikdusan, will do :]
<mikdusan> s/cow/persistent/ in the "immutable" sense
<Xatenev> my implementations will probably be bad though :P
<Xatenev> but ill do some of them :p
<metaleap> Xatenev: was about to soon try my hand at a minimal prefix-tree https://en.wikipedia.org/wiki/Trie feel free to go for that too & share =) will be a while till i get there
Snektron has quit [Ping timeout: 252 seconds]
Snektron has joined #zig
frmdstryr has quit [Remote host closed the connection]
araspik has quit [Ping timeout: 260 seconds]
zfoo_ has joined #zig
<Snektron> I read SlightlyLinkedList and wondered whats that about
<Snektron> Only to realize it was a SinglyLinkedList
<mq32> andrewrk: is it wanted that @embedFile returns a buffer that is one byte larger than the actual file?
<mikdusan> nullz?
araspik has joined #zig
<mq32> yeah, it looks like files get nullterminated
<mikdusan> hmm wait i just got an exact match of file size to slice size
<mikdusan> what's your fs file size?
<mq32> Semantic Analysis [326/645] ./test.zig:5:23: error: destination type 'u32' has size 4 but source type '[4:0]u8' has size 5
<mq32> const data = @bitCast(u32, @embedFile("binary.dat").*);
<mq32> file size (wc -c binary.dat) is 4
<mikdusan> hmm `*const [6946:0]u8` closes the door to implementing @embedFile with mmap
<mq32> ls also says "4"
<mikdusan> yeah the slice.len is still 4
<mq32> yep, but the array is zero-terminated which breaks pretty much all binary stuff
<fengb> Type clearly indicates 0 terminated...
<mq32> as embedFile is a comptime feature, i don't think mmap will help there
<fengb> Ugh we really need auto coercion of slice to array pointer
<mq32> this will mitigate the actual problem: embedFile appends a zero-terminator to the data
<mq32> which is bad for me, as every file will be 4 byte larger than necessary
<fengb> Using readIntNative is safer and more correct since it makes you worry about endianness
<mq32> fengb: the above is a pretty simplified reproduction of my problem
<mikdusan> if it's nullz then first coerce to []const u8, then bitcast?
<mq32> endianess isn't a problem, i know the target platform in embedded world up to the exact number of bits in ram
<mq32> mikdusan, you cannot bitcast slices
<mikdusan> ugh
<mq32> which is reasonable, btw
<fengb> Yeah array coercion would fix this problem
<fengb> Oh wait it’s older: https://github.com/ziglang/zig/issues/863
<fengb> I can imagine a userland function that takes a nullz array and returns the regular version
<fengb> Oh mq32 you were right about builtin. Importing it directly is now deprecated
<mq32> fengb, problem is right now that the nullz-version would still be embedded in the resulting file.
<fengb> You can do it with a comptime function and strip off the byte manually
nc-x has joined #zig
<mikdusan> mq32: oh, I just meant for possibility to use mmap to supply the bytes, instead of reading them in with regular io
<betawaffle> question: what does `threadlocal` actually do to a variable declaration? does it just specify a special section to be linked into?
<Xatenev> betawaffle, i think https://akkadia.org/drepper/tls.pdf is relevant
<Xatenev> there are different thread local storage models
<betawaffle> i want to understand what a threadlocal "means" in freestanding
<betawaffle> on x86 for example, my understanding is a common pattern is to use one of the segment registers to point at TLS
<betawaffle> but how could i go about telling zig that's what i mean with threadlocal?
<betawaffle> i guess what i'm asking is... what does zig use to generate accesses of TLS variables?
<mikdusan> it uses an llvm global directive for variable of type `thread_local`
<betawaffle> ok, so it just defers to LLVM to figure it out
<betawaffle> any idea what LLVM does for freestanding?
<daurnimator> betawaffle: seems like it boils down to LLVM's TLSModel::GeneralDynamic
<mikdusan> good question. they do mention something about an emulation mode if not elf-linker compatible
<daurnimator> betawaffle: browsing the LLVM source, that does different things for each architecture
<betawaffle> interesting
<betawaffle> does LLVM error if it can't reasonably support TLS for a target? or is there always *some* way to support it and still be "correct" ?
<betawaffle> lol, LLVM source is like a foreign language to me
dddddd has joined #zig
<mikdusan> daurnimator: do CI builds limit cpu features? or are they all-out whatever CI box has?
<daurnimator> mikdusan: worse: whatever qemu lies about
<mikdusan> so #4506 could simply be the CI box is new enough to use a few instr the 7700HQ doesn't like
<daurnimator> yeah..... though the 7700HQ isn't that old.
<fengb> Should we default to something reasonably old, like Haswell or before?
<betawaffle> daurnimator: am i reading this right, that it generates a call to `__tls_get_addr`?
<daurnimator> betawaffle: huh?
<mikdusan> I wonder what would happen if azure CI started using AMD epyc
<mikdusan> we really have to start encoding into the binaries what build flags were used
<daurnimator> betawaffle: and which architecture are you asking about?
<betawaffle> riscv
<betawaffle> the one you linked
<daurnimator> for dynamic: yes.
<betawaffle> for static, it's just using the x4 aka tp register
<betawaffle> it would be nice to be able to tell zig -> llvm what tls mode we want in a freestanding build
<daurnimator> betawaffle: with clang you can pass -ftls-model
<daurnimator> we could probably add that...
<daurnimator> gcc supports it too with same argument(s)
<daurnimator> Xatenev's earlier link (https://www.akkadia.org/drepper/tls.pdf) goes through the various models
<Xatenev> re `does LLVM error if it can't reasonably support TLS for a target? or is there always *some* way to support it and still be "correct" ?`
<Xatenev> For platforms without linker support of ELF TLS model, the -femulated-tls flag can be used to generate GCC compatible emulated TLS code.
Barabas has joined #zig
<Barabas> Silly question, how do I provide an output file for translate-c ?
<daurnimator> Barabas: just redirect to a file
<daurnimator> Barabas: zig translate-c foo.h > myfile.zig
<Barabas> Ok, maybe that works in cmd... powershell is very helpful in that regard and makes everything utf16 <_<
<Barabas> Let me try
<Xatenev> zig translate-c foo.h | Out-File -FilePath .\output
<Xatenev> ?
<betawaffle> why is microsoft like utf16 so much...
<Xatenev> Barabas, ... and add -Encoding UTF8
<Xatenev> or whatever you like
<Xatenev> to Out-File
<daurnimator> `[Console]::OutputEncoding = New-Object -typename System.Text.UTF8Encoding` might help
<daurnimator> If you use -Encoding to OutFile then you'll want UTF8NoBOM
<Barabas> The console thing didn't seem to have worked :(
<Barabas> cmd.exe does it right though
decentpenguin has joined #zig
<Barabas> Let me try Out-File
<Barabas> Out-File : Cannot validate argument on parameter 'Encoding'. The argument "UTF8NoBOM" does not belong to the set "unknown;string;unicode;bigendianunicode;utf8;utf7;utf32;ascii;default;oem" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
<Barabas> Microsoft. -.-
<Xatenev> your version is too old
<Xatenev> nobom needs powershell > 6
<fengb> betawaffle: back in the day, it wasn't obvious UTF-8 would win so hard. Although I guess it's a little obvious it probably will due to ASCII compatibility >_>
<fengb> Java and Javascript also chose wrong fwiw
<daurnimator> fengb: it became widely known to be a bad idea in 1996
<mikdusan> Cocoa also chose wrong. Swift seems to like UTF-8
<daurnimator> anything invented between ~93 and ~96 tended to chose UCS-2 and got stuck with it
<daurnimator> windows NT from 1993. Java from 1995. Javascript from 1996
<Barabas> This is so bad
<Barabas> It doesn't even tell me what version it is when I start it
<Barabas> Ok, I seem to have 5.1 for whatever reason.
<Barabas> You'd think Windows would update it for you, just like it does with everything else without even asking.
araspik has quit [Ping timeout: 260 seconds]
<Xatenev> I mean.. bash doesnt tell you what version it is when you start it either, does it?
<Xatenev> :O
<Xatenev> I think its pretty similar in that respect, in one you do echo ${BASH_VERSION} in the other $PSVersionTable
<Barabas> Bash doesn't tell me anything
<Barabas> Powershell has build-in advertisements :P
<Barabas> Windows PowerShellCopyright (C) Microsoft Corporation. All rights reserved.Try the new cross-platform PowerShell https://aka.ms/pscore6
<Xatenev> heh
<Barabas> Alright. Thanks for the help guys. Sorry about the nagging ^^
<Barabas> Oh... it's even available for Linux now =D
<Barabas> Here, new version...
<Barabas> PowerShell 6.2.4Copyright (c) Microsoft Corporation. All rights reserved.https://aka.ms/pscore6-docsType 'help' to get help.
<Barabas> ^^
<Barabas> Oh damn... windows line endings D=
marmotini_ has joined #zig
<fengb> But... can you run Powershell in Wine in WSL??
msnerd has joined #zig
<Barabas> lol
_Vi has quit [Ping timeout: 246 seconds]
<betawaffle> Barabas: the real question is why are you on windows
<BaroqueLarouche> because everything works out of the box without too much hassle ?
decentpenguin has quit [Ping timeout: 260 seconds]
decentpenguin has joined #zig
<Barabas> Because Linux is a pain in the ass in other aspects.
<Barabas> But fuck it, I'll just run my command in cmd.exe, at least that doesn't feel the need to fiddle with the output from zig.
<fengb> I swore off Windows 12 years ago and still smug about it 🙃
<Barabas> I tried Linux for a while. It wasn't all bad, but too many annoying things. It's fine for programming and writing quick scripts and stuff. Windows can't really compete there.
<Xatenev> im fine with linux except for the file manager
<Barabas> But for normal user friendliness Linux just is nowhere near Windows.
<Xatenev> every file manager in linux is terrible bad compared to windows :D
<Barabas> Yes, that's one of those things.
<Xatenev> thats why i switched to i3 and terminal-only
<fengb> I can agree with that, but I'm also on a Mac kool aid machine
<betawaffle> i'm basically in the boat of on macOS but wish linux could be all i need
<fengb> Honestly, I can't wait for something to replace X11
<Barabas> I never saw the point of Mac
<Xatenev> and yeah, now after a few years i got quite used to terminal-only way :E
<betawaffle> fengb: X11, yeah
<betawaffle> i'm ready for wayland to be fully baked
<Xatenev> Barabas, pay-more-get-less
<Xatenev> Barabas, :D
<Barabas> That's definitely Apple ^^
<fengb> Barabas: Mac is a BSD core with a competent windowing system. Some people can't stand not-Linux or not-OSS but once you learn it, it gets the job done pretty well
return0e has quit [Read error: Connection reset by peer]
<Xatenev> is wayland a lot better than x11?
<Xatenev> I have never read about it yet
<fengb> It... can't... not be... 🙃
<betawaffle> it's just not super-legacy
return0e has joined #zig
<Barabas> I actually wouldn't mind trying out Mac, but I don't want to buy overpriced hardware just to try :P
<betawaffle> x11 is basically a direct descendent of the original unix stuff, iirc
<Xatenev> I wouldn't want to be in the position to maintain a project like x11/wayland too tbh
<Xatenev> it must be incredibly hard to achieve the compability required
<Barabas> And probably I'm better off using Linux, as there is more information about that than Mac I guess.
<fengb> Other than the touchbar... and the keyboard, the Mac isn't actually too overpriced. They just have more expensive parts than a typical built laptop
<Barabas> Dealing with legacy stuff or (backwards) compatibility is probably one of the hardest problems in programming ^^
<fengb> Like the screen is one of the best I've ever used, and Apple locked down the supply chain
<fengb> I always complain that my designers need to use a shitty monitor because our users are using shitty screens
<Barabas> Haha
<Barabas> I don't use a laptop though.
<fengb> Oh... well probably not for you then :P
<Snektron> <mikdusan "so #4506 could simply be the CI "> Isn't that a laptop cpu?
<fengb> I'm not a fan of their desktop offering either
decentpe1 has joined #zig
<fengb> I'm trying to find an old post on Slashdot about why Apple rewrote Aqua instead of using X11. Basically... X11 is super legacy
decentpenguin has quit [Ping timeout: 268 seconds]
araspik has joined #zig
dingenskirchen1 has joined #zig
<Snektron> X11 was just designed in another time
<Snektron> Just like the rest of posix
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 is now known as dingenskirchen
<fengb> It was also designed for windowing into mainframes
<Snektron> <Barabas "Dealing with legacy stuff or (ba"> And we can see the results of handling it badly
<Snektron> Cough x86 cough
<fengb> I'm amazed how far we pushed x86
<Snektron> Same
<fengb> And with Rizen... it might still keep going
<Snektron> Im developing a small kernel (sadly i couldnt convince my friends to use Zig) and i keep running into these weird old backwards compatibility stuff
<Barabas> lol
<Snektron> Like fpu emulation via sse
<Barabas> Someone once wondered how to render text in things like the bios
msnerd has quit [Remote host closed the connection]
<fengb> Back in my day, we didn't have a math coprocessor!
<Barabas> Just one of these things... it's build-in in the hardware :D (iirc)
<betawaffle> Barabas: old VGA interfaces
<fengb> Learning Z80 really made me appreciate the effort to keep backwards compatibility
<mikdusan> github: "You can't comment at this time" . well that's nice.
<Barabas> lol
<Snektron> Are you that old fengb? I thought 386 is already like 30 years old
<betawaffle> geez, i'm almost 30
<fengb> Semi joking, although my first family computer was a 386 DX
<fengb> So... almost no coprocessor ;)
<araspik> are there any 'new' architectures out there which don't have half the cruft of x86?
<Barabas> 30 is when the fun starts :P
<Snektron> My Z80 experience is TI calculators because i couldn't be bothered to pay attention in high school
<Snektron> Good times
<betawaffle> araspik: riscv
<fengb> araspik: arm, RISCV
<araspik> I'll look into it
<betawaffle> riscv is so flexible
<Snektron> Personally im rooting for Gandalf's mill cpu's
<araspik> because every time I try programming in x86 assembly I like it but I'm thrown off by how much useless stuff hangs around
<araspik> GitHub tells me RISCV has 69 repositories :P
<fengb> Almost every mobile device is arm. And Raspberry PI
<Snektron> Isnt arm also cisc?
<fengb> RISCV was just finalized. It'll be awhile before we see powerful devices
<araspik> Hey, I have a Pi! I could probably do stuff on that
<fengb> No
<fengb> But it's also not strictly RISC due to SIMD and such
<Snektron> Something with converting floating point to javascript formats
<araspik> Question: is it a bad idea to make a programming language called 666?
<Snektron> <fengb "Semi joking, although my first f"> The kernel is targeted at a 486 75DX laptop
<Snektron> So im programming for a laptop made before i was born
<Snektron> I just hope it has pci...
<betawaffle> araspik: there are a number of potential problems with that
<araspik> the main locations where '666' would be used on its own is as a file extension and as a command
<araspik> and Linux seems okay with that name
<gchristensen> Snektron: what, is it older than early-90's? :o
<Snektron> Not a very google friendly name
<Snektron> <gchristensen "Snektron: what, is it older than"> 1995
<araspik> Not like it's ever going to be popular
<gchristensen> Snektron: good lord
<mikdusan> Snektron: yeah the 7700HQ is whatever, the point is if CI box is different... codegen is against CPU features of CI which may not match the issue reporter
<Snektron> I found it in my great uncles appartment
<betawaffle> araspik: famous last words
<gchristensen> Snektron: what is it? (I haven't found mention of it in the scrollback)
<araspik> betawaffle: ahahhaa true but it's mostly for me experimenting with lang design
<alva> fengb: it might not be so far off; Xuantie 910 seems plenty powerful
<Snektron> gchristensen: a compaq contura 420C
<araspik> I like Zig, it combines nice things from both D and Rust, but I'm not happy with a few things and I've always wanted to make a lang so hopefully will be fun
<gchristensen> Snektron: look at that beauty
<Snektron> Running a german version of windows 3.1 on 12 MB ram
<mikdusan> can we get Zig binaries for Novell NetWare? /s
<Barabas> Seems like a dangerous assault weapon :D
<fengb> There's also the problem of RISCV software support :P
<fengb> I have hopes for the future, but I'm also scared at how tiny the core instruction set is
<Snektron> I do want to try to run some Zig on it in the future
<Barabas> Can clang even compile for a processor that old?
<fengb> Yeah, LLVM supports i386
<Snektron> At least i got an usb to pcie cable now because my computer doesn't have either a floppy drive or serial port
<shakesoda> fengb: the core is tiny but everything that can run linux etc isn't running on just core
<Snektron> I think linux technically still supports it
<Barabas> cool
<Snektron> They dropped 386 support, but not 486
<fengb> shakesoda: sure but that means we're having a defacto core. And I dont' know if the ecosystem will settle around the same things
<shakesoda> fengb: time will tell, i mostly mean that there will need to be some target support for a few different configurations of the isa
<Snektron> lLVM supports compiling for 386 but i had some trouble linking. For now were just using i486 gcc
<shakesoda> just supporting stuff like what sifive unleashed has is probably not a big deal, but that probably won't be the same build as you'd be using for some other riscv microcontroller that only implements basic int stuff
<fengb> mikdusan: github is shitting the bed in general
* shakesoda mostly would like some zig builds available for arm1176jzf-s / old rpis
<shakesoda> i recall there was an issue about that and some test related issues
<Snektron> Ye that was probably me shakesoda
<Snektron> I tried getting it to work on an old rpi 3 for a project
<Snektron> But i turned the project into a school project and used C (on an arduino) instead
<shakesoda> the pi 3 is armv8 though
<Snektron> Nope
<Snektron> Wait
<shakesoda> it absolutely is
<Snektron> Pi B+
<Snektron> Sorry i keep mixing them up
<shakesoda> very different!
<Snektron> Yes, i know
<shakesoda> the pi b+ is a much closer relative to the pi zero's i love and use so much
<Snektron> For some reason i keep remembering my Pi B+ as a Pi 3 B+
<fengb> I should do something with my Pi Zero W
<Snektron> But anyway, i fixed compiling a basic executable for it, but it still needs support for extern layout iirc
<shakesoda> fengb: they are fun in a lot of ways - especially if you are experimenting with kernel dev, since you can boot them straight off the usb without a card
<shakesoda> i think that ability is shared by the new model 3b+ and 4's
<shakesoda> i was doing some graphics programming over the linux fb since the hardware has a compositor you can use to just layer what you are working on over top of anything you like
<mq32> mikdusan: i skipped over the packed struct stuff and it looks about right
<mq32> can't do a thorough check right now
<mikdusan> ah thanks. I'm going to need some eyes on this sooner or later
<mikdusan> I'm not sure but I think andrew wants to support sub-byte alignment for fields; I guess `align(:4)` might be the obvious syntax
<shakesoda> that would be useful
<shakesoda> what happens currently if you load up a packed struct with u1's?
<shakesoda> is it packed to the byte, or bit packed?
<mikdusan> right now u1 (arbitrary sized integers) are a problem. it works better with `bool` instead of `u1`.
<mikdusan> in master that is.
<Snektron> What size is bool?
<Snektron> u1m
<Snektron> ?*
<andrewrk> mq32, yes, it's the same as string literals
<andrewrk> fengb, does the W stand for Wing?
<mikdusan> shakesoda: i think the spatial packing of u1's are not bad, but it's the load/store operations that is messed right now
<fengb> Wireless
<andrewrk> that's too bad
<fengb> Would it be helpful for InStream to have `readAllocExact`?
<andrewrk> it doesn't have readAlloc - what does Exact mean?
<fengb> Read this exact amount. It has readAllAlloc
<fengb> I wanna simplify my 2 lines :P
<fengb> `i.module = try result.arena.allocator.alloc(u8, module_len); try payload.stream.readNoEof(i.module);`
<andrewrk> hmm that might be helper function territory
<fengb> Yeah it looks worse lol >_>
<andrewrk> you also need an errdefer there
<fengb> Starts looking like word salad args
<fengb> Nah, it's all arenaed
<andrewrk> ah of course :)
<fengb> Arenas are the reason I don't go insane in Zig :P
<andrewrk> is github read-only right now?
<fengb> https://www.githubstatus.com/ having major issues
<fengb> Man... I hate to see this code in Go. The density of `try` is insane heh
<mikdusan> so is there a way to backup (for free) zig's github issues?
<mq32> mikdusan: you can probably just pull a json dump of the issues
<fengb> Which probably doesn't work right now ;)
<mikdusan> mq32: that will make a good test for zig's http/json abilities :)
<mikdusan> and async
<mq32> hehe, true dat
<mq32> we use github issues in our hackerspace to display a todo list on some wall mounted screen
<andrewrk> mikdusan, I have a dream of an open source project that is essentially github issues but decentralized like git, and uses plain text files within source control (not necessarily git) to store the data. but it would also support running an http server with a web interface
<andrewrk> issues would have unique ids rather than monotonically increasing integers, so they could be created simultaneously offline with no conflicts
<companion_cube> andrewrk: so like, fossil?
<companion_cube> (except for the decentralized part)
<andrewrk> someone else pointed me to this, and no, it doesn't do what I said
<andrewrk> we should be able to have the convenience of a web ui that users can interact with without giving up decentralization
araspik has quit [Ping timeout: 260 seconds]
<companion_cube> I imagine a pair of git repos (or just two branches) coudl do the trick, for decentralized storage
<companion_cube> the rest is a UI problem
<shakesoda> it almost certainly isn't what you are looking for but this sounds very doable with dat protocol stuff in beaker browser
<shakesoda> everything there is p2p, works offline and you can communicate between peers as available
<mikdusan> decentralized issues would be a win; but I'd need to see how renames/edits/tracking an issue plays out
waleee-cl has joined #zig
<andrewrk> companion_cube, yes it's a ui problem but also a database design problem, you have to design the storage to minimize conflicts
<companion_cube> sounds fun to have to merge issues :D
<companion_cube> the answer is CRDTs
<companion_cube> but the specifics are… hard
<fengb> I mean... it sounds like git can store all the data. Just git all the way down
<andrewrk> yeah that's the idea
<fengb> Once an arena is deinitted, it can be reused right?
<companion_cube> so it'll be zig's killer app? :p
frmdstryr has joined #zig
<mikdusan> fengb: I think you need to re-copy to the state variable.
<companion_cube> andrewrk: I'd imagine one file per issue + comments would do?
<andrewrk> std.heap.ArenaAllocator is intended to support this use case but I think it's not tested and should be audited
<andrewrk> companion_cube, sounds like you're getting excited about this project now too :D
<companion_cube> nah, I have far far too many projects already :(
<fengb> Alright, I'm not plannign on using it like this, but I don't want to return corrupted data
<fengb> So I'll pretend this is working as intended and move on :P
<Xatenev> I create a std.ArrayList via std.ArrayList(*Node).init(allocator); and then call .append() on it and get a segmentation fault :| do i need to call something else?
<Xatenev> I thought append would automatically realloc to a proper size, do I have to manually alloc memoryß
alexnask has joined #zig
<fengb> Do you mean ArrayList(Node)?
<shakesoda> decentralized/p2p issue tracking sounds like a fun project to me
<shakesoda> it also sounds liable to consume the life of whoever tackles it
<fengb> ArrayList(*Node) would create node pointers on the heap, which would probably point to garbage
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 has joined #zig
<shakesoda> an endless sea of details
<Xatenev> fengb, no, ArrayList(*Node) - why would they point to garbage?
<Xatenev> fengb, I am allocating the nodes and append a pointer to them.
<Xatenev> fengb, sec, I copy some code
<mikdusan> Xatenev: then possibly your allocator has vanished?
<fengb> ArrayList(*Node) would allocate node pointers, not nodes
<Xatenev> fengb, yes, I myself allocate nodes somewhre else
<Xatenev> the arraylist just holds a list of pointers to these self-allocated nodes
<fengb> Oh
<companion_cube> shakesoda: nah, you just need to write robust distributed systems, friendly UIs, on all platforms
<companion_cube> sounds like a piece of cake to me 🤔
<andrewrk> Xatenev, make sure you're not holding on to references to ArrayList elements after the list resizes
<Xatenev> this is basically what i have
dingenskirchen1 is now known as dingenskirchen
<Xatenev> mikdusan, I dont think the allocator has vanished
<Xatenev> I have an arena allocator and .deinit after the append call
<mikdusan> `var newNode =` doesn't look like a pointer. is it a pointer?
<Xatenev> andrewrk, all my arraylist elements are pointers itself so the list resizing should not change the position of my original elements
<Xatenev> andrewrk, so this should be no problem, correct?
<Xatenev> mikdusan, its not a pointer, but &newNode is
<andrewrk> does the segfault give you a stack trace?
<Xatenev> yes one sec
<Xatenev> this is the stacktrace
<andrewrk> is the first one cut off?
<andrewrk> there's a missing error message at the top and caret at the bottom
<Xatenev> andrewrk, https://bpaste.net/ZFPA sorry
<Xatenev> this is all
<andrewrk> now we're talking
<Xatenev> I cut my name off before but w/e :p
<andrewrk> I think your allocator is messed up
<andrewrk> you use self.allocator on line 5 and allocator on line 2. that could be a clue
araspik has joined #zig
<Xatenev> andrewrk, wait i will push my code
<Xatenev> Its probably something basic im missing :P
<andrewrk> Xatenev, well you have another problem, your reference to newNode expires at line 30
<Xatenev> but that reference does not matter anymore does it?
<Xatenev> oh
<Xatenev> I think I understnad
<andrewrk> you added it to the list, which is still alive
<andrewrk> the problem with the allocator is probably similar
<metaleap> Xatenev: best to post gist
<metaleap> ooh damn that was 20 mins ago :D
<Xatenev> metaleap, im trying around a bit to implement the prefixtree you mentioned :P
<Xatenev> andrewrk, thanks for the help, i'll create the prefix tree node on the heap instead and pass a pointer to that
<mikdusan> https://www.githubstatus.com is a river in Egypt. every single one of their non-green ticks for today have the summary "no incidents related to this downtime". Then their feb.19.2020 writeup finishes with summary "This incident has been resolved".
<fengb> Working as intended™
<araspik> I guess that means somebody pushed to prod
<metaleap> Xatenev good going, share with us here when you feel/checked it's proper =)
wilsonk has quit [Ping timeout: 248 seconds]
araspik has quit [Ping timeout: 260 seconds]
Xatenev has quit [Remote host closed the connection]
wilsonk has joined #zig
Barabas has quit [Remote host closed the connection]
_Vi has joined #zig
Barabas has joined #zig
return0e has quit [Remote host closed the connection]
wilsonk has quit [Ping timeout: 260 seconds]
Akuli has joined #zig
<fengb> I have a stupid project name: bear metal
<andrewrk> question for arm people here: are the arm cpus capable of multiple sub-architectures?
<andrewrk> e.g. does the cortex_a76 cpu support both v8_5a and v8a?
<BaroqueLarouche> andrewrk: you can have both ARM and THUMB code
<mq32> and you can switch mode per jump :D
<andrewrk> I don't think this question is related to thumb
<andrewrk> it looks like the 32 bit arm cpus have a specific sub-arch that they are
<andrewrk> e.g. 32-bit cortex_a76 is always v8_2a
<andrewrk> whereas e.g. 32-bit cortext_a12 is always v7a
<andrewrk> I think I can kill the concept of "sub-architecture" from zig
FireFox317 has joined #zig
<mq32> i should have never searched for arm architectures: https://en.wikipedia.org/wiki/Jazelle
<FireFox317> where is the global zig cache on windows?
<andrewrk> also metaleap's accepted proposal would make `zig info` print it: https://github.com/ziglang/zig/issues/4427
<FireFox317> thanks andrewrk, i was looking in the wiki already but couldnt find it
<fengb> Hardware Java bytecode support? There's hope for wasm! :P
<Barabas> How do I get the non-optional type of an optional type?
<Barabas> There's this example in the docs, but it doesn't seem to work
<Barabas> comptime assert(@TypeOf(foo).Child == i32);
forgot-password has joined #zig
<Barabas> At least not when I do this
<Barabas> const testfn = ?u32;fn bla(input: @TypeOf(testfn).Child) void {}
<fengb> @typeInfo(@TypeOf(foo)).Optional.Child
<Barabas> (Sorry, naming is weird, I need it for a function p ointer)
<fengb> I think std.meta.Child(@TypeOf(foo)) does the same
<Barabas> This doesn't work: @typeInfo(@TypeOf(foo)).Optional.Child
<Barabas> it says:error: accessing union field 'Optional' while field 'Type' is set
<Barabas> If I leave off the @TypeOf I get: error: no member named 'Child' in struct 'std.builtin.Optional'
<fengb> Oops... `.child`
<Barabas> aha!
<Barabas> cool, thanks
wilsonk has joined #zig
<forgot-password> What's the best way to to link a shared library in my projects build file? I'm trying to use `exe.linkLibrary(LibExeObjStep.createSharedLibrary(...))`, but I get some errors and I'm not sure if I'm just not understanding the builder functions...
<Barabas> Did you build the shared library with the build system?
<Barabas> Otherwise try `.linkSystemLibrary` I guess.
<forgot-password> Originally I tried to link against a Swift library, but now I just have a very simple c file that I compile with clang.
<forgot-password> Thanks, andrewrk, I'll give it a shot
<andrewrk> forgot-password, also you can get better help if you actually post your errors ;)
<forgot-password> Yeah I know, but it's quite a mess right now and I thought if anybody can point to some example code I can try to work out myself :)
<forgot-password> Oh, I just noticed that your example uses a zig source, but I have a pre-compiled .so
FireFox317 has quit [Remote host closed the connection]
<andrewrk> don't you want to set up your project to reproducibly build?
<andrewrk> e.g. maybe a colleague wants to help with the project on their computer
<andrewrk> how is this .so produced?
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
mahmudov has joined #zig
return0e has joined #zig
return0e has quit [Ping timeout: 255 seconds]
Xatenev has joined #zig
zfoo_ has quit [Read error: Connection reset by peer]
<forgot-password> andrewrk: Sorry, I had to go to the store really quick.
<forgot-password> andrewrk: Yes, I wanna do that, but I would add that build process to the build file (call the respective compiler etc.). I'm currently developing the macOS port and for that I need some platform-specfic APIs that only make sense to use via Objective-C or Swift.
<forgot-password> Well, so far I've been using the objective-c runtime in Zig, but this is really annoying for more than a few lines of code
<andrewrk> it sounds perhaps linkSystemLibrary + addLibPath is what you want
araspik has joined #zig
<forgot-password> Hm, the compiler reports it cannot find the library, but it works when I use clang with a very basic c file
<forgot-password> The path I pass to `addLibPath` is the directory in which my `libexports.so` file is located
<andrewrk> that should be good
jjido has joined #zig
<andrewrk> what's the exact error message
<forgot-password> || lld: error: Unable to find library for -lexports
<forgot-password> Can I use a relative path wit addLibPath?
<andrewrk> `zig build --verbose-link`
<forgot-password> The output looks good. The path is correct (I can cd into it when I copy-paste it) and it also contains the `-lexports` flag
<andrewrk> hm. well, here's another thing to try: foo.addObject(path_to_libexports_so) rather than linkSystemLibrary + addLibPath
<forgot-password> Here's the output from `file libexports.so`: libexports.so: Mach-O 64-bit dynamically linked shared library x86_64
<forgot-password> Does that look good to link? ^^
<andrewrk> sure
<forgot-password> When I use `addObjectFile` it builds fine
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
decentpe1 has quit [Quit: decentpe1]
zfoo_ has joined #zig
<andrewrk> what's a good "default"/"baseline"/"generic" sub-architecture for 32-bit arm?
<andrewrk> e.g. what cpu features get enabled if you do -target arm-freestanding or arm-linux
<andrewrk> how about v2a
dimenus has joined #zig
dimenus has quit [Remote host closed the connection]
mahmudov has quit [Ping timeout: 258 seconds]
_Vi has quit [Ping timeout: 272 seconds]
<shakesoda> andrewrk: arm1176jzf-s (aka arm6hf) seems like a good choice for 32 bit arm, unless there's a good reason to support
<shakesoda> andrewrk: the lowly cortex m0 supports armv6-m and that might be another reasonable baseline for freestanding 32 bit
<andrewrk> shakesoda, nice, that's what I ended up going with
<shakesoda> oh i cut off my first line
<shakesoda> it was supposed to be "unless there's a good reason to support the earliest android phones or you want to default to something for microcontrollers"
mahmudov has joined #zig
<shakesoda> the 1176jzf-s set for arm is going to be the most popular outside of microcontrollers just because of the raspberry pi
dimenus has joined #zig
<Barabas> I hit some infinite loop it seems
waleee-cl has quit [Quit: Connection closed for inactivity]
<dimenus> andrewrk: are you looking for contributors to zig-window or are you planning on implementing that yourself?
<andrewrk> it's so early, any contributor can probably pass my progress in their own project in a manner of days
<dimenus> where does that 'nox' name come from?
<andrewrk> so I would recommend someone make progress on their own project. maybe we can join forces some day
<andrewrk> "No X library"
<dimenus> got it
<andrewrk> I think on windows one could make quick progress
<dimenus> i might pick that up, my breakout clone is basically finished - but it's looking a bit too heavy on the required dlls at the moment
<dimenus> the zig/vulkan version is quite a bit faster than the OpenGL version :)
<andrewrk> nice
<andrewrk> is that open source? I could learn a lot from that project
<shakesoda> i wonder if a good starting point for a zig windowing library would just be translated glfw
<shakesoda> windowing stuff is really, extremely hairy to do from the ground up :\
Snetry has quit [Quit: left Freenode]
Snetry has joined #zig
<Barabas> It is.
<Barabas> Especially handling all the user input.
<andrewrk> shakesoda, yes glfw is an excellent point of reference
<fengb> So in the new world, a real CPU = arch + optional features?
<andrewrk> fengb, yes: https://clbin.com/h2Z8m
<fengb> Ha, okay
ur5us has joined #zig
_Vi has joined #zig
frmdstryr has quit [Ping timeout: 240 seconds]
marmotini_ has quit [Remote host closed the connection]
zfoo_ has quit [Remote host closed the connection]
jjido has joined #zig
adamkowalski has joined #zig
Akuli has quit [Quit: Leaving]
waleee-cl has joined #zig
forgot-password has quit [Quit: leaving]
araspik has quit [Remote host closed the connection]
<Barabas> How do you create a slice from a pointer and a size?
<Barabas> Oh wait...
<dimenus> foo[0..len]
<dimenus> oh a pointer
<shakesoda> ptr[0..size] should work?
<Barabas> Well, maybe I need a cast, but yes probably that.
<dimenus> you probably do need a cast
<shakesoda> if it's a [*] it should work
<dimenus> @ptrCast([*]foo, ptr)[0..len]
<Snektron> I still need to finish that vulkan thingy
<Snektron> I got kinda distracted
<shakesoda> that's kind of how i feel about vulkan entirely
<Barabas> What vulkan thingy?
<Barabas> I'm currently fiddling around with Vulkan. :)
<shakesoda> i have not been able to get anywhere with it before my attention runs dry and i go back to working on my gl renderer
<Barabas> It takes quite some effort to get into, yes.
<Barabas> I remember I was happy I could display something.
<Barabas> Then I needed a texture...
<shakesoda> one of these days i will complete my quest to have a working vulkan renderer
<Barabas> Took me another few weeks :P
<shakesoda> but not today!
<Barabas> ^^
<shakesoda> i'm really happy with my gl4 renderer in general, and it's not really my current bottleneck, so there hasn't been *that* much motivation to do vulkan
<fengb> It sounds like we have about 3 implementations of Vulkan in 10 different pieces in here 🙃
<Barabas> We can make a Vulkanstein =D
<Barabas> However, doing all this stuff in zig really shows the power of zig.
<Barabas> I did it in C++ before and it's messy.
<shakesoda> what i am unsure of is if i will be compelled enough to write a vulkan renderer before i can just use webgpu instead :D
<shakesoda> suppose i could use webgpu right now, but it seems a bit volatile still
<Barabas> What's webgpu?
<Snektron> Barabas: better Zig bindings
<shakesoda> Barabas: it's kind of like cross platform metal, in addition to being a successor to webgl
<Snektron> I got stuck on how i wanna handle function pointers
<dimenus> i have a working vulkan renderer and a 95% complete clone of learnopengl.com's breakout game
<Barabas> nice
<dimenus> with sound. still need text though
<Barabas> hah
<Barabas> text
<Snektron> I have a c++ multi gpu volumetric ray tracer
<shakesoda> dimenus: you could cheese the text and snag my vga style debug text :D
<shakesoda> one moment
<Barabas> one of those: "How hard can this be?" things.
<dimenus> meh, i've done it the right way so far
<dimenus> might as well complete it
<dimenus> it's ~5k lines of zig + the generated code
<Barabas> What's the right way for text, though?
<dimenus> about 32k if you include generated zig
<shakesoda> this isn't particularly the wrong way to do text - it's just what i do for quick debug stuff
<Snektron> Signed distance fields
<shakesoda> msdf!
<Snektron> Whats the m for?
<Barabas> Maybe, but even there you have multiple options.
frmdstryr has joined #zig
<shakesoda> right, also this function is relevant: https://github.com/shakesoda/tinyfx/blob/master/tinyfx.c#L2877-L2924
<shakesoda> Snektron: multi-channel
<dimenus> i'm actually trying to cut out dependencies atm
<shakesoda> there's also a much smaller generator here https://github.com/exezin/msdf-c (and i think at least one fork with some fixes - haven't checked)
<Snektron> Very nice
<shakesoda> dimenus: these are just texture generators, don't need them as deps
<shakesoda> you can also use them as deps if you want, granted
<dimenus> shakesoda: not in reference to your comment, i just mean that it's my general goal to remove deps
<Snektron> Build-time dependencies
<shakesoda> i'm always on the quest to remove deps too
<dimenus> although half would be gone if I'd just build libsoundio as a static lib
<Barabas> Best way to not have dependencies is to not add them in the first place :P
<Barabas> But ehm... sometimes... that means things never get done ^^
<shakesoda> of course, but sometimes it's the right way to get something up and running
<Barabas> Yeah
<Barabas> fml
<Barabas> Zig's unit testing seems to be a bit broken
<shakesoda> any corresponding issues already?
<Barabas> I made that one, but I've run into it ten times after that
<Barabas> test "test test"{ testing.expect(false);}
<Barabas> that triggers it I think...
<Barabas> hmmm....
<Barabas> it needs more than just that
<dimenus> Barbas: are you on linux or windows?
<dimenus> nvm, windows
<Barabas> linking c seems to mess it up
<Barabas> I updated the issue
ForLoveOfCats has joined #zig
<dimenus> Barabas: what if you just run 'zig test test.zig'?
<Barabas> that works
<dimenus> Barabas: also, what version of zig are you running?
<Barabas> using zig version: 0.5.0+2978785b6
<ForLoveOfCats> When I set `io_mode = .evented` my entire project blew up. https://imgur.com/a/hs2kLLQ It seems to be because the function in question can recurse. Setting `io_mode` back to `.blocking` fixes the issue. I'm running commit c5ca0fe237e105b95c8edb7f80da899012e573f8
<andrewrk> ForLoveOfCats, welcome to dealing with safe recursion
<andrewrk> you are one of the first pioneers
<andrewrk> please note this is still experimental, I've only gotten behavior tests passing with this mode, and not the std lib tests yet. we don't have ci coverage for evented I/O yet
FireFox317 has joined #zig
<adamkowalski> andrewrk: what's the recommended way to deal with runtime polymorphism? Last time I asked, you showed me a few different implementations, I ended up going with fieldParentPointer to be consistent with the standard library. Has anything moved on that point?
<andrewrk> adamkowalski, nothing has moved since then
<adamkowalski> Okay, currently I store a struct of function pointers in the struct which is meant to be polymorphic. But I don't like that because now the struct "knows" it will be used in a polymorphic way. That seems more like a property of the usage site. Is there a way to construct he struct with function pointers there instead and keep the original class unaware of any polymorphism?
<FireFox317> andrewrk, yesterday i tried a bit to get the std --test-evented-io to pass, however i was stuck on the render.zig. It is recursive af and has like 200 callsites for which all the frames have to be heap allocatated. You recommend to do that or something else?
<andrewrk> FireFox317, yep that's a tricky one. I have some ideas on how to solve that. probably other areas would be easier
<FireFox317> okay, will see if I can get some other stuff to pass :)
<shakesoda> for storing totally unknown things is there something preferred over c_void pointers
<shakesoda> my intuition from c points there, but maybe zig has other ideas :)
<Barabas> I see a function of 1700 lines... :/
<andrewrk> shakesoda, you could look at std.Thread.spawn or std.os.dl_iterate_phdr for inspiration
<shakesoda> andrewrk: will do
dimenus has quit [Ping timeout: 240 seconds]
<andrewrk> Barabas, just hope that you never have to edit ir.cpp ;)
<Barabas> I'd probably create 1700 extra functions :D
ForLoveOfCats has quit [Quit: Konversation terminated!]
<fengb> adamkowalski: I hacked this together https://github.com/fengb/zig-closure
<fengb> No idea if it's useful, just a random yak I decided to shave instead of what I should be doing
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
FireFox317 has quit [Ping timeout: 240 seconds]
<daurnimator> fengb: whats wrong with riscv having a minimal set? I've used it :) https://github.com/im-tomu/fomu-workshop/tree/master/riscv-zig-blink
<daurnimator> mikdusan: have a look at git-bug ?
<daurnimator> andrewrk: ^ "open source project that is essentially github issues but decentralized like git, and uses plain text files within source control (not necessarily git) to store the data. but it would also support running an http server with a web interface" git-bug is that
<fengb> Because the core is very minimal and it can easily bifurcate the community
<daurnimator> fengb: for linux there is a minimum supported set
<daurnimator> but also: how would it bifurcate the community?
Xatenev has left #zig [#zig]
<fengb> If every community decides on a different subset
<fengb> Maybe Linux is big enough to drive the "real core"
<daurnimator> fengb: why does it matter?
<daurnimator> fengb: see my link before... the tomu has the *bare minimum* feature set. I just set the cpu features and it all works
<fengb> Distributed binaries. x86 got massive because everything is largely compatible with everything
<fengb> If we have little pockets that each have their own subset, then it'll just fracture the ecosystem and have them competing with each other
<daurnimator> heh. binaries..... my thing above is freestanding and targeting a specific board
<daurnimator> if you're talking about binaries then you're probably talking about on-an-OS.
<daurnimator> in which case you can e.g. assume the linux minimum
<fengb> I think it's amazing for tinkerability of hardware, but I really want RISCV to eat x86's lunch
<daurnimator> I'm not sure if we do it: but the target OS should inform the target baseline cpu feature-set
<andrewrk> daurnimator, that's a good call and we do not do it yet
<andrewrk> llvm's arm cpu features / sub-architectures data is really messy
Barabas has quit [Remote host closed the connection]
nepugia has joined #zig
<pixelherodev> Nice thing about allocators: if you want to limit how much memory a library can use, you can just allocate that max size, set up a fixedbufferallocator using it, and pass that to the library
<andrewrk> arm has a cpu feature called noarm
adamkowalski has quit [Remote host closed the connection]
<pixelherodev> Dare I ask what it does
<pixelherodev> ?
<frmdstryr> Was `std.mem.Compare` moved or deleted?
<frmdstryr> Nvm looks like it's now in std.math
ur5us has quit [Ping timeout: 240 seconds]
<andrewrk> pixelherodev, "Does not support ARM mode execution"
<andrewrk> maybe that means thumb only
<pixelherodev> Why would - but - wat - huh?
<frmdstryr> thumb uses less space
<pixelherodev> What next, NAIL?
<pixelherodev> Then THUMBNAIL as a hybrid ISA?
<andrewrk> yes and all you get is the MOV instruction
<pixelherodev> and FINGER as a balance in performance and size between ARM and THUMB?
<pixelherodev> I mean, MOV is Turing complete :P
<pixelherodev> Someone compiled Doom for it IIRC
<pixelherodev> At least, the x86 version