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/
ky0ko_ has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
_Vi has quit [Ping timeout: 260 seconds]
ur5us has joined #zig
<pixelherodev> Restructured the parser so it's generated at comptime :)
<pixelherodev> `const parser = ziggirat.parsers.llvm9` -> `const parser = ziggirat.parsers.llvm.Lexer(9)`
<pixelherodev> Based on the version, it either `compileError`s or returns a parser with `comptime if`s to distinguish between supported versions
<pixelherodev> Metaprogramming = <3
<pixelherodev> Weird, `willreturn` is a valid attribute in 9 also
<pixelherodev> Just isn't generated by older Zig/LLVM maybe?
return0e_ has joined #zig
return0e has quit [Ping timeout: 256 seconds]
marijnfs has joined #zig
adamkowalski has joined #zig
<adamkowalski> Is there an example of reading from a file by streaming as opposed to reading the whole file at once? Either that or getting an iterator into the characters/lines of a file
marijnfs1 has quit [Ping timeout: 265 seconds]
<pixelherodev> Use use .stream()?
<pixelherodev> `.readUntilDelimiterOrEof("\n")` can be used to read full lines
<pixelherodev> I used to do that for my LLVM lexer before realizing it was easier to just buffer the full file at once
<adamkowalski> Did you allocate the buffer apriori and reuse it or did you allocate while reading the file?
<adamkowalski> also did you worry about memory footprint for reading a whole file at once, rather then just going a little bit at a time and transforming it to the actual data structure you need as you go
<pixelherodev> Previously, the former
<pixelherodev> Allocated a buffer, growing it as needed
<pixelherodev> But there were issues that required better buffering underneath
<pixelherodev> Specifically if you're reading lines, I recommend implementing a separate iterating stream
<pixelherodev> Because if e.g. end of line isn't found, it means you'd have to grow the buffer and keep reading, *but you lose a character when that happens*
<pixelherodev> Alternately, the InStream code should be modified so as not to lose a character when the buffer is full
nephele_ has joined #zig
nephele has quit [Ping timeout: 250 seconds]
<adamkowalski> I guess in my case I know exactly the length of a single line in the file, and each line has the exact same pattern. It's not going to generalize but I suppose it's the fastest way to deal with things in this specific case
<pixelherodev> Reading in the entire file and manually finding positions is simpler, more reliable, and more performant in my experience
<adamkowalski> the file is 100+mb which was my only issue
<adamkowalski> I guess thats still fairly small
<pixelherodev> Ah, that does change things a bit :P
<adamkowalski> Yeah the goal is to take the entire file and convert it to a matrix in memory. so I would end up with 200mb in memory
<adamkowalski> I figured I would allocate the matrix to be 100mb up front, but stream the file into the matrix a line at a time
<adamkowalski> but I guess to make things simpler just read the whole file at once
<Snektron> adamkowalski: what about memory mapping?
<Snektron> It seems the appropriate action here
<adamkowalski> I guess I didn't really think about that
<adamkowalski> are these the docs to use? https://ziglang.org/documentation/master/std/#std;os.mmap
<Snektron> Yes, although i would also recommend the manpage of mmap
<Snektron> Usually youd use `mmap(0, size, PROT_READ, MAP_SHARED, fd, 0)` i believe, with size obtained via seek or stat
<adamkowalski> thanks! I'll try that
<pixelherodev> Hmm, I should see how `mmap` affects performance of the lexer...
<pixelherodev> Thanks for the idea!
<andrewrk> pixelherodev, careful- mmap makes it very difficult to handle errors properly
<andrewrk> you'll get signals rather than error codes
<fengb> Could we have a trap handler that remaps into error codes magically?
<andrewrk> you want to check errors after each memory read/write? in this case just use the read/write syscalls then
nephele_ is now known as nephele
<Snektron> fengb, then you get the zig equivalent of the exceptions-on-signal c++ library a friend of mine was making
<fengb> I can’t tell if that’s a good or terrible thing
<pixelherodev> I don't like that idea
<pixelherodev> andrewrk, good to know, thanks
ky0ko_ has joined #zig
mahmudov has quit [Remote host closed the connection]
rjtobin has quit [Ping timeout: 264 seconds]
<adamkowalski> do we have a string to float function in the standard?
<adamkowalski> std.fmt.parseFloat?
<pixelherodev> No idea
<pixelherodev> I really like tuples for code readability
<pixelherodev> `Lexer(.{ .version = 9, .error_checking = true})` is more annoying to write but much clearer than `Lexer(9, true)`
<pixelherodev> Tells you what the args are at the call-site
reductum has quit [Quit: WeeChat 2.7.1]
<adamkowalski> Yeah it replaces named parameters a lot of the time
<adamkowalski> it also gives you default arguments since you can introspect on the tuple passed in and then check what fields are there
<pixelherodev> Yep
<adamkowalski> What do you think would be the fastest way to read in a csv file to a matrix?
<adamkowalski> I don't know how many rows/columns there are
<adamkowalski> so one approach is to go through the data twice
<adamkowalski> the first time, figure out how many rows/columns there are by counting the number of commas and new lines
<adamkowalski> then make a single allocation with the right size, and go through the data again, actually filling in the matrix
<adamkowalski> a second way is to go through the data only once, and have a dynamically growing arraylist or something. finally called to owned once you finish reading through the data
<adamkowalski> My gut says the single alloction / go through data twice will be faster then growing/copying the data but only going through once
<pixelherodev> Don't trust the gut!
<pixelherodev> Profile!
<pixelherodev> Better yet: implement whichever one is simple, check if it takes too long to run, and *then* optimize *if necessary*
<pixelherodev> s/simple/simpler
<adamkowalski> Yeah you're right, good call
<adamkowalski> I'll do profile guided optimization if it's an issue
<adamkowalski> i'm so close to finishing up the proof of concept of this library and I can finally see if I'm faster then googles tensorflow
<adamkowalski> then I guess I go back and do a more in depth performance pass
<pixelherodev> I was having this discussion elsewhere a few days ago, give me a sec to find my logs
<pixelherodev> Here it is
<pixelherodev> I think the best way to sum up my feelings on optimization: if it runs above a certain baseline speed *on old hardware* (e.g. five seconds for a simple CLI tool, 30FPS for a game, a few milliseconds for a server response), no compiler optimizations should be used. If it runs *below* that, use tools (e.g. callgrind) to find structural improvements. If *that's* not enough, optimizations should be sed *sparingly* (e.g. use *specific*
<pixelherodev> optimization flags that actually affect your specific workload instead of generic -ON)
<pixelherodev> s/sed/used
waleee-cl has quit [Quit: Connection closed for inactivity]
<adamkowalski> Well I agree to a point. You want to avoid coding yourself into a corner where you can't change the design down the road
<adamkowalski> if you're system is fundamentally based around virtual dispatch and object oriented programing, you will never refactor your way to a perforrmant system later
<adamkowalski> especially if your application is 100,000s of lines of code
<pixelherodev> That's why modularity is important
<pixelherodev> If you keep components small and largely independent wherever possible, you can replace them wholesale with different designs later without issue
<adamkowalski> you also wont' get the buyoff from your manager to go back and fix things that are "working" especially if it requires rearchitecting of significant degree
<pixelherodev> That's why OSS is good; you don't *need* approval to make things better
<adamkowalski> yes of course that sounds great in theory, but in practice if you always choose the simplest choice you tend to lead highly coupled systems that are brittled
<adamkowalski> so I think you need to have a mix of upfront planning and design, as well as choosing relatively simple things especially if you can plan a path that will allow your system to change and become faster in the future if needed
<pixelherodev> A good example is the Zig compiler, naturally :)
<adamkowalski> and if you're working on small projects or open source software a lot of that doesn't apply
<pixelherodev> e.g. translate-c has been rewritten in Zig from C++, without requiring significant work in other compiler components
<adamkowalski> but at work we have been maintaining the same codebase for years and it's having systematic performance problems
<adamkowalski> people never cared, and now it's to late
<adamkowalski> they scheduled 2 weeks for performance tuning at the very end of the lifecycle of the product
<adamkowalski> and you can never fix the underlying issues, only get minor efficiencies here and there
<adamkowalski> so I agree with you in theory, but I also think in practice it's more complicated
<pixelherodev> That's not exactly conclusive; I can pull up examples where performance has been massively improved
<adamkowalski> I'm sure you can find evidence going in both directions
<pixelherodev> Exactly
<adamkowalski> however, performance gains of orders of magnitude come from fundamental decisions such as cache utilization, ability to easily parallelize your sytem, ability to leverage simd. Memory layout of your data structures. Avoiding indirection, etc
<adamkowalski> I don't beleive an application that never cared about those things can just refactor their whole codebase to now leverage that
<adamkowalski> if there is mutable shared state everywhere, global variables being used, virtual dispatch, how the hell are you gonna wrangle that
<pixelherodev> One piece at a time.
<pixelherodev> If you don't approach the problem as impossible and instead try to find a way to solve it, it's doable
<pixelherodev> Might take a long time
<pixelherodev> Or a lot of effort
<pixelherodev> but not *impossible*
<adamkowalski> right but the argument is whether it's less effort if you just planned for that in the first place
<pixelherodev> That's not debatable
<pixelherodev> Of course it's much less effort that way
<pixelherodev> The real question is whether it's worth the effort if you *didn't*
<adamkowalski> yeah and there it will depend on the product you're building
<adamkowalski> if it's a web app, probably not
<adamkowalski> if you're building a linear algebra and machine learning toolkit, that will be the determining factor in how long all your analysis will take
<adamkowalski> and whether it's feasble to use it in real time applications
darithorn has quit [Quit: Leaving]
adamkowalski has quit [Quit: Lost terminal]
ur5us has quit [Ping timeout: 252 seconds]
cow-orker has quit [Ping timeout: 265 seconds]
return0e_ has quit [Remote host closed the connection]
return0e_ has joined #zig
return0e_ has quit [Ping timeout: 246 seconds]
return0e has joined #zig
return0e has quit [Remote host closed the connection]
return0e has joined #zig
return0e has quit [Read error: Connection reset by peer]
<ky0ko> so, i'm writing a terminal emulator in zig, and trying to figure out if async/await is a thing that can be useful in that
<ky0ko> i come from an almost pure c background with some erlang knowledge, so my instinct for handling events from both a pty and a display server would be to spin up separate listening threads and send messages from those to a central one, and perhaps also to spin off a thread purely for rendering characters
<ky0ko> could async/await let me manage all these separately without having to spin up threads myself?
<ky0ko> and if so, is there any good code i can read for handling evented i/o + async/await
<ky0ko> the entire concept is somewhat foreign to me
marmotini_ has joined #zig
marmotini_ has quit [Ping timeout: 246 seconds]
lanodan has joined #zig
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
cole-h has quit [Quit: Goodbye]
_Vi has joined #zig
lanodan has quit [Quit: WeeChat 2.7.1]
lanodan has joined #zig
_Vi has quit [Ping timeout: 252 seconds]
marijnfs_ has joined #zig
hio has joined #zig
return0e has joined #zig
marijnfs1 has joined #zig
marijnfs_ has quit [Ping timeout: 240 seconds]
ur5us has joined #zig
frett27 has joined #zig
cow-orker has joined #zig
SimonNa has joined #zig
dermetfan has joined #zig
frett27_ has joined #zig
daex has joined #zig
frett27 has quit [Ping timeout: 240 seconds]
daex_ has quit [Ping timeout: 265 seconds]
mahmudov has joined #zig
marijnfs1 has quit [Ping timeout: 250 seconds]
marijnfs_ has joined #zig
dermetfan has quit [Ping timeout: 252 seconds]
_Vi has joined #zig
<hio> whats the state of ziglang?
<ifreund> pre 1.0, actively developed, growing community
<ifreund> not quite sure what you're asking
mattmurr has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 240 seconds]
mattmurr has joined #zig
<mps> andrewrk: I pushed new zig package to alpine, built with llvm10
<mps> all looks fine with some simple tests, I don't have big or complicated ones
dermetfan has joined #zig
<daurnimator> mps: a good simple test would be: cd $(mktemp -d) && zig init-exe && zig build run
<mps> daurnimator: build zig by zig?
<ifreund> that just autocreates a hello world, then builds and runs it
<mps> ifreund: ah, I used some of my not much complicated C programs for test. thanks for explanation
Snetry has quit [Quit: left Freenode]
Snetry has joined #zig
mps has quit [Ping timeout: 268 seconds]
mps has joined #zig
marijnfs1 has joined #zig
marijnfs_ has quit [Ping timeout: 240 seconds]
r4pr0n has joined #zig
mattmurr has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
mattmurr has joined #zig
frett27_ has quit [Ping timeout: 246 seconds]
dddddd has joined #zig
frett27_ has joined #zig
dermetfan has quit [Ping timeout: 246 seconds]
Dominic[m] has left #zig ["Kicked by @appservice-irc:matrix.org : Idle for 30+ days"]
_whitelogger has joined #zig
nephele has joined #zig
tralamazza has joined #zig
hryx has joined #zig
slowtyper has quit [Quit: WeeChat 2.7.1]
slowtyper has joined #zig
riba has joined #zig
SimonNa has quit [Remote host closed the connection]
<fengb> "However, as we learned above, futures do nothing until they are polled."
<fengb> I know nothing about Rust async / futures... but doesn't requiring polling make this less performant than what Zig is doing?
<companion_cube> no, polling is only done by a wakener
<companion_cube> and futures are encoded as a sum type (a state machine, really)
Kumool has joined #zig
Kumool has left #zig ["Ploop"]
slowtyper has quit [Quit: WeeChat 2.7.1]
marijnfs_ has joined #zig
marijnfs1 has quit [Ping timeout: 240 seconds]
riba has quit [Read error: Connection reset by peer]
chivay has quit [Remote host closed the connection]
scientes has quit [Quit: ZNC 1.7.5+deb1 - https://znc.in]
JX7P has quit [Ping timeout: 246 seconds]
chivay has joined #zig
nia has quit [Ping timeout: 256 seconds]
APic has quit [Ping timeout: 260 seconds]
rom1504 has quit [Ping timeout: 256 seconds]
APic has joined #zig
ArtifTh has quit [Ping timeout: 240 seconds]
return0e has quit [Remote host closed the connection]
riba has joined #zig
marijnfs_ has quit [Ping timeout: 240 seconds]
return0e has joined #zig
marijnfs_ has joined #zig
nia has joined #zig
cole-h has joined #zig
marijnfs_ has quit [Quit: leaving]
riba has quit [Ping timeout: 256 seconds]
backwhack has quit [*.net *.split]
WilhelmVonWeiner has quit [*.net *.split]
backwhack has joined #zig
WilhelmVonWeiner has joined #zig
suppi has quit [Ping timeout: 264 seconds]
BitPuffin has quit [Ping timeout: 240 seconds]
sammich has quit [Ping timeout: 240 seconds]
ifreund[m] has quit [Ping timeout: 246 seconds]
jzck has quit [Ping timeout: 246 seconds]
alva has quit [Ping timeout: 240 seconds]
hryx has quit [Ping timeout: 246 seconds]
Snektron has quit [Ping timeout: 256 seconds]
pltrz has quit [Ping timeout: 256 seconds]
pmwhite has quit [Ping timeout: 260 seconds]
BaroqueLarouche has quit [Ping timeout: 260 seconds]
afontain_ has quit [Ping timeout: 260 seconds]
dtz has quit [Ping timeout: 260 seconds]
AlexMax has quit [Ping timeout: 260 seconds]
fengb has quit [Ping timeout: 260 seconds]
ianc6209 has quit [Ping timeout: 260 seconds]
jzelinskie[m] has quit [Ping timeout: 272 seconds]
watzon has quit [Ping timeout: 272 seconds]
rom1504 has joined #zig
marijnfs_ has joined #zig
return0e has quit [Remote host closed the connection]
return0e has joined #zig
TheLemonMan has joined #zig
<TheLemonMan> nia, are you interested in some more porting work?
AlexMax has joined #zig
Akuli has joined #zig
BitPuffin has joined #zig
afontain_ has joined #zig
dtz has joined #zig
alva has joined #zig
pltrz has joined #zig
pmwhite has joined #zig
ifreund[m] has joined #zig
ianc6209 has joined #zig
Snektron has joined #zig
jzck has joined #zig
fengb has joined #zig
sammich has joined #zig
BaroqueLarouche has joined #zig
hryx has joined #zig
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dermetfan has joined #zig
FireFox317 has joined #zig
<andrewrk> fengb, I think you should open an issue for https://gist.github.com/fengb/f0bfe5b1be6612db727a49dd63aeddaa because I keep not getting around to looking at it
<andrewrk> release in 2 weeks, it's crunch time for me
<fengb> Sure
<fengb> Good luck!
<ikskuh> andrewrk: go go go!
JX7P has joined #zig
<shakesoda> andrewrk: i believe in you!
<fengb> I’m really grateful how consistent and simple Zig’s syntax is
<diginet> syntax design is really really hard to get right IMO and really underappreciated as a skill
<diginet> so many languages have it as an afterthought
<fengb> I get really frustrated at Ruby like syntax in general. People often prefer “looks nice” instead of “unambiguous”
jjido has joined #zig
<companion_cube> and yet zig doesn't have mandatory `{}` :(
marijnfs1 has joined #zig
marijnfs_ has quit [Ping timeout: 265 seconds]
<andrewrk> mandatory braces for what?
<companion_cube> if/while
<andrewrk> ah that old thing. zig doesn't have any of the associated problems though
<diginet> how does it resolve dangling else?
<diginet> I guess dangling else isn't really a problem with PEG
<diginet> what with ordered choice
<fengb> Braces isn’t ever a problem with the parser
<companion_cube> it's a problem with the reader though
<fengb> It’s people misinterpreting it
<fengb> Yeah, it’s internally consistent
<diginet> I like the way algol 68 resolves dangling else
<andrewrk> the compile error for inconsistent whitespace isn't implemented yet
<andrewrk> that can happen in self-hosted now though. zig fmt should reject rather than reformat
<companion_cube> I still don't get why not take the simpler, cleaner way of mandatory braces
<companion_cube> :p
<companion_cube> more readable without `zig fmt`, as readable with it, not longer, more uniform
<fengb> But I like zig fmt keeping me lazy :(
<andrewrk> it's not simpler though, it would require breaking all the rest of the syntax
marijnfs1 has quit [Ping timeout: 260 seconds]
<diginet> andrewrk: how does it resolves the ambiguity of dangling else though? is it like I said, just ordered choice in the PEG?
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<andrewrk> fengb, I'm talking about only when the whitespace makes it look like an if body has 2 lines but actually it's 1
<companion_cube> andrewrk: it's simpler because you don't have the distinction "if with atomic body" vs "if with composite body"
<companion_cube> from the reader's perspective at least
<diginet> I guess he can't see me?
<shakesoda> why would zig actually care about whitespace consistency in the compiler (fmt should care)?
<andrewrk> diginet, the grammar is specified and unambiguous
<shakesoda> i'm not aware of whitespace having any meaning in the syntax
<andrewrk> "dangling else" is not a real problem
<companion_cube> the compiler shoudl accept anything within the grammar, even badly formatted
<companion_cube> otherwise the grammar must be updated :p
<diginet> andrewrk: it is inherently ambiguous in a non-PEG CFG
<shakesoda> I generally also support mandatory {} on if and loops
<andrewrk> zig's grammar is specified with PEG
<diginet> since there are two parse trees
<andrewrk> it's been planned since forever https://github.com/ziglang/zig/issues/35
<companion_cube> shakesoda: and switch
<diginet> no I know I'm not saying it's ambiguous in the formalism zig has adopted, I just wouldn't agree it's not a problem, simpliciter
<shakesoda> companion_cube: ...they're optional on switch?
<companion_cube> you still have to () the argument right?
<fengb> Mandatory {} on ifs break our current ternaries
<andrewrk> ^ this is my point, you can't make this change without cascading syntactical consequences
<shakesoda> I see
<andrewrk> ergo it's not simpler
<pixelherodev> ``Mandatory {} on ifs break our current ternaries` Yeah, it'd break like every file I've written :P
<diginet> I do kind of agree that pascal/C-style bracing is conceptually simpler
<fengb> I’d be fine with loops though
Yardanico has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<companion_cube> it's not like zig is post 1.0 :)
<shakesoda> maybe just non-ternary ifs should spew a warning if they aren't braced or something
<diginet> if/while/etc modify the statement they precede, whether that's a simple or compound statement
Yardanico has joined #zig
<shakesoda> i'm not sure why on earth style issues would be a compile error though
<shakesoda> wrt #35
<TheLemonMan> diginet, are you INetBrowser on github?
<diginet> TheLemonMan: no, why?
<diginet> I'm not on GH
<TheLemonMan> the /inet/ part heh
<diginet> oh lmfao
<diginet> TheLemonMan: my nick is from a previous obsession I had with DECnet
<shakesoda> becoming whitespace sensitive like that just makes it more frustrating of a language
Yardanico has quit [Client Quit]
<andrewrk> the only thing #35 is going to do is prevent bugs, nothing else
<shakesoda> and for aesthetics, zig fmt fixes it anyways
<TheLemonMan> rip DEC{,net}
<pixelherodev> Personally, I dislike the enforced style, but I'm okay with that
<pixelherodev> Means not having to deal with style arguments repeatedly on every repo :P
<andrewrk> it doesn't enforce style; it only detects when you made a mistake
Yardanico has joined #zig
<pixelherodev> I mean e.g. tabs / spaces and such
<pixelherodev> "whitespace sensitive"
<andrewrk> unless your style is *outdenting* on purpose. I have never seen anyone ever do this
return0e_ has joined #zig
<dermetfan> andrewrk: Did I understand correctly that you don't want "rust-style" `if x {} else {}` because it would break `if (x) a else b`? Could we not do `if x { a } else { b }`? Or is that not okay because it would look like blocks, which are not expressions in Zig?
return0e has quit [Ping timeout: 252 seconds]
Yardanico has quit [Client Quit]
<companion_cube> :( right
Yardanico has joined #zig
<andrewrk> dermetfan, now we're talking about optional semicolons and multiple ways to return things from blocks. this is what I mean about cascading syntactical consequences
<shakesoda> andrewrk: i've seen boatloads of people do exactly that, and it also makes some fun ioccc-type stuff impossible although that might not be considered a bug
<pixelherodev> Isn't `break value;` already usable?
<pixelherodev> Or is that only usable with labelled blocks?
<shakesoda> i think it's the compilers business to warn about it, but not to stop you when it's just bad whitespace
<pixelherodev> s/labelled/labeled
<andrewrk> there's also the problem that `foo{` looks like array or struct initialization
<pixelherodev> I mean e.g. `const foo = if (bar) {break a;} else {break b;};` <- what are the problems with that?
<andrewrk> let's take a step back. what is the actual problem being solved? the problem is not "get rid of the parens". what is the actual problem?
<companion_cube> get the syntax closer to rust's because I'm whiny
<pixelherodev> ...
* pixelherodev facepalms
<pixelherodev> I don't like any proposal where the justification is "make it more like language X"
<fengb> Rust is the problem. /flameon
<companion_cube> 😂
<companion_cube> pixelherodev: tbh it's because I think rust's syntax is objectively better on certain points
<companion_cube> but andrewrk is right, there's some cascading consequences
<pixelherodev> If you wanted to say "language X does it because Y, which due to Z is valid reasoning for Zig as well" I wouldn't object
<pixelherodev> but unless you can explain *why* it's better it's not sufficient
<companion_cube> sure!
<andrewrk> yeah I think companion_cube was being self-aware there :)
<pixelherodev> Self-awareness is always nice
<companion_cube> rust's syntax is both safe by default (no dangling else/goto fail), while being as concise. Besides it embraces being an expression oriented language by making blocks expressions in a natural way.
<companion_cube> andrewrk: ;-)
<andrewrk> alright I just pushed a commit to master branch that is probably going to piss everybody off, sorry about that. API deprecations for the upcoming release. A bunch of new compile errors for everybody to solve
<pixelherodev> *Yes*!
<pixelherodev> I'm ecstatic!
<pixelherodev> That means I can take care of it now instead of moving to 0.6 and being like "Wait, what just happened??!!"
<pixelherodev> If you're deprecating something, I trust you have a good reason for it
<pixelherodev> To make things even better, I only need to update my PC's zig build, not my laptop's :D
<pixelherodev> Huh, I just realized I haven't been building Zig with my system CFLAGS
<pixelherodev> Going to try doing so and benchmark it using compile times :)
<TheLemonMan> don't forget to add -funroll-loops
<shakesoda> andrewrk: "the people are arguing about syntax again! quick, break API to distract them!"
<pixelherodev> ... why would I do that?
<shakesoda> :D
<pixelherodev> :P
<pixelherodev> TheLemonMan, was that serious or sarcastic?
<shakesoda> i have never once in my life read that flag as anything but "fun roll"
<pixelherodev> lol
<pixelherodev> My CFLAGS though contains e.g. `--param "l1-cache-size=64" -march=broadwell -falign-functions=32 -mtune=broadwell -pipe -fgraphite-identity -floop-nest-optimize`
<pixelherodev> Stuff that I'm fairly sure *actually* affects performance
<pixelherodev> Not just stuff random internet people say will do so
<TheLemonMan> pixelherodev, come on, you're making me feel old! Don't you know of https://www.shlomifish.org/humour/by-others/funroll-loops/Gentoo-is-Rice.html ?
<pixelherodev> I've seen parts of that elsewhere, but I've never seen that specific link :P
<BaroqueLarouche> TheLemonMan: oh man I haven't seen that page in years, thanks for the memories #AlsoOld
<fengb> I used Gentoo 18 years ago. Damn I’m old
<fengb> There’s been more time AG than BG :/
<pixelherodev> Why I use Gentoo: my PC boots up in <3 seconds
<fengb> Heart seconds?
<andrewrk> in november will be my 20th year anniversary as a programmer
<pixelherodev> less than three seconds
<pixelherodev> :P
<pixelherodev> Happy anniversary!
<andrewrk> ?? I said in november
<fengb> I’m kinda sad I grew up in the 90s. Dark times for software tinkering :(
<shakesoda> fengb: was it? i did a heck of a lot of tinkering with software in late 90s
<andrewrk> IMO it's only gotten better
<pixelherodev> Happy *early* anniversary!
<pixelherodev> :P
<pixelherodev> Hmm
<shakesoda> andrewrk: meanwhile, on apple
<fengb> 80s has Apple 2s and Commodores and stuff, and 2000s was Linux
<andrewrk> what you are seeing are all the opportunities that existed in the 80s that we are now aware of
<pixelherodev> When building Zig with optimizations (only tweak was adding `-O2`), I get "Error: values may be uninitialized" in analysis :(
<fengb> We were on Wintel so I basically couldn’t do anything other than read books
<andrewrk> but opportunities are all around us today, it's just harder to see them when they are contemporary
<pixelherodev> and bigint
<shakesoda> i'm annoyed at all the platforms around that it seems are actively designed to not be programmed
<shakesoda> this isn't a new problem, to be sure
<BaroqueLarouche> I remember asking people older than me for copies of Visual Studio .NET 2002 to do C# with WYSIWYG GUI environment
<TheLemonMan> the '90 had java!
<fengb> Not for a kid
<fengb> You can’t just download a good tool chain on 56k
<andrewrk> my parents allowed me 1 hour per day of any electronic entertainment including computers
<companion_cube> mine, 3h a week…
<andrewrk> ouch
<andrewrk> I was a sneaky son of a bitch tho
<pixelherodev> One of the errors is wrong, too :(
<fengb> Screens will rot your brain
<shakesoda> i had some limitation placed that i ignored anyways so i don't remember it
<companion_cube> when I got to univ and got my laptop and a decent internet connection, it was mad though :D
<shakesoda> none could stop me from messing with machines all the time
<pltrz> andrewrk: same! and shared the family PC with my two siblings. but I cheated the system
<fengb> Ah yeah, I played the shit out of Diablo 2 at school
<fengb> Maybe I should have studied harder or socialized instead
<pixelherodev> Noo, socializm is bad!
<pixelherodev> :P
<pltrz> lol, we had a kitchen timer to time how long we had left on the screen
<shakesoda> fengb: nonsense
<fengb> lol
<fengb> shakesoda: my college years prepares me for this shut in
<fengb> I feel weird telling my coworkers that this quarantine hasn’t affected me at all...
<pltrz> I busted open the kitchen timer, which was spring-loaded and loosened the spring to make 1h be longer than 1h
<shakesoda> heh, yeah, it's all life as usual for me too
<pltrz> and put it back together
<pixelherodev> Nice
<andrewrk> amazing. I never would have thought of that
<shakesoda> except now if anyone goes anywhere, they are contaminated and not to be trusted upon their return
<fengb> They’re busy trying to collect puzzles to not go insane. Meanwhile all my hobbies are already at home
<shakesoda> instead of just regularly not to be trusted because they're other people
<TheLemonMan> the time bender
<pixelherodev> Cleaning up the warnings/errors, probably going to send a patch
<pltrz> lol. good times.
<fengb> I haven’t upgraded yet. Home brew needs to catch up >_>
<pltrz> and the only game I had - which was fcking amazing - was Age of Empires
<pltrz> what an amazing game
jjido has joined #zig
<pixelherodev> andrewrk, is it a problem if I send a patch which changes an initalization to `=NULL` when that does absolutely nothing except convince the compiler it's initialized later on?
<pixelherodev> It *is* being initialized by a switch statement
<pixelherodev> (Either initialized or the function returns)
<pixelherodev> But the compiler incorrectly thinks it isn't
<fengb> Anyone else think that the Z suffix makes things look cooler?
<BaroqueLarouche> it does
<shakesoda> pltrz: there was a notable period of time where I pretty much just had The Sims (+simcity)
<shakesoda> so many hours... so very many
<fengb> `inotify_add_watchC` looks lame but `inotify_add_watchZ` looks badass
<pixelherodev> Better yet, going to actually switch the mode from debug instead of hacking the CFLAGS :P
<fengb> World of Warcraft for me >_>
<fengb> Had my college buddies drag me in. I resisted for a good long time
<TheLemonMan> the next step is using 1337speak for identifiers, 1n071fy_add_w4tchZ is even cooler
<fengb> Honestly... if I didn't get a girlfriend, I'd probably still be playing lol
<shakesoda> WoW is one of the few MMOs i could never bring myself to like
<shakesoda> slightly odd, because I rather like most of them (especially unusual or bad ones)
<pltrz> I remember somebody I knew always played Warcraft (not WoW) and I always wanted to play - looked fun as hell
<fengb> I liked Warcraft 3 as well. RIP Blizzard :(
<pixelherodev> Only MMOs I've really played are Lord of the Rings Online and Dungeons and Dragons Online (because I have a Tolkien obsession :P)
<pltrz> pixelherodev: same with the Tolkien obsession!
<pltrz> lol, my dad's also a huge tolkien fan and I watched LoTR with him at wayyy too young an age hahaha
<pixelherodev> I watched all three extended editions at, like, 7?
<pixelherodev> Read them all shortly thereafter
<pltrz> non-extended edition was not allowed in my household
marijnfs_ has joined #zig
<pltrz> yeah same hahaha
<pltrz> only read the books much later though, only a few years ago for the first time. and oh boy was that amazing. I mean, the movies are already top-notch, but the books just take it to a whole new level
FireFox317 has quit [Quit: Leaving]
oats has quit [Quit: until later, my friends]
riba has joined #zig
ur5us has joined #zig
<pixelherodev> Benchmarks coming along; should have some good info within the hour
riba has quit [Read error: Connection reset by peer]
mps has left #zig [#zig]
oats has joined #zig
riba has joined #zig
<pixelherodev> Testing out combinations of `-falign-functions=32`, Graphite, LTO, `-march=native`, etc
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
return0e has joined #zig
wootehfoot has joined #zig
<pixelherodev> Well this is just odd
<pixelherodev> Graphite and `-march=native` on their own both give similar boosts (though Graphite is slightly slightly better)
<pixelherodev> Put them together and it's about the same as just `-march=native`
<ikskuh> Graphite?
<ikskuh> sounds crazy
<pixelherodev> tl;dr: transforms loops into matrix representation, which allows for low-cost loop transforms
<pixelherodev> Further testing shows that there's a very very slight boost with both over just Graphite, but it's within the margin of error
<pixelherodev> I'm basically running a fresh compilation of my project five times with each compilation to see differences
<pixelherodev> So, not the most scientific out there, but it should be sufficient at least for *my* use
<pixelherodev> Now to try LTO :P
<ikskuh> LTO is quite awesome
<pixelherodev> Opened a tiny PR to fix a ODR violation
<pixelherodev> I might take time to clean up any compiler warnings in a few days when I have a bit more time
<pixelherodev> I'm already spending a lot of time benchmarking, I also have actual work to do :P
<pixelherodev> LTO seems to only barely improve performance (literally by ~30ms at best out of ~5s, well within the margin of error too)
<pixelherodev> Still got ~5 configs left to test with LTO though (that was just LTO+Graphite+march=native)
jmiven has quit [Quit: reboot]
jmiven has joined #zig
FireFox317 has joined #zig
jonathon has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
ur5us has quit [Ping timeout: 240 seconds]
jonathon has joined #zig
<wootehfoot> how much do you get out of graphite?'
<pixelherodev> Slightly more than I get out of `-march=native`
<pixelherodev> Default flags: ~5.15s -march=native: 0m4.815s Graphite: 0m4.781s
<pixelherodev> Graphite seems great on its own, but also seems to greatly interfere with other optimizations
riba has quit [Ping timeout: 256 seconds]
<pixelherodev> s/greatly// s/other/some other/
<andrewrk> TheLemonMan, have you seen https://github.com/ziglang/bootstrap ?
<andrewrk> this seems related to your interests
<pixelherodev> In an abstract manner, how does incremental compilation work?
<pixelherodev> You've mentioned that it's intended to use that eventually
<pixelherodev> I'm not asking how it'll be implemented, but what's the general abstract idea of how that sorta thing would work?
<andrewrk> pixelherodev, imagine that you have spent 10 hours compiling a game that has a 5 GiB executable file
<andrewrk> and now you go update a single global constant, you bump `gravity` from 9.8 to 9.81
<BaroqueLarouche> sounds like compiling Unreal Engine from source
<andrewrk> in theory, the compiler should be able to simply write 4 bytes of data (the updated f32) into the output executable, and be done. it should take milliseconds at most
<pixelherodev> Right, but I mean in an abstract way, what would you be doing?
<pixelherodev> That is, if I update a single line, how would a compiler detect what portions need to be recompiled?
<andrewrk> now your question is getting into "what are some ways to design incremental compilers?"
<pixelherodev> Especially with e.g. constant folding?
<pixelherodev> True
<andrewrk> there's a rust core dev who has a nice video on this
<FireFox317> andrewrk, damn that looks close to bootstrapping zig to `arm-linux-musleabihf`
ur5us has joined #zig
<andrewrk> yeah it's quite close
<andrewrk> I'm not sure what that c++ linker error is. you want to go ask #llvm and try to find out?
<companion_cube> https://github.com/ziglang/bootstrap <--- zig has a css framework now? 🙃
<mikdusan1> first guess: "typeinfo for ..." something was compiled with RTTI when it shouldn't have been
<FireFox317> andrewrk, I could. But I'm quite new to all this bootstrapping stuff xd
<pixelherodev> Best result in terms of balancing compile times / compiler speed is Graphite+`-march=native` and that's *it*
<FireFox317> ah mikdusan1, that's a good clue indeed
<pixelherodev> Selective optimizations (e.g. LTO) can provide *tiny* boosts to compiler speed (not even 100ms no matter what combination was tried on a compilation that already takes ~4.7 seconds) but can easily spike up compile time of the compiler
ifreund has quit [Ping timeout: 256 seconds]
<pixelherodev> Tried approximately *13* different combinations and that was in the top 3 in terms of how long it takes to build and in terms of compiler performance
<pixelherodev> I just wasted... 100 minutes?
<pixelherodev> You're welcome
<pixelherodev> :P
<andrewrk> ziglang/bootstrap could be a fun place for contributors because there is a lot there that should work in theory but doesn't in practice, and if you can track it down, leads to useful, small, easy to merge improvements
SimonNa has joined #zig
FireFox317 has quit [Remote host closed the connection]
FireFox317 has joined #zig
<andrewrk> mikdusan1, hmm, these things are on by default for c++ right?
<mikdusan1> yes. usually need to opt-out `-fno-rtti` and `-fno-exceptions`
<pixelherodev> I use those no matter what platform I'm working on :P
<pixelherodev> I dislike both RTTI and exceptions even where they're available in C++
<FireFox317> andrewrk, can't we just disable this yaml-bench utility?
<FireFox317> not build*
<andrewrk> FireFox317, yep, if you can figure out what cmake option that is, slap it in the build script
jjido has joined #zig
<andrewrk> one of the goals is to not need to patch llvm/clang/lld. however if we send a patch upstream and it gets accepted, we can carry it until the next version comes out
<andrewrk> the only thing we need to build, for both native and cross llvm/lld/clang, is the stuff in include/ and lib/.
<FireFox317> but maybe some other llvm-utilities are needed and could have the same problem actually. i'm gonna play with it a bit
<andrewrk> I believe the only required utility is TableGen
<andrewrk> actually, that one is only needed for native though
<andrewrk> hm there's no option to disable utils though
<andrewrk> FireFox317, actually I found the undocumented -DLLVM_INCLUDE_UTILS. also I realized that it as well as -DLLVM_INCLUDE_TOOLS can be set to OFF for the cross build. I got past that error for arm
<andrewrk> one thing that took me a while to figure out: for llvm they do some weird cmake generation thing, so if you change the cmake line you have to `rm -rf cmake/ CMakeCache.txt`. This is a llvm-specific workaround
<FireFox317> andrewrk, I was also wondering why the first command in the build script takes so very long. I build llvm/clang/lld from source before and i had a feeling that it went much faster.
<andrewrk> which command?
<FireFox317> building llvm,clang and lld for native os
<FireFox317> first cmake/make basically
<andrewrk> I don't know what to tell you there - that's just what it takes to build from source on your native system
<andrewrk> zig hasn't entered into the equation yet
<pixelherodev> Different compiler flags?
<pixelherodev> Different job count to `make`?
<FireFox317> yeah i know it's not zig. i was probably compiling without -j8 or something
<pixelherodev> `-j*8*`? Nice
<fengb> I'm at -j12. Ryzen should be at j64 probably
<TheLemonMan> if you put `-j` it'll automagically pick the number of cores available
<andrewrk> don't do it, he's trolling
<andrewrk> it'll actually fork bomb your system
<TheLemonMan> eh?
<andrewrk> last time I checked, which was admittedly many years ago, -j has no limit; no pooling; it just makes as many jobs as it can
marijnfs1 has joined #zig
<andrewrk> pretty much guaranteed to halt your system
<ikskuh> what andrewrk says
<pixelherodev> Not *my* system
<ikskuh> also -j128 should be enough :D
<fengb> `alias m8ke="make -j $(nproc all)"`
<pixelherodev> I mean, I'm definitely testing it
<TheLemonMan> if you don't have resource limits set up it's not my fault
<pixelherodev> But I'm fairly certain it should work fine
<pixelherodev> (I run a patched kernel with a different scheduler)
<fengb> Or die trying
<Snektron> make -j16 is a good feeling
<ikskuh> damn, i'm losing a value between zig and C
<pixelherodev> fengb, nproc --all
<pixelherodev> Not nproc all
<Snektron> ninja by default even schedules n_threads+2
<pixelherodev> I think
<pixelherodev> Wait it does?
<pixelherodev> Huh
<pixelherodev> I should stop overriding it...
<andrewrk> anyway FireFox317 arm-linux-musleabihf got to the part where it runs cmake for zig! now just need to figure out why it fails to detect clang and lld
<fengb> Ah yeah it's --. I don't test on Linux like I probably should :P
<andrewrk> FireFox317, oh. ok. apparently disabling that cmake stuff made lld and clang not get built. no wonder it "worked"
<fengb> At one point I had a Linuxbox synced with my aliases so I vaguely cared
<andrewrk> another interesting data point- aarch64-linux-musl seems to have regressed, with the same compile error as arm-
<fengb> I don't know why but ninja runs ~5% slower on building zig so I switched back
<ikskuh> can somebody take a quick peek if i found a miscompilation or if i'm just stupid: https://gist.github.com/MasterQ32/0b7f59e1df38ab83b13994fcd1905e46
<fengb> Hmm, it's a little annoying converting arrays to multipointers now :(
<andrewrk> what changed?
<fengb> I used to do `foo[0..].ptr`
<fengb> But that no longer gives me a slice, and `.ptr` doesn't work yet
<TheLemonMan> ikskuh, check with a debugger and hexdump the value received by the C code, dunstblick_Value layout may be wrong on the Zig side
<pixelherodev> fengb, what platform?
<pixelherodev> `ninja runs ~5% slower`
<andrewrk> fengb, what happens if you do `foo` instead of `foo[0..].ptr`
<fengb> Mac
<pixelherodev> Ah, so Not My Problem TM
<pixelherodev> :P
<fengb> `error: incompatible types: '[*]const u8' and '*[8192]u8'`
<fengb> `note: type '*[8192]u8' here — return self.dyn.ram[0..] + (addr - 0xE000);`
<andrewrk> I might have just fixed that in b980568c810f today
<fengb> Oh I'll just wait then
<fengb> I need to get rid of these multipointers. Such a hack
<andrewrk> fengb, ok it's not fixed by that commit but I opened https://github.com/ziglang/zig/issues/4865 for it
<fengb> Thanks
<andrewrk> mikdusan1, I wonder if it has to do with propagating no_rtti and no_exceptions to child codegen instances
<marijnfs1> is heap.page_allocator the kind of most common allocator now?
<marijnfs1> direct_allocator is gone right?
<andrewrk> direct_allocator was always page_allocator
<andrewrk> it's not a good general purpose allocator. zig doesn't currently have a good general purpose allocator in the std lib
<andrewrk> it's kind of amazing how much we've gotten by without one
<fengb> Use more arenas!
<andrewrk> a reasonable workaround for now is to link against libc and use std.heap.c_allocator. https://ziglang.org/documentation/master/#Choosing-an-Allocator
<marijnfs1> andrewrk: yeah i mean it works for me, what else would you recommend
<ikskuh> TheLemonMan, updated the gist with some infos
<ikskuh> looks like the union is misaligned
<ikskuh> arch is x86_64
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Akuli has quit [Quit: Leaving]
<TheLemonMan> yeah, what's the @alignOf of the inner unnamed union?
<ikskuh> in zig or C or both? :D
<TheLemonMan> in Zig
<ikskuh> 8
<ikskuh> .type is 4
frett27_ has quit [Ping timeout: 252 seconds]
<TheLemonMan> hmm, can you try to initialize the structure at runtime?
<ikskuh> is it enough to put "var" in front of it?
<TheLemonMan> `var val: c.dunstblick_Value = undefined` and then val.type = ...
<ikskuh> works
<TheLemonMan> eh, it's just the good old issue with comptime-known initializers
<ikskuh> ah, good to know
<ikskuh> what issue should i subscribe to get an update when it works? :D
<TheLemonMan> #4295 maybe
<ikskuh> thanks :)
<ikskuh> funky thing is that the pointer is aligned right :D
<TheLemonMan> yeah the problem is that the structure layout is computed 3-4 times in different places
<ikskuh> oh well :D
<ikskuh> yeah, i've looked at the packed struct code one day
<ikskuh> and it was really confusing
<TheLemonMan> but now the real question is... where is mq32?
<ikskuh> TheLemonMan: that's me actually *grin*
<ikskuh> this was the last chat(server) i used this nick
<ikskuh> as "xq" is taken on freenode by someone else
<TheLemonMan> hah I was so confused when I looked at the gist username
<ikskuh> ah, sorry :D
<ikskuh> i now own both of the nicks on freenode ^^
<FireFox317> andrewrk, i guess its also better to enable the utilities to build, such that we test our `zig c++` integration
<TheLemonMan> and I've just realized that ikskuh is the phonetic spelling of xq
<ikskuh> yep :D
<ikskuh> i'm a bit proud of that nickname… :D
<andrewrk> FireFox317, I think I fixed it, by reverting a recent change to master branch
<FireFox317> ah cool! :)
<andrewrk> https://clbin.com/CzhAm I thought I was being clever by forwarding -fno-rtti -fno-exceptions to libc++, libunwind, etc
<andrewrk> but the simpler thing of passing these flags without paying attention is what works
<andrewrk> now it will probably fail to compile stage1 c++ code due to my own sloppy coding with regards to 32 vs 64 bits
<andrewrk> it may be worth fixing though because part of the purpose of stage1 is to have a large set of host platforms for bootstrapping purposes
jzck has quit [Quit: Idle for 30+ days]
<andrewrk> even though in this case, it's the cross compilation target
<pixelherodev> Anyone know of a Zig-compatible BigInt library? Whether in C or Zig
<TheLemonMan> std.int ?
<fengb> Zig has bigint in std
<TheLemonMan> err, std.math.big.int
<fengb> Is bigint math, or is it just is? 🤔
<andrewrk> you can also link against gmp easily enough
<pixelherodev> Oh!
<pixelherodev> Didn't realize there was std.math.big.int
<fengb> Random question: am I supposed to use mem.readInt{Slice} with floats?
<pixelherodev> s/std/zag
<pixelherodev> That's perfect
<fengb> zugzug
<pixelherodev> If you look at my projects you'll see I actually use `const zag = @import("std");` :P
<pixelherodev> Probably shouldn't if a) I want to attract contributors and b) nobody else does this
<andrewrk> it's cute but it also makes me face palm
<fengb> And c) nobody else writes a library named zag
<pixelherodev> In my defense
<pixelherodev> andrewrk, you're the one that made me think of it
<pixelherodev> I was only referring to it as zag in IRC/GitHub
<pixelherodev> but you thought I was doing it
<pixelherodev> So I started doing it :P
<andrewrk> FireFox317, this gets us to lld: error: undefined symbol: __clear_cache. Here's the code for that: https://github.com/ziglang/zig/blob/cfedd3aca286881510e4a298756d4a5676e22137/lib/std/special/compiler_rt/clear_cache.zig#L47-L75
<Snektron> <andrewrk "it's not a good general purpose "> that reminds me, i still gotta do that mremap thing
<andrewrk> do you want to have a go? it's ported from LLVM's compiler_rt, you can see the source lines up exactly
<FireFox317> andrewrk, yeah sure will try that.
<Snektron> i worked on it briefly, i think i had a working implementation, except i didn't know how to proceed with testing
<Snektron> andrewrk, how do i test whether allocation is correct?
<Snektron> i mean the implementation of an allocator
<andrewrk> Snektron, there are some allocator tests in the std lib but nothing that is really good. it would be sweet for a contributor to make a third party project which is an exhaustive testing suite for zig allocator implementations
<andrewrk> my general-purpose-debug-allocator has a rudimentary fuzz tester you can run
r4pr0n has quit [Quit: r4pr0n]
<Snektron> Would it not make sense to implement that as a first-party thing?
<Snektron> Looking though the testing code... how does it check whether a test has paniced?
<pixelherodev> How would an allocator tester even *work*?
<pixelherodev> You can test the exposed values, sure
<pixelherodev> e.g. allocations / frees
<pixelherodev> But any internal testing is extremely allocator-specific
<Snektron> Yeah thats true. I can imagine a few generic tests though
<andrewrk> a general purpose allocator fuzz tester would be quite useful
<Snektron> You could keep track of the state and verify what happens on eg a double free, although i guess that depends on allocator
<andrewrk> some fuzz testers even can notice when branches are taken and use that to inform inputs
<andrewrk> inputs being a series of allocate / reallocate / free requests
<Snektron> you could also launch a child process and trace its memory accesses
<andrewrk> FireFox317, one more thing you might not notice: will need to enable it here https://github.com/ziglang/zig/blob/cfedd3aca286881510e4a298756d4a5676e22137/lib/std/special/compiler_rt.zig#L14-L15
<Snektron> Anyway, for now i'll just try to implement it on latest master and use the current tests i suppose
<andrewrk> I don't think it makes sense to run full fuzz tests on CI commits
<andrewrk> not as part of the regular pipeline anyway
<andrewrk> maybe once a week or something
<Snektron> i mean the mremap part
hio has quit [Quit: Connection closed for inactivity]
<andrewrk> FireFox317, for the asm you should be able to look at the inline assembly from linux syscalls as a template
<FireFox317> andrewrk, yeah figured that out. Its just doing a syscall in that code and the code is exactly the same as the syscall definitons in arm-eabi.zig. So I can just call that function right?
<andrewrk> oh ha that's just a cacheflush syscall huh?
<andrewrk> yep good point
<FireFox317> it is indeed
<FireFox317> almost have the PR ready
<andrewrk> working on ziglang/bootstrap is addicting. I need to get back to release notes + bug fixes
marijnfs1 has quit [Ping timeout: 256 seconds]
<karrick> What makes you happy about ziglang/bootstrap work?
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
junon_ has joined #zig
<andrewrk> <andrewrk> ziglang/bootstrap could be a fun place for contributors because there is a lot there that should work in theory but doesn't in practice, and if you can track it down, leads to useful, small, easy to merge improvements
<andrewrk> "contributor friendly" issues tend to be more fun for me to work on too, but I resist to make space for other people
<FireFox317> andrewrk, #4867. did not check the bootstrapping yet
<andrewrk> FireFox317, can you make the unreachable a @compileError? other than that, looks good, and I want to wait for the tests to pass before merging because of the lesson we learned from __divtf3
<andrewrk> (modifying compiler-rt can expose latent bugs)
wootehfoot has quit [Ping timeout: 250 seconds]
<FireFox317> andrewrk, yup good idea :)
<andrewrk> FireFox317, oh sorry and also we have to not add the symbol for that case. for example freestanding
<andrewrk> a bit of duplicated comptime logic
marijnfs1 has joined #zig
<FireFox317> andrewrk, will have a look at it tommorow, because its pretty late :D if you want to make progress on the bootstrapping tonight, you can just copy my PR :
<andrewrk> ok :)
marijnfs_ has quit [Ping timeout: 256 seconds]
FireFox317 has quit [Quit: Leaving]
lanodan has quit [Remote host closed the connection]
lanodan has joined #zig
nycex has joined #zig
frett27 has joined #zig
r4pr0n has joined #zig
<r4pr0n> is there a way to build zig not with the system's llvm, but instead let it compile llvm10 itself?
r4pr0n has quit [Client Quit]
frett27 has quit [Ping timeout: 240 seconds]
_Vi has quit [Ping timeout: 272 seconds]
nycex has quit [Remote host closed the connection]
nycex has joined #zig
nycex has quit [Quit: Quit]
nycex has joined #zig
<yrashk> I'm trying to bind cimgui, which in turn is a wrapper around imgui, a C++ wrapper. During linking, ld reports that it can't find the unmangled C++ symbols from imgui. Is C++ actually supposed to be working together with Zig at this point?
<yrashk> A C++ library*
<andrewrk> yes
diltsman has joined #zig
<andrewrk> we can probably get this solved pretty quickly with more details
<diltsman> Is this an error set problem? error: expected type 'fn(std.array_list.AlignedArrayList(u8,null), []const u8) std.mem.Error!usize', found 'fn(*std.array_list.AlignedArrayList(u8,null), []const u8) @TypeOf(std.array_list.AlignedArrayList(u8,null).appendSlice).ReturnType.ErrorSet!void'
<andrewrk> diltsman, are the error notes helpful?
<diltsman> Error notes?
<diltsman> andrewrk The error output lists the function call stack that references that point.
<diltsman> The only differences that I see there are the error set and the pointerness of the first argument.
<yrashk> andrewrk: sure.
<andrewrk> diltsman, hm I guess not in this case then. usually it would point out which parameter, or the return type or something like that
<andrewrk> but the hints are not implemented in all cases
<yrashk> to summarize, I have a build.zig building a static library for the C/C++ mix, and an executable that links to this static library.
<yrashk> ld fails with errors like:
<diltsman> Ah! So, the carrot pointing to appendSlice.
<diltsman> That is what I thought was the problem. I just don't know how to fix it. var outStream = OutStream(@TypeOf(buffer), @TypeOf(alloc.allocator).Error, @TypeOf(buffer).appendSlice);
<diltsman> Where buffer is an ArrayList(u8).
nycex has quit [Remote host closed the connection]
<andrewrk> yrashk, the first one looks like you're missing an imgui source file. the second one looks like something that regressed recently and was fixed today in cfedd3a
nycex has joined #zig
<yrashk> andrewrk: thanks! this is a very valuable start!
<yrashk> btw, I noticed that .a files contain the entire path to the .o files (including the leading slash). Is this intentional? `ar x ` even rejects this as invalid
<shakesoda> 1) imgui_demo.cpp, 2) libc++abi and maybe -fno-rtti -fno-exceptions
<shakesoda> although if latest zig fixes 2, nice
<diltsman> I guess, what function on ArrayList would be passed to OutStream?
<yrashk> with 0.5.0+cfedd3aca, it still fails to resolve __cxa_guard_abort __cxa_guard_release __cxa_guard_acquire __gxx_personality_v0 and a few others
<yrashk> ok, looks like I forgot addSystemLibrary("c++") :)