marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
osa1 has quit [Remote host closed the connection]
foobles has joined #zig
<foobles>
anyone know what the different ResolveStatus are for a type?
<foobles>
i need to compare whether 2 types have the same size in bits, do I need to call `type_resolve(ira->codegen, type, ResolveStatusSizeKnown)` on each one and then use `type_size_bits()` on each?
Ashpool has joined #zig
<foobles>
I am a little confused because it looks like in `type_has_bits()` , there is a lot of special casing for whether the type is a struct, currently `ResolveStatusBeingInferred`, etc. it feels like there are some nuances i am missing
ur5us has joined #zig
_whitelogger has joined #zig
johnburton has quit [Quit: leaving]
wootehfoot has quit [Ping timeout: 260 seconds]
fabio[m] has quit [Quit: Idle for 30+ days]
dumenci has joined #zig
lucid_0x80 has quit [Ping timeout: 260 seconds]
tane has joined #zig
amk has quit [Remote host closed the connection]
amk has joined #zig
virkony has joined #zig
dumenci is now known as suskun
suskun has quit [Quit: Leaving]
lucid_0x80 has joined #zig
marnix has quit [Ping timeout: 272 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
foobles has quit [Ping timeout: 245 seconds]
skuzzymiglet has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
earnestly has joined #zig
Kingsquee has quit []
mmohammadi9812 has quit [Ping timeout: 272 seconds]
mmohammadi9812 has joined #zig
marnix has quit [Ping timeout: 260 seconds]
marnix has joined #zig
omglasers2 has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
<dutchie>
this FileNotFound error is very annoying
marnix has quit [Ping timeout: 272 seconds]
marnix has joined #zig
Xavi92 has joined #zig
skuzzymiglet has quit [Ping timeout: 256 seconds]
mmohammadi9812 has quit [Ping timeout: 260 seconds]
mmohammadi9812 has joined #zig
gazler_ has quit [Remote host closed the connection]
ur5us has joined #zig
kristoff_it2 has joined #zig
x2C25 has quit [Ping timeout: 265 seconds]
ur5us has quit [Ping timeout: 264 seconds]
osa1 has joined #zig
wootehfoot has joined #zig
amk has quit [Changing host]
amk has joined #zig
Miaourt has quit [Quit: Bye!]
WilhelmVonWeiner has joined #zig
tane has quit [Quit: Leaving]
lucid_0x80 is now known as suskun
skuzzymiglet has joined #zig
Miaourt has joined #zig
mmohammadi9812 has quit [Quit: Quit]
Miaourt has quit [Quit: Bye!]
osa1 has quit [Remote host closed the connection]
Guest78336 has quit [Quit: Leaving]
suskun has quit [Quit: Leaving]
wootehfoot has quit [Read error: Connection reset by peer]
xackus has joined #zig
omglasers2 has quit [Read error: Connection reset by peer]
<marler8997__>
been using vscode, and the Zig plugin from Marc Tiehuis really causes the editor to lag, anyone else experience this?
karchnu has joined #zig
<Nypsie[m]>
Using the Zig plugin as well and not experiencing any lag. Although, most of my files are not more than 2-3k LoC
<karchnu>
Hello, I read a bit the code for std.event.Loop but I didn't see a code using it. Is it usable? Is there an example, even a bit of documentation somewhere?
<Nypsie[m]>
marler8997__: Do you maybe also have ZLS' semantic highlighting turned on?
<Xavi92>
marler8997__: none so far. However, cpptools *is* really laggy and resource-intensive, at least on x86_64 GNU/Linux
<marler8997__>
Nypsie, my source files aren't that large either
<Xavi92>
I'm using v0.2.4 though - it might be old
<marler8997__>
ZLS is another plugin correct? If so, then no I don't have it installed
<Nypsie[m]>
karchnu: The standard library itself makes use of it. Take a look at std.os.
<karchnu>
Nypsie[m]: nice, thanks.
<Nypsie[m]>
marler8997__: Yeah it's the language server. Not sure why the Zig extension is causing so much lag then. Have you verified all options are set correctly? Maybe it's trying to reach some path it cannot find.
<marler8997__>
Nypsie that's a good suggestion, I'll see what I can find
<ifreund>
zls is pretty awesome, I'd definetly give it a try
<marler8997__>
ifreund, I just tried it, didn't get any syntax highlighting, is it supposed to have it?
<Nypsie[m]>
Yes but you need to enable it explicitly
<ifreund>
idk how to set it up with vscode, I use kakoune
<ifreund>
but yeah I get semantic highlighting for types from zls
<marler8997__>
kakoune huh...maybe I need to check that out?
<alexnask[m]>
"editor.semanticHighlighting.enabled":true, in vscode settings, "enable_semantic_tokens" : true in zls.json
<ifreund>
kakoune is really awesome, it's like what vim should have been
<marler8997__>
alexnask, I assume you can configure it in vscode?
<ifreund>
much more intuitive and without a ton of legacy baggage
<alexnask[m]>
No, I should really implement this
<alexnask[m]>
(the configuration directly in vscode)
<marler8997__>
any idea how I would configure it outside vscode?
<marler8997__>
oh, vscode is saying it needs zls exe in path...ok
<marler8997__>
let's see how long this takes me, start the timer :)
<alexnask[m]>
the zls readme is quite good. But in short you need a zls.json file either next to the executable or in the "local configuration" folder of your OS (AppData on windows, /.config by default on linux)
<marler8997__>
I'm going to forgo reading your helpful message for now and we'll see how easy it is :)
<marler8997__>
oh no...I think compiler version issue
<marler8997__>
let's see if zls documents which compiler version it works on...
wootehfoot has joined #zig
<marler8997__>
looks like it doesn't, but I've updated the compiler and now it builds
<marler8997__>
ran "zig build config"...and I see funny characters in my shell :(
<alexnask[m]>
`Installing zls is pretty simple. You will need a build of Zig master to build zls.`
<marler8997__>
alexnask, I just built it with latest zig
<alexnask[m]>
phrasing is a bit odd, I will improve it since I will stabilize master branch on 0.7.0 anyway
<alexnask[m]>
I know, just saying it is in the README :P
<marler8997__>
semantic highlighting?
<marler8997__>
is that like syntax highlighting?
<alexnask[m]>
It is, its just what they called it in LSP.
<alexnask[m]>
Also more powerful since its not just regex based
<Nypsie[m]>
It's basically highlighting based on the parsed AST, I believe
<alexnask[m]>
Note that I havent worked hard to optimize this and there are still a couple of bugs (although pretty rare), I would suggest using a release build
decentpenguin has quit [Ping timeout: 272 seconds]
<marler8997__>
ok got it working
decentpenguin has joined #zig
<marler8997__>
so far much less lag than the Zig plugin
<alexnask[m]>
Here is an example of how you can configure the token colors in vscode (you can differentiate between functions and generic functions, structs and other types etc. ) if you are interested as well ;) https://hastebin.com/cutekisepi.lua
<marler8997__>
that's pretty cool
<marler8997__>
oooo, autocomplete
<marler8997__>
been a while since I had something like that
<ifreund>
goto definition is even better :)
<alexnask[m]>
It even supports custom packages set in build.zig ;)
<ifreund>
indeed, and I have started making use of that recently
<ifreund>
how does that even work though? do you interpret the bulid.zig?
<alexnask[m]>
No I use a custom build runner and extract all the packages defined in all steps
<ifreund>
hice
<ifreund>
s/h/n/
<alexnask[m]>
Due to a caching bug (changing the path of a package in the cli doesnt invalidate the cache of a zig run command), I have to copy it next to build.zig, run it then delete it so if you see a stray build_runner.zig you should delete it
<ifreund>
heh, I have seen that pop up a few times
<alexnask[m]>
That was before 6250 though so I have to check this again, I can probably do this better or fix the compiler to support this
<ifreund>
I wish the zig build system could expose the cache system somehow, would be useful for generated code
<alexnask[m]>
At least it uses the stdlib cache_hash algorithms now, one my major stumbling blocks for supporting cimport and/or @import("builtin") was the old C++ system
<alexnask[m]>
I will reevaluate those in the coming days
<karchnu>
Nypsie[m]: from what I see, there is no abstraction in std.os to be able to use either kqueue or epoll depending on the OS we build for.
<karchnu>
Is that correct?
<alexnask[m]>
Well, std.event.Loop uses both but if you want to write your own, no, you have to interact with the low level APIs
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
waleee-cl has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
CodeSpelunker has joined #zig
marnix has joined #zig
wilsonk has joined #zig
wilsonk is now known as Guest91899
omglasers2 has joined #zig
Kena has joined #zig
<Kena>
Please what are the incentives for using binary and hexadecimal notations (i.e. `0b` and `0x`) over decimal integers?
<alexnask[m]>
In hex, a pair of two digits is a byte
<alexnask[m]>
So in both notations digits/byte is stable, unlike base 10
<Kena>
What do you mean by stable?
<alexnask[m]>
Well, a pair of hex digits can always be encoded in 1 byte
<alexnask[m]>
Also the information density is higher, so you need less digits
<ifreund>
hex may be much more readable when you need to think about the bit representation of something
<alexnask[m]>
(compare that to say base 10 where for example a 5 digit number will sometimes need 2 bytes to be encoded, sometimes 3)
<ifreund>
i.e. 0xFFFF instead of 65535
<ifreund>
and binary is just a long form of the same thing (0b111111...111)
<karchnu>
alexnask[m]: that was my first question, to see an example of std.event.loop usage. In std.os there is very few examples, from what I saw. I guess I'll just try by myself.
<alexnask[m]>
karchnu: The event loop is still quite experimental.
<alexnask[m]>
However, the usual way you use it is just by using the regular IO functions in stdlib, but with `pub const io_mode = .evented;` in your root file, they will switch over the mode at comptime and register themselves into a global instance of the Loop when necessary
<alexnask[m]>
Relevant source code files are special/start.zig (sets up a loop instance and runs it when in evented mode), std/event/loop.zig, std/os.zig
<alexnask[m]>
I prefer `var buf: [std.fmt.count("{}/{}", .{ build_options.rundir_parent, std.math.maxInt(os.uid_t) })]u8 = undefined;` personally : D
<ifreund>
right, you can do that
<ifreund>
that would be a little nicer
<Kena>
Thanks ifreund and alexnask[m]
Guest91899 has quit [Ping timeout: 240 seconds]
<Kena>
So 2 bytes = ( 2^16) bits ?
<braket>
2 bytes = 2^4 bits (16). So 2 bytes gives you 2^16 possible values, if that’s what you meant
<karchnu>
`var buf = [1]u8{undefined} ** number` this is an allocation of a single array of u8, of an undefined size × number ? That is convoluted. :D
<Kena>
Yes I understand clearly now, thanks braket :)
<braket>
np!
<Kena>
karchnu you can not multiply a undefined size, it makes no sense both for a human or a compiler. You'll raise a compile error.
<Kena>
Moreover, your array has a length == 1
<karchnu>
yes, not undefined size, undefined value actually
<ifreund>
it's a array of length 1 of undefined value repeated N times
<ifreund>
resulting in an array of length N
<Kena>
yes sorry, undefined value. On another note, an array may be declared as `const` as its values won't mutate and because is known at compile-time.
<Kena>
*and because its length is known at compile-time.
<alexnask[m]>
`var` forces number to be a runtime value
<Kena>
weird, I thought I already tried before but yes it compiles with `const`. But thanks for the piece of information because I thought once the length array was declared it couldn't be changed afterwards.
<ifreund>
that is the case
<alexnask[m]>
Kena: The length applies to the array literal
<alexnask[m]>
You should think of the literal any array value, its not special in any way
<alexnask[m]>
So for example `const A = [1]u8{1} ** 5;` is equivalent to `const B = [1]u8{1}; const A = B ** 5;` The length of B will be 1, but the length of A will be 5. Does that make sense?
<alexnask[m]>
s/any/as any/g
wootehfoot has quit [Read error: Connection reset by peer]
wootehfoot has joined #zig
<Kena>
Allright, I didn't tought that the multiplication pattern `**` could modify the length during the initialization.
<Kena>
ziglearn.zig emphases much more on slices than arrays by the way.
<g-w1>
I get a compile error when building zls. where it uses .macosx instead of .macos. Am i using the wrong compiler version, or is this going to be fixed. im on master.
<g-w1>
once i switch .macosx to .macos it works
<ifreund>
g-w1: that was fixed a while ago, try udating zls and submodules
<Nypsie[m]>
You probably have to update Knownfolders submodule
<g-w1>
ah
Kena has quit [Remote host closed the connection]
<g-w1>
it works. thanks
SimonNa has quit [Remote host closed the connection]
SimonNa has joined #zig
radgeRayden_ has quit [Ping timeout: 272 seconds]
Kena has joined #zig
<Kena>
It's awfully quiet for a release day.
Kena has quit [Remote host closed the connection]
hnOsmium0001 has joined #zig
CodeSpelunker has quit [Remote host closed the connection]
<ifreund>
andrew's probably hard at work
skuzzymiglet has quit [Ping timeout: 256 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
Kena has joined #zig
<Kena>
I hope his core contributors support him because it would be sad if he was really alone to undertake all the workload.
riba has joined #zig
mmohammadi9812 has joined #zig
Kena has quit [Remote host closed the connection]
foobles has joined #zig
<foobles>
does anyone see any potential issues with changing `get_codegen_ptr_type()` to not return a nullptr when called on a `?*zero_size_type`, which it does currently?
<foobles>
I make it test the "full type" for being zero bits instead of the pointer-type, because `?*zero_size_type` does use 1 bit in memory even though `*zero_size_type` takes zero bits
<foobles>
so now it doesn't return nullptr when called on optional pointers to zero-sized-types, can that cause issues I wouldn't expect? I did this to fix an ICE
dongcarl has quit [Quit: Ping timeout (120 seconds)]
dongcarl has joined #zig
a_chou has joined #zig
<foobles>
the only issue is that the function used to never be able to return a zero-size pointer (because it would return nullptr if the POINTER type was zero bits), but now it can if the pointer type is zero-bits but is optional
marnix has quit [Ping timeout: 256 seconds]
Kingsquee has joined #zig
marnix has joined #zig
stripedpajamas has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
riba has quit [Ping timeout: 246 seconds]
stripedpajamas has quit [Ping timeout: 258 seconds]
virgohg has joined #zig
<virgohg>
I'm trying to do REST in Zig.
<Nypsie[m]>
virgohg: Are you running into issues, or what's your question?
<virgohg>
Oops, never mind. Wrong time to ask :|
<Nypsie[m]>
Oh ok. Feel free to ask anytime tho, I've some experience creating a REST API in Zig.
<virgohg>
Thanks, but I'm trying to create an interface to already existing REST API
<virgohg>
It is for creating a bot
<Nypsie[m]>
There's some http request libraries out there too :) Anyway, let us know if you're running into any issues. Plenty of great people around here willing to help
x2C25 has joined #zig
a_chou has quit [Ping timeout: 246 seconds]
<virgohg>
But the REST API requires TLS. Any recommendations?
<lunamn>
you can use pre-existing TLS libraries: openssl, mbedtls, wolfssl, etc
<rom1504>
node is pretty much the only language with a working package manager, so not sure what you mean, but this seems to be off topic
<fengb>
Uhhhh npm isn’t working
<virgohg>
And there is way too much "WARN deprecated" dependencies :/
<rom1504>
any example in mind of a better package manager ? (for any other language)
<virgohg>
Currently cargo for rust.
<fengb>
Every other language probably has a better one
<rom1504>
fengb: not true
<fengb>
npm doesn’t even do reproducible builds
<fengb>
They added a lock file that’s blissfully ignored half the time
<rom1504>
I don't have a lot of experience with rust/cargo, I'll trust you on that
<virgohg>
Is there a proposal for reproducible build support for package system in Zig?
<rom1504>
you need to use npm ci if you want reproducible builds
<rom1504>
but seeing how pip doesn't have dependency resolution, gradle is bad at transitive dependencies (and let's not talk about c++), npm is better in that regard than other ones
<rom1504>
is cargo good at transitive dependencies ?
<virgohg>
I didn't have transitive dependency before
<virgohg>
So I can't say anything about it
<rom1504>
can I depend on B and C, with B depending on D==1.0.0 and C depending on D==2.0.0 without having a broken program at the end ?
<rom1504>
that's the big question
<rom1504>
for pip and gradle, the answer is no
<virgohg>
Looks like yes
<rom1504>
ok, nice then, I do hear a lot of good things about rust
<virgohg>
Yes, rust is pretty nice, but it kinda antagonizes object oriented programming
<virgohg>
It does not conduce too excellently to OOP.
<virgohg>
But it is still doable nevertheless.
a92 has joined #zig
tane has quit [Quit: Leaving]
a92 is now known as mmmmmmmmmmmmmmmm
mmmmmmmmmmmmmmmm is now known as nnnnnnnnnnnnnnnn
nnnnnnnnnnnnnnnn is now known as a92
<g-w1>
if I want to add std.fs.{openDir, access}Absolute to stdlib, should I make a proposal or just make a pr?