<andrewrk>
Shucks, yep, they're a lot like python dicts. I recently reworked the implementation inspired by Python's new dicts
<andrewrk>
insertion order is preserved
<pixelherodev>
andrewrk: any ideas how you want to handle specification of e.g. RAM and ROM for embedded chips?
<pixelherodev>
e.g. SPU II, AVR, RISC-V
<pixelherodev>
One idea I had was target-specific CLI options, which would be integrated with build.zig
<andrewrk>
start with adding a struct which you would initialize when setting up a Module, and hard code it for now. we can make some progress on it, then figure out how to expose it
<pixelherodev>
Gotcha
epmills has joined #zig
epmills has quit [Ping timeout: 272 seconds]
<fraktor>
Is a double-optional possible?
<leeward>
null or null or not-null?
<leeward>
Sounds like null or not-null.
<andrewrk>
fraktor, yes
frmdstryr has joined #zig
ur5us has quit [Ping timeout: 256 seconds]
<pixelherodev>
I freaking love the testing allocator
<pixelherodev>
We know stage2 is memory leak free simply by swapping allocators
<pixelherodev>
For scas, I had to set CI to run everything via Valgrind :(
ur5us has joined #zig
<andrewrk>
finally have gotta-go-fast running on a server that is not my personal laptop
<leeward>
\o/
<andrewrk>
pixelherodev, tests failed on #5849
<pixelherodev>
Huh
<pixelherodev>
Oops
<pixelherodev>
What the *hell*?
<pixelherodev>
`.yes_default_path => if (cbe)` <- I removed that
<pixelherodev>
That doesn't exist locally
* pixelherodev
is confused
leeward has quit [Remote host closed the connection]
<pixelherodev>
... unless I just ran test-stage2 and forgot to build the actual compiler
<pixelherodev>
Which isn't impossible lol
<pixelherodev>
No, this is actually wrong.
* pixelherodev
facepalms
<pixelherodev>
I was on the wrong branch XD
<pixelherodev>
I made a cbe2 branch because the cbe one hasn't been merged yet lol
leeward has joined #zig
epmills has joined #zig
<pixelherodev>
andrewrk: fixed
epmills has quit [Ping timeout: 264 seconds]
<daurnimator>
andrewrk: what do you mean remove the array list of header entries?
<daurnimator>
andrewrk: for http headers the field names are not unique
<pixelherodev>
... can we support a *subset* of HTTP?
<pixelherodev>
and require uniquing them?
<daurnimator>
pixelherodev: yes.... but it'll be a shit subset
<daurnimator>
e.g. max one cookie...
<pixelherodev>
Wait, really?
<pixelherodev>
Ahh
<pixelherodev>
... I mean, $redacted cookies anyways
<pixelherodev>
I'd be totally fine with that
<pixelherodev>
:P
<fengb>
Aren’t cookies typically glued together into one giant field?
<daurnimator>
(the most common multiple-of header is Set-Cookie)
<fengb>
Oh response
<daurnimator>
fengb: sending cookies from client-> server yes. server->client no
<daurnimator>
adding uniqueness requirements has lots of other overheads too. e.g. some headers mandate "if multiple, use the last X header" while other headers require "use the first"
<pixelherodev>
... okay, idea
<pixelherodev>
If we can have std.http, can we also have std.gemini ?
<pixelherodev>
Then I can avoid bugging you over how awful HTTP is lol
<pixelherodev>
`You may think of Gemini as "the web, stripped right back to its essence" `
<daurnimator>
> MIME types
<daurnimator>
I see mime types I scream and run away
<daurnimator>
biggest mistake in internet protocols
<pixelherodev>
lol
<pixelherodev>
How so?
<fengb>
So should there only be two types? Strings and binary
<pixelherodev>
daurnimator: ikskuh wrote a really nice Gemini client, kristall
Shucks has quit [Quit: Leaving]
<daurnimator>
fengb: okay; mime types are okayish for specifying content types (just don't try and use mime type attributes...). but mime packing; mime multipart; mime wrapping.... all dreadful
<pixelherodev>
Then it's a good thing this doesn't use those :P
<pixelherodev>
... I think
<pixelherodev>
Only problem with Kristall is that it's C++
<pixelherodev>
and not Zig
<pixelherodev>
:)
<andrewrk>
daurnimator, the list data structure is redundant now that hash maps preserve order
<daurnimator>
andrewrk: you can't have duplicate keys in a hash map
<andrewrk>
there are 2 list data structures currently used in the http headers abstraction
<andrewrk>
one is for duplicate keys, one is for preserving hash map order
<andrewrk>
the latter can be removed if hash maps gain an orderedRemove method
<daurnimator>
andrewrk: it can't though
<andrewrk>
what can't
<daurnimator>
be removed
<daurnimator>
what would you put in the hashmap as the key and value?
<pixelherodev>
Key, multiple values?
<daurnimator>
if you e.g. did key is header name. value -> arraylist of values for that header name; then you would loose total ordering of headers
<daurnimator>
if you did e.g. key is header name; value is header value; then you can't have more than one of each header
<daurnimator>
andrewrk: then how would you know that you are meant to render in order `Foo: x\r\nBar: y\r\nFoo: z\r\n`b
<andrewrk>
because hash maps preserve order
<daurnimator>
andrewrk: there are duplicate Foo keys there
<andrewrk>
I see
<daurnimator>
also as an aside; is there an "insert 2nd in list" call for hashmap?
<daurnimator>
if you need to prepend a header?
<andrewrk>
no
<daurnimator>
okay; that would be needed too
<daurnimator>
I guess you could always reconstruct entirely.
<daurnimator>
but I hope that shows you two reasons that we still need the ArrayList of entries
<andrewrk>
yeah, makes sense. thanks for explaining
* daurnimator
isn't feeling very eloquent lately
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
<daurnimator>
andrewrk: before I go off and simplify my json ignore-unknown-fields PR, did you have any reply to https://github.com/ziglang/zig/pull/5852#issuecomment-657291346 ? "Bit-stack for nested object/map literals (max 255 nestings)." <-- this seems to be undocumented and a bit of a foot-gun
epmills has joined #zig
<andrewrk>
daurnimator, I think it's a reasonable limitation, and it's not a footgun because error.TooManyNestedItems is in the error set
epmills has quit [Remote host closed the connection]
<andrewrk>
daurnimator, I'd rather encourage users to use a streaming http headers parser rather than storing things in memory
<shcv>
how do I run tests in a file with the same library configurations as my main build.zig? it can't find the library...
<andrewrk>
shcv, test build artifacts support the same API as other artifacts
<andrewrk>
you can set yourself up so that `zig build test` does what you want
<daurnimator>
andrewrk: I don't think a streaming http parser really works as soon as you get to non-trivial usage
<shcv>
andrewrk: do you have an example that does that?
<andrewrk>
shcv, sure, check zig's own build.zig
<shcv>
ok
<daurnimator>
1. http2 requires that you parse *immediately* and in some cases, buffer headers.
epmills has joined #zig
<daurnimator>
2. its pretty common to want to gather all headers and pass them through http handler phases (and even to external processes: see cgi/fastcgi/etc)
<daurnimator>
note though that there is no problem using a stack-based allocator: its considered good practice to put a bound on header size and number.
<andrewrk>
pixelherodev, you didn't end up doing any C ABI work did you?
bastienleonard has quit [Ping timeout: 272 seconds]
discipulus has joined #zig
epmills has quit [Remote host closed the connection]
shcv has quit [Ping timeout: 256 seconds]
<discipulus>
I created the proposal 5836 to replace std.debug.assert with std.testing.expect in the language reference documentation to teach and encourage best practices. I've made the changes and left the usage of std.debug.assert when appropriate. However, there's the arrays.zig example where I'm not sure if I should change the asserts to expect inside of
<discipulus>
the comptime blocks.
<pixelherodev>
andrewrk: for stage2?
<pixelherodev>
You were doing that
<pixelherodev>
I was trying not to step on your toes :)
<pixelherodev>
Ah wait, the abstractions, you mentioned that
<pixelherodev>
I can do that tonight or in the morning if you want
<pixelherodev>
I'll get the return test PR done tonight as well
<pixelherodev>
That'll let me reuse the cbe branch lol
epmills has joined #zig
epmills has quit [Ping timeout: 256 seconds]
<pixelherodev>
andrewrk, daurnimator: maybe add some of that discussion as a comment in the file?
<pixelherodev>
That seems like it'd be useful
stripedpajamas has joined #zig
<daurnimator>
pixelherodev: hmm? which discussion/file?
<pixelherodev>
HashMap / ArrayList / http
<daurnimator>
pixelherodev: there's already a big explanatory comment in that file
<pixelherodev>
Ah okay good :)
<pixelherodev>
... then why did this discussion start again?
<pixelherodev>
;)
<daurnimator>
because no one reads them >.<
discipulus has quit [Quit: discipulus]
<andrewrk>
TIL `push rbp` and `pop rbp` are 1 byte each
<andrewrk>
pixelherodev, I'm doing it now
<pixelherodev>
Gotcha
<pixelherodev>
But yeah, pushes / pops are one byte + REX
<pixelherodev>
(for r8-r15)
<pixelherodev>
I'll have the other PRs done tonight
<pixelherodev>
"tonight," he says, half an hour after midnight :P
waleee-cl has quit [Quit: Connection closed for inactivity]
<daurnimator>
pixelherodev: then you have 23 hours :)
<pixelherodev>
lol
<pixelherodev>
I plan on getting it done in a percent of that
<daurnimator>
150% is a percent
<pixelherodev>
lol
B4s1l3 has joined #zig
B4s1l3 is now known as opDispatch
<pixelherodev>
Might take slightly longer, actually (closer to an hour, than to thirteenish minutes); need to take of some more important obligations first
<pixelherodev>
andrewrk: comptime values should never make it down to codegen, right?
<andrewrk>
they do as Inst.Const
<andrewrk>
however those instructions are not in the list when iterating over them, they are only pointed to by operands
<pixelherodev>
But not as comptime_int, right?
<andrewrk>
right
<pixelherodev>
e.g. functions returning comptime values won't make it to codegen, at least?
<pixelherodev>
e.g. if something returns comptime_int, we'll never be told to updateDecl it, right?
<andrewrk>
right
lemmi has quit [Ping timeout: 256 seconds]
<pixelherodev>
then hasCodegenBits should be good, yeah
<andrewrk>
nice
<pixelherodev>
For liveness analysis, we'd want the *call*'s isUnused?
<pixelherodev>
No, I think we'd want assignments, which aren't implemented in ZIR yet
<pixelherodev>
`You can check if the value is used with inst.isUnused()` andrewrk: I don't think we can, because the inst we'd want to check doesn't actually exist yet
<pixelherodev>
The TODO was a reminder for after assignments are implemented in ZIR
<pixelherodev>
As is, all function calls have their values ignored
<pixelherodev>
No wait, if a call is used as an arg, it should be used
<andrewrk>
I don't think that needs to be a TODO
<pixelherodev>
Right, that's what I just realized
<pixelherodev>
with e.g. a(b()), the call for B will be marked used, right?
<pixelherodev>
Whereas with `b()`, it's not?
<andrewrk>
right
<andrewrk>
a(b()) will end up being 2 lines in the generated .c
<pixelherodev>
so that'd be call_inst.base.isUnused(), okay
<andrewrk>
(at least)
<pixelherodev>
Right, I know
<pixelherodev>
Because we go Zig -> ZIR -> C, not Zig -> C
<pixelherodev>
For the record, when I mark something as resolved on GH, it means I've acknowledged it and handled it locally, even if I haven't shown the code yet
<pixelherodev>
Last thing is to split out the prongs
<daurnimator>
pixelherodev: that's a little weird. it makes it easy for comments to get lost if you haven't really solved a comment
<daurnimator>
why not just push early; push often?
<pixelherodev>
CI.
<pixelherodev>
It's extremely wasteful.
<pixelherodev>
I'm not going to trigger all... what, seven? CIs for a tiny bit of convenience
<pixelherodev>
daurnimator: I don't mark them resolved unless a) we've finished the discussion *and* b) I've implemented / fixed whatever was discussed
<daurnimator>
hmmm. good point. I'm not used to CI runs being so expensive
<pixelherodev>
`bccfceecc` lol
<pixelherodev>
That's a nice commit hash
<pixelherodev>
(Seven CIs = five on Azure + SrHt FreeBSD + the ARM one)
ur5us has quit [Ping timeout: 256 seconds]
<pixelherodev>
daurnimator: another reason is that I occasionally have to amend a commit, or rebase
<pixelherodev>
And that'd mean even *more* waste
<pixelherodev>
If I could tell GH not to bother w/ CI, it wouldn't be an issue
<pixelherodev>
andrewrk: do you particularly care if there's explicit types given where they don't need to be?
<pixelherodev>
I tend to do that to inform ZLS when it's not able to figure it out on its own, but I can see how only having them for that could be considered problematic
fraktor has quit [Quit: WeeChat 2.8]
<daurnimator>
whereever it enhances readability..
<daurnimator>
whats an example of where ZLS can't figure it out?
stripedpajamas has quit [Quit: sleeping...]
<andrewrk>
ZLS isn't an actual compiler implementation, it recognizes a specific set of patterns
<pixelherodev>
^
<pixelherodev>
It uses the parser, yes, but it's analysis isn't complete
<andrewrk>
which in some ways is actually more useful, e.g. with generic code
<pixelherodev>
For sure; I want it to auto-detect std.ArrayList / HashMap types for instance
<pixelherodev>
That doesn't require proper analysis at all, it just requires detecting the type name :P
<pixelherodev>
andrewrk: stylistically, for if (blah) a if (foo) b else c else d`, do you want braces?
<pixelherodev>
in stage2, of course
<pixelherodev>
I feel like braces actually hurt readability here, since with everything on its own line per `zig fmt` it's really clear what the flow is
<pixelherodev>
But I figured I'd ask before making a style decision
<pixelherodev>
Aside from that, it's done
<pixelherodev>
uhhhh, I pushed to pixelherodev/zig:cbe, but the PR isn't updating...
<pixelherodev>
So yeah, technically ELF16 doesn't exist
<andrewrk>
here's the most complicated thing the self hosted zig compiler can do so far: https://clbin.com/MGHtj
<pixelherodev>
That's the same test, right?
<pixelherodev>
Just with additional info?
<andrewrk>
yeah
<ikskuh>
andrewrk: nice! that's some cool news :)
<ikskuh>
it's nice to see progress on stage 2
<andrewrk>
pixelherodev, heh, I have to add CBE support for retvoid in order to keep tests passing :)
<pixelherodev>
;)
<pixelherodev>
I love how we're building off of each other's work :)
<andrewrk>
I'm going to move cgen.zig to codegen/c.zig
<pixelherodev>
Should codegen.zig go to codegen/something.zig, too?
<andrewrk>
no
<andrewrk>
pixelherodev, it looks like you're doing some type casting logic inside genRet. why is that necessary? this is post-analysis, all the type casting has already been done
<andrewrk>
`expected_return_type.eql(ret_value.ty)` this is guaranteed to be `true` always
<pixelherodev>
Oh, huh
<pixelherodev>
Yeah, that makes sense :P
<pixelherodev>
The error would have already happened, right?
<andrewrk>
right
<pixelherodev>
Assertion? Or nothing at all?
<pixelherodev>
(to replace it)
<pixelherodev>
Ugh, GH is down again
<pixelherodev>
lol, it failed to serve the "server error" page
<andrewrk>
most important is to simplify the code with the assumption that type checking already happened
<andrewrk>
so that it's easier to maintain
<pixelherodev>
Yeps, will do so shortly
<andrewrk>
pushed
<andrewrk>
pixelherodev, here's a fun task for you, if you want: get stage2 able to build the assert function :)
<andrewrk>
looks like all it needs is support for boolean not
<pixelherodev>
Coolio, will do
<pixelherodev>
... added to the list lol
dermetfan has joined #zig
discipulus has quit [Ping timeout: 245 seconds]
discipulus has joined #zig
<ikskuh>
hey. anyone uses vscode and can tell me how to disable automatic downloads for $stuff?
<pixelherodev>
lol
<pixelherodev>
You're using an MS product and want to disable automatic *anything*? Glhf
* pixelherodev
smirks in kakoune
<ikskuh>
I was opening VScode and it started downloading omnisharp
* ikskuh
smirks in firejail
* pixelherodev
is working on SPU backend for stage2 though so you'll probably not be too bothered by the smirk ;)
<pixelherodev>
actually, going to try to get, like, three hours of sleep now
<ikskuh>
glhfsw
<pixelherodev>
Got all my HW that's due today finished, fixed up CBE PRs, figured out the design for the ELF stuff, so a productive four hours all in all
<pixelherodev>
Thanks
<ikskuh>
haha. firejail now prevents bash from accessing the web as well :D
<ikskuh>
and thus, my vscode-internal console cannot be used to do git stuff anymore
<pixelherodev>
lol
doublex has quit [Ping timeout: 244 seconds]
<ifreund>
isn't there a de-microsofted version of vscode?
<ikskuh>
afaik it even is the vscode-oss version
discipulus has left #zig [#zig]
benaiah has quit [Read error: Connection reset by peer]
benaiah has joined #zig
<gonz_>
ikskuh: Presumably you're using something that depends on whatever is being downloaded.
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
craigo has quit [Ping timeout: 256 seconds]
<ikskuh>
gonz_: The official C# extension
<gonz_>
That would be it, yeah :D
<gonz_>
Now that you mention it, it'd be neat to have a confirmation box for at least big downloads, or all downloads (with an "allowed auto-downloads"-list that persists)
<gonz_>
They already did this with opening URLs in browsers, etc.
<ikskuh>
yep
<gonz_>
I guess best you can do is to set `"extensions.autoUpdate": false` in your config.
<gonz_>
to at least not get the new stuff automatically when they update
<gonz_>
It'll still check for updates, but allow you to update at your leisure
<gonz_>
Provided you have `"extensions.autoCheckUpdates": true` set
ur5us has joined #zig
Shucks has joined #zig
discipulus has joined #zig
_Vi has joined #zig
ur5us has quit [Ping timeout: 244 seconds]
antaoiseach has joined #zig
<antaoiseach>
Hi, I wanted to confirm one very basic aspect of Zig compilation - if I have a Zig lib and I compile it (no packed data structures), then the resulting lib is incompatible with C, and only compatible with Zig code, right?
<antaoiseach>
Also, suppose I have libfoo.a built from normal (non-packed) Zig structs, how would I go about loading that in another Zig project?
<antaoiseach>
Is there a flag for it?
<antaoiseach>
I see a "--library-path" flag ... this should work?
<ifreund>
zig only does dynamic linking with th C ABI, so yes that lib would be compatible with C
<ifreund>
if you're using a zig library from zig code you should probably just bulid it from source
<antaoiseach>
ifreund: So right now if I have the libfoo.a artifact, I can use it from C even without having used packed structs/enums etc.?
<antaoiseach>
ifreund: Okay, thanks for the help! Will try it out on some small examples! :-)
<ifreund>
antaoiseach: packed structs are a Zig thing, for C ABI you want extern structs
antaoiseach has quit [Quit: leaving]
<scientes>
there should also be extern packed
Shucks has quit [Quit: Leaving]
opDispatch has quit [Quit: Konversation terminated!]
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
discipulus has quit [Quit: discipulus]
dermetfan has quit [Ping timeout: 260 seconds]
vegai has joined #zig
Snetry has quit [Ping timeout: 240 seconds]
Snetry has joined #zig
<gonz_>
When was the last showtime recorded?
<gonz_>
I switched my sponsorship yesterday unprompted because I stumbled upon the link randomly.
<gonz_>
But the pasta recipe was already uploaded yesterday, right?
<gonz_>
And the goal isn't yet met on the ShowTime broadcast.
<ikskuh>
gonz_: was at saturday night
<gonz_>
Aha
<ikskuh>
video is uploaded already
<gonz_>
Yeah, it was uploaded today
kkd has left #zig [#zig]
<fengb>
The prerecorded stuff like pasta was probably uploaded a week ago
<fengb>
The show itself needed time to process after it was recorded. Youtube is slow or something