<mikdusan>
ok i just built master: de2b0cd7, try smaller test... `zig build test-behavior -Dskip-release -Dskip-non-native`
<mikdusan>
this works for me
<curtisf>
mikdusan: I updated the issue with a slightly less reduced version of my code that also causes the crash. Do you spot anything I should obviously be doing differently? https://github.com/ziglang/zig/issues/2746
<fengb>
mikdusan: even less luck with testing zig itself `unable to spawn /Users/vsts/llvm+clang-8.0.0-macos-x86_64-gcc8-release/bin/llvm-config: error.FileNotFound`
<mikdusan>
fengb: that is latest ziglang.org binary? let me download it...
<fengb>
Okay after rebuild, zig tests are working. I think it's hardcoded vsts into the path somehow
<mikdusan>
yeah test failed for me with downloaded binary
<hryx>
are escapes \a \b \f \v valid in zig string/char literals? The docs say no, and the compiler doesn't like me doing `\a`, but translate_c.cpp renders them to string literals
<andrewrk>
hryx, I think the grammar spec is correct, just checked and it's: nr\\t'"
<andrewrk>
oh you already noted that
<andrewrk>
I think it's a mistake in translate-c, or it changed and didn't get updated
<hryx>
ah, thanks. sanity in tact
<hryx>
relatively speaking
noonien has quit [Read error: Connection reset by peer]
noonien has joined #zig
qazo has joined #zig
<hryx>
arrays can implicitly cast to slices in assigment statements, but not in return statements. Is that accurate?
<hryx>
i.e., I'm returning a [2]u8 in a function whose return type is []const u8, and compiler doesn't like it
<hryx>
but I can get around this with something like this: `return ([_]u8{'a', 'b')[0..]` which seems ok, just a little messy
<andrewrk>
I think the issue might be if there are multiple return statements and it's doing peer type resolution?
<andrewrk>
I think that is going to change soon, either with the result location branch or soon after it. the "result type" can be used as the cast target rather than the peer types, when it is available
qazo has quit [Read error: Connection reset by peer]
<hryx>
ohhh, maybe that's it. I always get tripped up by peer type resolution, because it tries to resolve even when the return type is known
<hryx>
that would be awesome
<andrewrk>
yeah, I think that was a mistake. in general I think peer type resolution will be changed so that if there is a result type, it will implicit cast each peer to the result
ltriant has joined #zig
<andrewrk>
but if there is not a result type (e.g. var x = if(c) a else b;) then it will do peer type resolution
<hryx>
honestly that sounds perfect
<hryx>
should there be an issue to track it? I'd be down to make one
<andrewrk>
or if functions with inferred return type ever becomes a thing, then all the return values would get peer type resolved
<andrewrk>
I would appreciate that, thank you
<hryx>
sure thing
<andrewrk>
I'm a little behind on issue triage, I really want to finish up this branch
<andrewrk>
but I took a day today taking advantage of the state of the internet to run that musl fundraiser
<hryx>
that blog post was crazy. I missed all that fascinating internet drama
<hryx>
but great conclusion at the end about musl
<andrewrk>
I'm gonna get a good night's sleep and then try to make significant progress on that branch tomorrow
<andrewrk>
good night
<hryx>
later o/
<mikdusan>
heh src/analyze.cpp has UTF-8 BOM
<hryx>
D:
<mikdusan>
only file in entire tree
fengb has quit [Ping timeout: 260 seconds]
<gonz_>
andrewrk: Good choice on stepping up for musl and making it obvious that you recognize the value of your dependencies.
ltriant has quit [Ping timeout: 258 seconds]
ltriant has joined #zig
ltriant_ has joined #zig
bugabinga has joined #zig
ltriant has quit [Ping timeout: 244 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #zig
curtisf has quit [Ping timeout: 260 seconds]
squiddlebit has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
ltriant_ has quit [Quit: leaving]
social_cues has joined #zig
jjido has joined #zig
<social_cues>
why does [_]u16{0} ** 10 from docs only work as constant?
<social_cues>
I'd like to initialize a `var` array to zero instead
<social_cues>
Nevermind, got it
bugabinga has quit [Quit: Connection closed for inactivity]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
samtebbs has joined #zig
neceve has joined #zig
<squiddlebit>
Am I not supposed to call std.os.read() when attempting to receive data from a socket? It works, but it doesn't handle errno 104 (ECONNRESET), aka "connection reset by peer". I'm wondering if that is an oversight or intentional
<squiddlebit>
Oh right I suppose I should mention. This is on Linux and the issue appears in the stdlib of master branch
jjido has joined #zig
social_cues has quit [Remote host closed the connection]
abbiya has joined #zig
<abbiya>
hi, where can i find the standard library docs ?
<samtebbs>
abbiya: There are none at the moment, but it is in the pipeline
<abbiya>
ok
<abbiya>
i want to start writing a web api. how do i proceed ? i know Go
<gonz_>
abbiya: I think you probably find that it's pretty hard to do networking stuff at the moment, unless you're familiar with the equivalent in C.
<samtebbs>
abbiya: AFAIK the HTTP-related parts of std haven't been implemented yet as they're blocked on async/await
<gonz_>
I think andrewrk currently recommends to wait until the rewrite of async/await, at least.
<abbiya>
ok, thanks. waiting for 1.0
<abbiya>
i know github stars dont matter much but vlang has more than zig
<abbiya>
is there a comparison btw nim and zig ?
<abbiya>
i was thinking zig but googled nim
<samtebbs>
It does and most would say that it doesn't deserve them
<gonz_>
The prevailing attitude in here is to stay on topic and positive, i.e. focus on what's good about zig and not what's bad about other languages.
<samtebbs>
You could perhaps work with HTTP if you're willing to do so at a very low level without the stdlib helping you outside of file I/O
<samtebbs>
Yeah, talking about other languages is probably best done on reddit etc. :)
<abbiya>
awesome work on zig
<samtebbs>
Although it is useful to compare and see where Zig could improve, as that helps accomplish the goal of making Zig even better
<abbiya>
see y'all in future
abbiya has left #zig [#zig]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<forgot-password>
Hi guys, is it possible to use std.io.Deserialize to deserialize a slice of things (e.g. []u8)? I'd rather not add an allocator field to all my structs and use deserializeInto every time.
MajorLag has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tgschultz has quit [Ping timeout: 248 seconds]
MajorLag is now known as tgschultz
jjido has joined #zig
mawaldne has joined #zig
<BitPuffin>
if you own the memory for the slice couldn't you just do slice.ptr and cast it to a struct or something like that @forgot
<BitPuffin>
@forgot-password
<forgot-password>
I'm not exactly sure what you mean, BitPuffin.
<BitPuffin>
so if you have a struct type called Foo let's say
<BitPuffin>
and you have a slice that contains bytes that you just reads that you want to deserialize into Foo
<BitPuffin>
then you can get the raw pointer of the slice with slice.ptr
<BitPuffin>
and thenyou could cast it to Foo
<BitPuffin>
although I suppose you just have readStruct
<forgot-password>
What I tried is to add an allocator field to my Container struct and then use `Deserializer.deserializeInto(&container)` where I already set container.allocator.
<forgot-password>
But this gets really ugly when I have to do that for the Entry struct as well (because of the name field, which is a []u8)
<Tetralux>
I've never used the serializer, but I suspect that you _have_ to allocate space with an allocator.
<Tetralux>
I think you can serialize the slice as a len and then that number of elements.
<Tetralux>
...alloc'ing a slice of the length you get
<Tetralux>
..and then passing the slice to deserializeInto
<via>
ee
<Tetralux>
Or deserialize.
<Tetralux>
Like
<Tetralux>
Never tried it
<Tetralux>
Actually no
<Tetralux>
I think you'd just have to store the length as an integer, deserialize that, and then ask for the type that many times.
<forgot-password>
Tetralux: Yes, but the issue is allocating the space for `length` elements
bheads has joined #zig
<forgot-password>
Or what do you mean by `ask for the type that many times`?
<Tetralux>
I mean, deserialize an int that tells you how many u8s you have
<Tetralux>
And then 'while' up to that number, calling deserialize(u8) each time.
<Tetralux>
But you need space to put them.
<Tetralux>
Which is why you're asking about how to alloc that many of them.
<forgot-password>
Exactly
<Tetralux>
I think you just have to have an allocator and alloc it. :')
dsego has quit [Quit: dsego]
<Tetralux>
You could have a stack array that you pass to the container thingy
<Tetralux>
Instead of alloc'ing
<forgot-password>
But how do I get that allocator into my deserialize function in a nice way? Because I don't have control over that
<Tetralux>
But that would be fixed-size.
<forgot-password>
But then I have to pass that into nested structures all the time
<Tetralux>
Maybe there's a better way to architect your program.
<forgot-password>
Say I have another Subentry struct, of which an Entry has n items. Then the Entry needs to do the same thing as the container, which leads to a lot of clutter
<Tetralux>
Hmmm.
<forgot-password>
But how? I think deserializing a list of items is a very valid use case for the builtin Deserializer. Maybe the user could pass an allocator when initializing the latter
<forgot-password>
And then you one could use `deserializer.allocator` in the custom deserialize functions
<Tetralux>
Do you have a thing that is responsible for firing off the deserialization?
<Tetralux>
Or are you deserializing in order to use it later?
<forgot-password>
Well, the line `const container = try deserializer.deserialize(&in_stream.stream)` is responsible for starting the deserialization
<forgot-password>
Yes, I intend on using the deserialized value later
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Tetralux>
So
<Tetralux>
Let me see if I have this right
<Tetralux>
You want to essentially read a Container from the stream.
<Tetralux>
To do that, you deserialize it.
<Tetralux>
And it has an array of Entrys.
<Tetralux>
So it needs to make a slice for that.
<Tetralux>
But needs an allocator to make space for them.
<Tetralux>
And then, each Entry has the same problem.
<Tetralux>
Where they have a slice to their name.
<Tetralux>
Which you need to allocate for.
<forgot-password>
Correct, but I don't have any control over what gets passed to the custom deserialization functions, because they are called by the standard library implementation. So there's no way, other than going the ugly route of using deserializeInto every time, to access said allocator.
<forgot-password>
Well, having a global one would work, but that's even worse.
<Tetralux>
Hmmm.
<Tetralux>
Yeah - I don't know how you might deserialize a slice with that interface.
<forgot-password>
Being able to pass an allocator when initializing a Deserializer is a good solution, in my opinion, but I don't have a lot of experience with Zig, so I'd leave the judging to you guys.
<forgot-password>
Then you could use that allocator in your deserialization functions and the end user still has control over which allocator implementation to use
<Tetralux>
I think the idea of the io.Deserializer is that it doesn't allocate memory.
<Tetralux>
But I'm not sure how you'd go about dealing with the slice.
<forgot-password>
But why not have it allocate any memory? Isn't that a valid use case for a deserializer?
<Tetralux>
I don't know honestly. Maybe @andrewrk can shed some light on it.
<forgot-password>
Take a PNG Decoder for example. It needs some place to put the decoded data, doesn't it?
<forgot-password>
Serialization isn't a problem at all. That works fine
<forgot-password>
It's just the deserialization that's giving me a headache
<Tetralux>
Oh right right
<Tetralux>
Was thinking of something else xD
<Tetralux>
Yeah
<Tetralux>
I'm not sure how you'd best do this.
<Tetralux>
I suspect there's a reason why it's the way it is, but I don't know what it is. xD
<Tetralux>
Can always make an issue for it too of course :)
<forgot-password>
Me neither, but maybe it's already possible and we're just blind ^^^
<Tetralux>
..Also very possible xD
<forgot-password>
I think I'll do that tonight, seems like it's not that obvious
<forgot-password>
Thanks for your help, BitPuffin and Tetralux :)
<Tetralux>
Welcome :)
social_cues has quit [Remote host closed the connection]
Akuli has joined #zig
fubd has joined #zig
schme245 has joined #zig
<schme245>
I have a []u8 with 16 elements that I want to view as a 4x4 two-dimensional array. to get the first row is easy (just foo[0..4]), but how can I get the first column as a slice? (a slice that contains the elements 0, 4, 8, 12)
<Tetralux>
I don't think you can without copying.
<Tetralux>
You could make a struct that implements that behavior though.
<Tetralux>
(See ArrayList, but with different .at implementation.)
<schme245>
hmm... I would like to avoid copying if possible, maybe I should just bite the bullet and make it a two-dimensional array instead :)
<Tetralux>
You can do math to get at each element instead :)
<Tetralux>
I'm not familiar with how multi-dim arrays work in Zig, but I suspect that one big block and a custom structure is more efficient.
ki9a has joined #zig
<schme245>
that would be my guess as well
<Tetralux>
Mainly for mem fragmentation. But also slightly for cache coherence.
<Tetralux>
I'd have to measure to know for certain, but if each row is only 4 elements, then you'd break the cache line quite often unless every row was allocated right next to each other anyway.
<Tetralux>
Which you could do, to be fair.
<Tetralux>
Again though - never used multi-dim arrays in Zig. Depends on how they're implemented.
<Tetralux>
If it's a slice with elements that are slices, then no - that'd be bad.
<andrewrk>
mikdusan, the union init thing you found was the solution to the rest of the failing std lib tests, all std lib tests passing now in copy-elision-3 branch!
<Tetralux>
Awesome!
<samtebbs>
Oh wow, good work :)
<schme245>
sweet! :D
<mikdusan>
yaay!
fengb has quit [Ping timeout: 260 seconds]
<samtebbs>
andrewrk: How would I get a Zig project of mine into the "External projects" page in the wiki?
fubd has quit [Remote host closed the connection]
<mikdusan>
i like how copy-elision-3 branch llvm-ir looks for union-inits now: no longer uses global constants or llvm.memcpy for trivial types
porky11 has joined #zig
<tgschultz>
I don't think deserialize should be allocating memory. I don't see why deserializeInto is a problem in this use case. Also, FYI, you can call deserializer on a slice and it should fill it in for you.
<tgschultz>
`deserializeInto(my_slice);`
<andrewrk>
samtebbs, it's a wiki, go nuts
mawaldne has quit [Remote host closed the connection]
<forgot-password>
tgschultz: That gives me a `Cannot deserialize pointer types (unimplemented)
<mikdusan>
andrewrk: re: std lib tests passing; did you run on linux with > 4GB RAM?
<andrewrk>
yes
<andrewrk>
is there significantly more ram usage? I can look into that
<mikdusan>
ok fyi a archlinux @ 4GB it failed; I bumped my VM to 8GB and it passes the first part of std lib tests
<andrewrk>
hm yes it's about 1GiB more
<andrewrk>
there is a lot of wasted memory, probably some easy things to fix
<forgot-password>
tgschultz: I tried to call `self.entries = try deserializer.deserialize([]Entry)`, by the way
qazo has quit [Ping timeout: 248 seconds]
dimenus has joined #zig
<dimenus>
andrewrk: does @cInclude support relative paths?
<dimenus>
also, hello again :)
<andrewrk>
welcome back dimenus
<dimenus>
or have a default search path anyway
<andrewrk>
currently @cInclude works based on -isystem args
<samtebbs>
andrewrk: Awesome, thought I'd make sure there was no edit approval process :D
<samtebbs>
Ok it even says "Feel free to add yours here!"...
<andrewrk>
samtebbs, I added that in response to your question above :)
<samtebbs>
andrewrk: Oh haha xD
qazo has joined #zig
<forgot-password>
tgschultz: I can't wrap my head around it, how are you supposed to deserialize something of a dynamic size without allocating space for the data of that size?
samtebbs has quit [Quit: leaving work, will rejoin later]
dimenus has quit [Remote host closed the connection]
<andrewrk>
mikdusan, I bet we could save a lot of memory by introducing an arena allocator into IR analysis
<andrewrk>
some stuff would get perma-allocated, but lots could be freed when the IR analysis completed
<tgschultz>
forgot-password: you can deserialize INTO a slice. not deserialize a slice type.
<forgot-password>
But I need to allocate that slice, don't I?
<tgschultz>
at least that's how I recall writing it... it's possible my memory is faulty.
<tgschultz>
Yes, absolutely
<forgot-password>
But how should I to do that without having access to an allocator in the deserialize function?
<tgschultz>
don't use the deserialize function via the callback, make your own `MyThing.deserialize(deserializer, allocator)`
<forgot-password>
I would need to do that before deserialization, but the size of the data needs to be known for allocating enough space, which one can only obtain via deserializing said size.
<forgot-password>
I basically did that before using std.io.Deserializer, but then what's the point of having that standardized interface?
<forgot-password>
Because you can just the InStream yourself to call readIntLittle, etc.
<forgot-password>
The Deserializer is only a minor convenience in that case
dimenus has joined #zig
<andrewrk>
mikdusan, I'm gonna ignore the memory issues for now, hopefully we can get away with some more waste until self-hosted is available
qazo has quit [Ping timeout: 244 seconds]
<andrewrk>
there's another benefit to never freeing which is that we never have weird memory unsafety bugs
<tgschultz>
yeah, you could. If it is only a minor convenience then don't use it. I find it to be a major convenience when I want to deserialize a bunch of structures from a file, but it obviously can't cover every possible use case without becoming ludicrously more complicated, forcing the user to supply an allocator, etc.
<mikdusan>
what is VM size for azure CI instances?
<Tetralux>
tgschultz, Maybe it should be renamed to SimpleDeserializer then :p
qazo has joined #zig
<forgot-password>
tgschultz: I wouldn't call that ludicrously more complicated, isn't passing allocators around a big thing that Zig advertises with?
<tgschultz>
alright, lets say I have deserialize take an allocator. Now you have to supply one even if you're just using basic structures and types that never ever require dynamic allocation, which I have to imagine is the minority use case.
<forgot-password>
Is it really? Most of the things I deserialized required dynamic allocation. However, I always used a managed language to do that.
<tgschultz>
having deserialize call your type's custom deserializer was meant as an escape hatch for things like unions and pointers. Maybe it was a mistake to include it.
<tgschultz>
what are you deserializing that requires so much dynamic allocation?
<tgschultz>
Like, I rewrote my BMP loader recently and didn't need it. I just load the header separate from the image data, it isn't rocket science.
<tgschultz>
That came off more insulting than intended, sorry.
<forgot-password>
No worries, didn't take it that way :)
<andrewrk>
mikdusan, I'm not sure
<tgschultz>
I'm not trying to dismiss your usecase, I just can't see why the custom deserialize callback is a roadblock here. Here's how I did it in BMP, for reference: https://pastebin.com/avX2yxFM
<forgot-password>
I'm playing around with a custom file format right now. But if I remember correctly parsing a .kdbx (Keepass Database) required that as well. Let me check if I can find the spec I used to build the parser
<tgschultz>
here I get away with it in a custom deserializer because there's no allocation requirement, but you can just use deserializer like that outside of the custom deserializer too.
<andrewrk>
fwiw, I think there are a bunch of different use cases of serializers/deserializers and there's plenty of room for different approaches. I don't think there will be any in the std lib at 1.0, but tgschultz's APIs are useful for some cases and provide more regression tests for the language
qazo has quit [Read error: Connection reset by peer]
<forgot-password>
tgschultz: I have to leave now, but I'll try get back to you in ~1 hour :)
<tgschultz>
isn't kdbx an xml format?
<forgot-password>
Yes, but I'm not sure if all versions are
porky11 has quit [Ping timeout: 252 seconds]
<forgot-password>
qa
<forgot-password>
Oops, wrong window :p
forgot-password has quit [Quit: Lost terminal]
qazo has joined #zig
_whitelogger has joined #zig
ky0ko has joined #zig
qazo has quit [Ping timeout: 272 seconds]
<BitPuffin>
Is there a nifty way to depend on some other build.zig to build a library
<BitPuffin>
like I have program A which depends on library B which is linked to somewhere with a relative path and has its own build.zig path
laaron has quit [Remote host closed the connection]
qazo has joined #zig
qazo has quit [Ping timeout: 272 seconds]
wootehfoot has joined #zig
qazo has joined #zig
squiddlebit has quit [Quit: WeeChat 1.9.1]
dimenus has quit [Remote host closed the connection]
<andrewrk>
BitPuffin, there's an issue open for that
<andrewrk>
in this release cycle (0.5.0) towards the end, zig build system is going to get a lot of attention
* daurnimator
thinks this release cycle should get an extra step
<andrewrk>
what do you mean daurnimator?
<daurnimator>
andrewrk: once copy ellision and basic coroutine support is done, please make a release
<andrewrk>
ahh
<andrewrk>
why's that?
<andrewrk>
current plan is september 30
<BitPuffin>
andrewrk: for now adding a packagePath was good enough :)
<daurnimator>
andrewrk: so much has changed since 0.4.0: the whole std.os refactor; the [] vs [_] change and coroutines: working based on the 0.4.0 release is effectively useless: everyone now has to work from current master
<andrewrk>
oh my goodness, look at those few check boxes left on #2602
* donpdonp
claps
<daurnimator>
andrewrk: I think once basic coroutine support is fixed up; it would be a good point to tag a release so that people have a good point for the next 3 months to experiment on top of
<mmx87>
Is there something like an equivalent to the C restrict keyword in Zig?
<mikdusan>
andrewrk: awesome. that's a much better location; I wasn't very happy with my location
<andrewrk>
mikdusan, if you're up for more work on this, coming up with a reduced test case for the self-hosted compiler compile errors would be amazing
<andrewrk>
I'll be plugging away at the compile error tests meanwhile
<mikdusan>
sure i'll take a peek but before i forget i was musing about analysis memory consumption (still doing some instrumentation on it),
<andrewrk>
ah that's nice too, whatever piques your interest :)
<mikdusan>
do i understand correct that zig0 cannot use a zig userland arena because chicken-egg?
<andrewrk>
correct, zig0 cannot use any .zig code
neceve has quit [Remote host closed the connection]
qazo has quit [Ping timeout: 246 seconds]
<mikdusan>
musing to let zig0.exe continue using malloc for bulk of analysys, and zig.exe use userland arena?
<andrewrk>
interesting idea, so the API would be the same, but in zig0 the free would do nothing?
<mikdusan>
yes
<andrewrk>
idk for something so simple it might be reasonable to just do the arena in the C++ code
<mikdusan>
there's that too :)
<andrewrk>
eventually, zig stage1 will essentially have the needed part of the zig std lib ported into C++. that's kinda what it's been evolving towards anyway
<mikdusan>
i'll instrument further to get a handle on what proportions of memory analysis uses
<andrewrk>
hmm actually not sure how that would work
bheads_ has joined #zig
fengb has quit [Ping timeout: 260 seconds]
<andrewrk>
I don't want to get too distracted with improving stage1 unless it's on the path to self-hosted (which copy elision and coroutines certainly are)
<daurnimator>
Does it really matter if stage 0 is memory hungry? It should only be used to build stage 1 :P
bheads has quit [Ping timeout: 252 seconds]
bheads_ is now known as bheads
<andrewrk>
that's my point
jjido has joined #zig
bheads has quit [Remote host closed the connection]
porky11 has joined #zig
avoidr has joined #zig
wink_ has joined #zig
marijnfs_ has joined #zig
<wrl>
andrewrk: have you read the bit about speeding up the D compiler by just having it not free memory?
<mikdusan>
weird. for gist files is there some trick to format proper? i can add a comment on the gist with "```zig" as first line and it formats nice. but not an actual file.
<schme245>
I'm thinking about how to implement format for @Vector. Am I correct that there is no way to get the elements of the vector other than casting it to an array? would this be fine for formatting purposes?
guan has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fu5ha has joined #zig
schme245 has quit []
Akuli has quit [Quit: Leaving]
samtebbs has joined #zig
marijnfs_ has quit [Ping timeout: 252 seconds]
marijnfs_ has joined #zig
<BitPuffin>
mikdusan: how does it not format nice?
fu5ha has quit [Remote host closed the connection]
<mikdusan>
turns out glitchy. sometimes formatted. sometimes not. github css issue i suppose.
<torque>
are you using safari? I get that occasionally as well, and refreshing the page usually fixes it (the web is bad)
fu5ha has joined #zig
<mikdusan>
yup safari/macOS Mojave
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
fu5ha has quit [Remote host closed the connection]
porky11 has quit [Ping timeout: 250 seconds]
<BitPuffin>
ah
<BitPuffin>
don't see that in firefox
qazo has joined #zig
<BitPuffin>
I concur, the web is bad
fu5ha has joined #zig
porky11 has joined #zig
<Tetralux>
I wish we could fix it with low-level languages xD
qazo has quit [Read error: Connection reset by peer]
allan0 has quit [Ping timeout: 258 seconds]
fengb has joined #zig
<companion_cube>
that's what webasm is for!
<Tetralux>
Except that webasm is not machine code xD
<fengb>
wasm can't fix UI :(
fengb has left #zig [#zig]
<tgschultz>
^
fengb has joined #zig
<fengb>
It's funny though. Web sucks just like every other UI toolkit
<Tetralux>
"It's rotten all the way down."
<fengb>
I've never seen a UI that's good for consumers and developers
<fengb>
framework*
<Tetralux>
Define your "good" :p
<fengb>
We should just get rid of users. Then our jobs can be nice
<Tetralux>
arent we users too though? XD
<fengb>
Tetralux: I'm semi-tempted to write a wasm baremetal VM. See if I can get a real "OS" going
bheads has joined #zig
<bheads>
just dont leave that in stage 2
<bheads>
I have a few D apps that cant compile in 32bit
<bheads>
cause OOM sucks in your compiler
<Tetralux>
fengb: or a web browser that can run x64 machine code at native speed ;)
allan0 has joined #zig
<fengb>
If anything, our ecosystem is doing the opposite. Electron shells for everyone! 🤮
<Tetralux>
why anyone would use 'electron' as a name for something that is so slow is beyond me.. unless im being cynical anyway
<fengb>
Marketing. It sounds faster
<Tetralux>
clearly a browser that runs x64 should be called positron.
<Tetralux>
no-one steal that name ó.ó
qazo has joined #zig
qazo_ has joined #zig
qazo has quit [Ping timeout: 245 seconds]
<daurnimator>
Tetralux: time to start work on it. in zig.
<Sahnvour>
I'm trying to switch on an integer i, covering all possible values from 0 to n. I would like to use i as a comptime value in my case, but it seems it's not possible :( `inline switch` anyone ?
<daurnimator>
Sahnvour: what is the error/issue? pretty sure i've switched on comptime befre
<Sahnvour>
the value isn't comptime, but as my switch covers all possible values, I wanted to have cases for ranges of values (for example `3...10`) where I would be able to use the 3...10 value as comptime
<Sahnvour>
to avoid repetition
qazo_ has quit [Ping timeout: 258 seconds]
<daurnimator>
Sahnvour: oh I get it: what is 'n' in your case? a power of two?
bheads has quit [Quit: bheads]
qazo has joined #zig
<andrewrk>
mikdusan, brilliant, thanks for the reduction
<andrewrk>
schme245, yes that's correct on both counts
<scientes>
scientes, I'm waiting for the copy elision branch and then planning on working on that
<scientes>
oh hes gone
<mikdusan>
stat: when zig runs from empty-cache `zig test std/std.zig ...` it performs 46 million total malloc's and 32-byte is the favourite :)
<emekankurumeh[m]>
social_cues:
halosghost has quit [Quit: WeeChat 2.5]
porky11 has quit [Quit: Leaving]
fengb has quit [Ping timeout: 260 seconds]
<samtebbs>
46 million mallocs O.O
qazo has quit [Read error: Connection reset by peer]
<Sahnvour>
daurnimator: it's a size of remaining data, from 0 to 31, and every 8-sized range has the same behaviour except it uses a different constant, from 0 to 31
<scientes>
oh i see
<daurnimator>
Sahnvour: so do you have it as a comptime_int? or as a `comptime u5`?
<daurnimator>
Sahnvour: a comptime_int is arbitrary precision; vs a comptime-known integer of known size.
<Sahnvour>
it's a bare u5, but what I want in the end is to generate 32 cases, just more succinctly
<Sahnvour>
and each case would use its value as a comptime_int
moo has joined #zig
<daurnimator>
Sahnvour: so you're just looking for something better than: `const i = foo(); switch(i) { case 0..n: do_something_with(i); ..........` ?
<Sahnvour>
yes
<Sahnvour>
where I would do `0...8 => |i| foo(i),` and i would be comptime, for example
<daurnimator>
letoram: zig-arcan-shmif when? :)
wootehfoot has quit [Ping timeout: 258 seconds]
<letoram>
daurnimator: likely at the very end, zig-arcan-tui is a much more reasonable target
<andrewrk>
daurnimator, I still use that music player every day (listening now in fact) and planning on a rewrite in zig once networking & package manager is available
<daurnimator>
andrewrk: if you ever do revisit audio tagging; I have many war stories to share
<andrewrk>
I have a plan for that
* daurnimator
now just uses spotify....
<andrewrk>
it's just ffmpeg outputting a new audio file with updated tags, and then checking that the output audio is byte-for-byte identical after the tags are updated, and then atomically replacing the original file