00:18
<
Cadey >
Xavi92: look up the bring your own OS support
00:34
dingenskirchen has quit [Remote host closed the connection]
00:34
dingenskirchen has joined #zig
01:02
doublex_ has quit [Ping timeout: 260 seconds]
01:04
doublex has joined #zig
01:05
doublex has quit [Read error: Connection reset by peer]
01:05
doublex_ has joined #zig
01:06
doublex_ has quit [Read error: Connection reset by peer]
01:07
doublex has joined #zig
01:07
nephele has quit [Ping timeout: 246 seconds]
01:08
doublex has quit [Read error: Connection reset by peer]
01:08
doublex has joined #zig
01:08
nephele has joined #zig
01:09
doublex has quit [Read error: Connection reset by peer]
01:09
doublex has joined #zig
01:10
doublex has quit [Read error: Connection reset by peer]
01:10
doublex has joined #zig
01:13
doublex has quit [Read error: Connection reset by peer]
01:13
doublex_ has joined #zig
01:15
doublex_ has quit [Read error: Connection reset by peer]
01:15
doublex has joined #zig
01:17
doublex_ has joined #zig
01:17
doublex has quit [Read error: Connection reset by peer]
01:18
doublex_ has quit [Read error: Connection reset by peer]
01:18
doublex has joined #zig
01:23
doublex has quit [Read error: Connection reset by peer]
01:23
ifreund has quit [Ping timeout: 265 seconds]
01:23
doublex has joined #zig
01:28
doublex has quit [Ping timeout: 272 seconds]
01:29
dingenskirchen1 has joined #zig
01:31
dingenskirchen has quit [Ping timeout: 260 seconds]
01:31
dingenskirchen1 is now known as dingenskirchen
01:38
aerona has joined #zig
01:57
doublex has joined #zig
02:37
_Vi has quit [Ping timeout: 246 seconds]
02:39
daex has quit [Ping timeout: 260 seconds]
02:40
daex has joined #zig
03:32
dingenskirchen has quit [Remote host closed the connection]
03:32
dingenskirchen has joined #zig
03:35
fraktor has joined #zig
03:38
waleee-cl has quit [Quit: Connection closed for inactivity]
03:47
stripedpajamas has joined #zig
03:47
stripedpajamas has quit [Client Quit]
03:53
dddddd has quit [Ping timeout: 256 seconds]
04:02
_whitelogger has joined #zig
04:20
benjif has quit [Ping timeout: 246 seconds]
05:19
dingenskirchen has quit [Remote host closed the connection]
05:19
dingenskirchen has joined #zig
05:23
aerona has quit [Quit: Leaving]
05:47
_whitelogger has joined #zig
05:56
ur5us has joined #zig
06:41
ur5us has quit [Ping timeout: 246 seconds]
07:08
daex has quit [Ping timeout: 246 seconds]
07:08
daex_ has joined #zig
07:15
cole-h has quit [Quit: Goodbye]
07:17
<
pixelherodev >
andrewrk: you're brilliant
07:17
<
pixelherodev >
Context: using disassembler to verify codegen
07:17
<
pixelherodev >
*Genius*.
07:18
<
pixelherodev >
Modified my codegen to emit `.org` and `.byte RAW_MACHINE_CODE_HERE` for easy copy+paste debugging
08:39
xackus has joined #zig
08:59
ur5us has joined #zig
09:23
dddddd has joined #zig
10:03
ur5us has quit [Ping timeout: 260 seconds]
10:10
ifreund has joined #zig
10:11
neceve_ has joined #zig
10:41
<
ifreund >
ugh, i hate gui toolkits. Trying to add support for river to waybar and gtk is being a royal pain
10:42
<
ifreund >
i mean, mostly cause I don't know what I'm doing, but man this stuff is overcomplex
10:52
<
ttmrichter >
The history of every GUI toolkit ever: "This other crap is too complex. I'll make my own GUI toolkit, only with hookers and blow." "Huh, OK, this one thing I do over and over again is pretty verbose, so I'll add an API call for it." ← repeat previous a thousand times…per week…per developer… "This crap is too complex. …"
10:52
<
ikskuh >
sadly, it's not that easy
10:52
<
ikskuh >
gui is inherently massivly complex in itself
10:59
<
ifreund >
yeah, I do get that on some level but it's not gonna stop me from complaining :D
11:30
<
scientes >
gui also needs to be more MVC
11:30
<
scientes >
but the real problem is that most apps can't just use stock widgets
11:30
<
scientes >
they need something special
11:30
<
scientes >
and GUI programming is just boring
11:32
KoljaKube has joined #zig
11:36
<
ifreund >
aaaaaah my code was fine i just fucked up the CSS
11:36
<
ifreund >
and yeah i also find GUI programming boring as hell, but sometimes I want something done so I need to do it myself
11:37
<
ifreund >
well, nice waybar now shows river's tags
11:44
<
KoljaKube >
What's a river?
11:44
greenfork has joined #zig
11:46
<
KoljaKube >
Hm, if method parameters are const, are dot-functions not able to modify their subject?
11:48
<
ifreund >
KoljaKube: they are if you pass by non-const pointer
11:48
<
ifreund >
e.g. fn do_something(self: *@This()) void { self.x += 1; }
11:51
frmdstryr has quit [Ping timeout: 260 seconds]
12:29
dermetfan has joined #zig
12:29
<
KoljaKube >
ifreund: I thought I had tried that, but I must have done something else wrong. Your solution works :-)
12:30
_Vi has joined #zig
12:50
craigo has quit [Ping timeout: 260 seconds]
12:50
ifreund has quit [Quit: WeeChat 2.8]
12:51
ifreund has joined #zig
13:08
KoljaKube has quit [Ping timeout: 260 seconds]
13:18
<
iwq >
can you read and write to a file at comptime in zig?
13:20
<
ikskuh >
no, there's no option for syscalls or I/O at comptime
13:20
<
ikskuh >
but you can get a buffer for a file with @embedFile
13:23
<
iwq >
interesting, I was thinking if something like F# Type Providers could be possible in Zig
13:23
<
iwq >
so you could turn a json file into a Zig type
13:24
<
ikskuh >
that sounds like a code generator job to me
13:24
<
ikskuh >
just write a program that does this ;)
13:42
dingenskirchen has quit [Quit: dingenskirchen]
13:42
dingenskirchen1 has joined #zig
13:44
benjif has joined #zig
13:44
dingenskirchen1 is now known as dingenskirchen
13:54
_Vi has quit [Ping timeout: 246 seconds]
13:57
<
pmwhite >
It would be nice if you could test multiple nullable values at once, like `if (a and b) |c, d| { ... }`
13:57
<
ikskuh >
you can do
13:57
<
ikskuh >
if(a != null and b != null)
13:57
<
ikskuh >
then just use a.? and b.?
13:58
<
pmwhite >
I suppose, but that's more lamer.
13:59
<
ikskuh >
nah, it's perfectly fine :D
14:04
<
pmwhite >
Okay, fine.
14:05
<
ifreund >
if (a) |c| if (b) |d| { } works
14:22
<
pmwhite >
Oh, that's not bad. I didn't think of that.
14:30
KoljaKube has joined #zig
15:06
Akuli has joined #zig
15:13
<
KoljaKube >
Is there a reason why the documentation does not use @This for dot functions? Should I not use it?
15:16
ask6155 has joined #zig
15:16
<
ask6155 >
hey, how do I jump to definition? vim)
15:18
dingenskirchen has quit [Quit: dingenskirchen]
15:19
dingenskirchen has joined #zig
15:22
<
ikskuh >
ask6155: search for "NAME ="
15:22
<
ikskuh >
when you use zig fmt, you can be safe that "NAME =" is either definition or assignment
15:23
<
ifreund >
KoljaKube: I personally put a `const Self = @This();` at the top of most of my files and use that
15:24
<
KoljaKube >
Nice idea
15:24
<
ifreund >
not original, I stole it from the std :P
15:25
<
ifreund >
neat, i never mananged to get ctags working. Have zls now though which is even nicer
15:26
<
ask6155 >
I don't understand what your saying but I'd like to goto the definition of functions. like gd std.debug.warn
15:27
<
KoljaKube >
Heh, didn't know gd yet
15:27
<
ifreund >
ask6155: gd works through ctags usually
15:28
<
ask6155 >
so do I just install ctags, run ctags in directory and
15:29
<
KoljaKube >
Yeah, install universal ctags, run `ctags -R .`
15:29
<
KoljaKube >
You will need to re-run that occasionally, of course
15:29
<
KoljaKube >
Also allows jumping to function definitions via C-] across file boundaries and such
15:30
<
ifreund >
it's still young and has bugs/missing features, but I've found it quite useful
15:30
<
leeward >
For what it's worth, etags works fine with zig too.
15:30
<
leeward >
Though I hear emacs isn't cool.
15:31
<
KoljaKube >
Hm, zls master does not build
15:31
<
ifreund >
KoljaKube: you need master zig
15:31
<
ifreund >
yeah, such is the cutting edge
15:31
dermetfan has quit [Ping timeout: 246 seconds]
15:32
<
KoljaKube >
Can't build that through Homebrew, and really don't like manually installing tarballs all the time :-/
15:32
<
ifreund >
leeward: vim isn't cool anymore either, gotta use a real hipster editor like Kakoune these days
15:32
<
leeward >
ifreund: way too cool for me
15:32
<
ifreund >
ah yeah mac package managment is kinda nasty
15:32
<
KoljaKube >
Damn, I need to switch editors again?
15:33
<
KoljaKube >
Well, it's just that one linker bug iirc
15:33
<
KoljaKube >
Homebrew can do source builds
15:33
<
leeward >
KoljaKube: I just have a local Zig repo. Zig is in so much flux that it doesn't make a ton of sense to use a package manager.
15:33
<
ifreund >
i mean my distro managed to package llvm in a non-broken way
15:34
<
ifreund >
i think most others did as well
15:34
<
leeward >
Mine too. I use the distro for Zig's dependencies.
15:34
<
leeward >
I thought we were talking about Zig from tarballs, not llvm.
15:35
<
ifreund >
yeah i don't use tarball zig either, though on mac you might need to since homebrew's llvm is causing bugs last I checked
15:38
<
ask6155 >
so is zig written in c++?
15:38
<
ifreund >
the stage1 compiler is
15:39
<
leeward >
And there's work being done on making it self hosted.
15:39
<
ifreund >
and the stage2 is written in zig?
15:39
<
ifreund >
there is also an open issue about porting stage1 to C in order to ease bootstrapping
15:39
<
ask6155 >
and the binaries produced run on bare metal?
15:40
<
leeward >
Bare metal or any supported OS
15:40
<
ask6155 >
I think this is C better
15:41
<
ask6155 >
would love a zig for C programmers page.
15:42
<
ifreund >
I mean, if you're like me and already had a good understanding of C jumping in shouldn't be too hard
15:42
<
ifreund >
skimming the docs leeward linked should be all you need to get started
15:43
ask6155 has quit [Quit: leaving]
15:43
<
leeward >
If you run into problems, there are some super helpful people in here too.
15:43
greenfork has quit [Quit: WeeChat 2.8]
15:52
<
KoljaKube >
The config setup flipped all slashes in my stdlib path, but other than that initial impressions of zls are indeed very shiny
15:54
<
ifreund >
heh, i think the main dev is on windows
15:54
<
KoljaKube >
That would explain it
15:54
aerona has joined #zig
15:55
<
ifreund >
i started using it before it had a setup tool, so i never had this problem :D
15:55
<
KoljaKube >
Before I need to go, is there a way to create type-safe aliases of simple types?
15:55
<
KoljaKube >
Use case is having radians and degrees not being accidentally interchangeable
15:56
<
scientes >
ughh, c++ has way too many features
15:57
<
leeward >
KoljaKube: There may be a better way, but structs?
15:57
<
leeward >
That's not exactly what you want.
15:58
<
leeward >
Actually, there might be something with unions there.
15:58
<
leeward >
They put restrictions on how they're interpreted.
16:01
<
KoljaKube >
Sure, structs would work, but I was hoping to prevent having to access a member all the time
16:02
dddddd has quit [Ping timeout: 260 seconds]
16:02
<
leeward >
Yeah, I know. Unfortunately, type aliasing comes with some implicit casting.
16:02
<
leeward >
`const special = u32` works, but any u32 is a special.
16:03
<
KoljaKube >
If I understand correctly unions need comptime knowledge of the field, and tagged unions add a field containing the enum value, right?
16:05
<
KoljaKube >
leeward: Not only that, but `const boring = u32;` and every boring is special, which is what I want to avoid
16:08
<
KoljaKube >
I guess structs it is, then. Nothing good has ever happened by throwing raw floats around ;-)
16:09
<
leeward >
If someone more informed were around, they'd probably point you to a proposal for a feature or something.
16:10
<
KoljaKube >
If someone more informed were to read this, please point, I will read the logs tomorrow ;-)
16:11
<
KoljaKube >
But now it's time to cook, thank you all for the helpful input!
16:13
<
KoljaKube >
Thanks!
16:13
<
ifreund >
as mentioned in the comments, you could use non-exhaustive enums to do this
16:14
<
ifreund >
I haven't tried it personally so I can't really speak to the ergonomics of doing that
16:15
<
leeward >
Ooh, I like the proposal.
16:15
<
leeward >
Using enums to make types like this gives me the squicks.
16:16
waleee-cl has joined #zig
16:17
<
ifreund >
yeah same lol
16:22
<
leeward >
Yeah, enums aren't a solution and `const Vec2 = [2]f32;` could just as easily be a struct.
16:34
KoljaKube has quit [Ping timeout: 246 seconds]
16:35
<
fengb >
Wrapper structs actually feel less kludgy than enums
16:41
<
demizer >
Hey all. Does zig have a module level init() that runs on import like Go?
16:43
<
ifreund >
not too familiar with go, but I dont think so. Remember that files are sructs i zig
16:44
<
demizer >
right, but no way I can find to run some setup code automatically in a struct
16:44
<
ifreund >
how would that work?
16:45
<
ifreund >
like `const foo = struct{ .. };` implicitly calls a magic function?
16:45
<
demizer >
for example, a logging library I use needs some setup, but when I am running "zig test blah.zig" and using this library I would have to call log.init() in the test while debugging.
16:45
<
demizer >
I don't believe a struct should initialize itself
16:45
<
demizer >
that's the problem
16:46
<
fengb >
No, there’s no auto init. That’d be considered hidden control flow
16:46
<
ifreund >
ok, one way you can do this is create a function that you call to import your type
16:46
<
demizer >
oh that's interesting
16:46
<
ifreund >
this function would return the type you want to import and before doing so preform your init thing
16:46
<
demizer >
i'll try that, thank you!
16:46
<
ifreund >
no problem
16:50
<
ifreund >
this doesn't work i think unless the thing you want to do can be done at comptime
16:52
doublex has quit [Ping timeout: 260 seconds]
17:01
doublex has joined #zig
17:05
doublex has quit [Ping timeout: 246 seconds]
17:46
donpdonp_ has joined #zig
17:47
<
donpdonp_ >
if (column.main.inError) "ERROR" else "" => expected type '*const [5:0]u8', found '*const [0:0]u8
17:48
<
donpdonp_ >
i get that the size is part of the type and both arms of the if need to be the same type, i just dont know what to do instead.
17:48
<
pixelherodev >
donpdonp_: @as([]const u8) might help
17:48
<
pixelherodev >
If you treat the two sides as slices instead of arrays it should work
17:50
factormystic has joined #zig
17:50
doublex has joined #zig
17:50
<
donpdonp_ >
pixelherodev: that makes the compiler happy - thx!
17:53
dermetfan has joined #zig
17:53
<
pixelherodev >
No problem :)
18:01
dermetfan has quit [Ping timeout: 246 seconds]
18:11
cole-h has joined #zig
18:27
doublex has quit [Ping timeout: 260 seconds]
18:33
dermetfan has joined #zig
18:47
<
leeward >
pixelherodev: I don't know if I ever mentioned it, but you were completely right about u16 doing what I wanted from a uint_least16_t or uint_fast16_t perspective. I was mixing optimizations into my thinking incorrectly.
19:01
dddddd has joined #zig
19:03
reductum has joined #zig
19:03
swills_ is now known as swills
19:08
doublex has joined #zig
19:09
jjido has joined #zig
19:10
doublex has quit [Read error: Connection reset by peer]
19:10
doublex has joined #zig
19:13
doublex_ has joined #zig
19:13
doublex has quit [Read error: Connection reset by peer]
19:24
dermetfan has quit [Ping timeout: 260 seconds]
19:26
oats is now known as oats3
19:32
_Vi has joined #zig
19:33
dermetfan has joined #zig
19:34
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
19:37
<
pixelherodev >
leeward: :)
19:45
<
ikskuh >
pixelherodev: wanna try something?
*grin*
19:46
jjido has joined #zig
19:47
dingenskirchen has quit [Remote host closed the connection]
19:47
dingenskirchen has joined #zig
19:50
alexnask has joined #zig
19:51
doublex_ has quit [Ping timeout: 246 seconds]
19:58
ur5us has joined #zig
20:03
xackus has quit [Quit: Leaving]
20:05
<
leeward >
Anyone know the magic incantation to get zig fmt to ignore a block? I can't seem to find it, but I have distinct memories of seeing it somewhere.
20:05
<
leeward >
Maybe that's rust fmt or go fmt.
20:05
xackus has joined #zig
20:07
reductum has quit [Quit: WeeChat 2.8]
20:08
<
alexnask >
I think its // zig fmt off
20:08
<
alexnask >
let me find some example
20:09
<
alexnask >
/ zig fmt: off
20:11
<
leeward >
Hmm, it doesn't seem to respect it.
20:12
<
alexnask >
Seems to work with a simple example for me
20:14
<
alexnask >
Can you share some snippet where it isnt respected? (so I can repro)
20:16
<
leeward >
Yeah, I'm trying to make a smaller example and it's working correctly.
20:17
<
leeward >
When I put the `zig fmt: off` block inside the function, it breaks. When it's outside the function, everything's happy.
20:18
<
leeward >
Oh, it has to be at the top level.
20:20
<
alexnask >
Ah, this is definitely surprising I would expect it to work anywhere as well
20:21
<
leeward >
Ok, I have an example.
20:22
<
leeward >
It certainly violates the principle of least surprise. I don't know if there's a spec anywhere though, so can't say it's a bug.
20:23
<
alexnask >
Ι τηινκ ιτ δεσερωεσ α γιτηθβ ισσθε
20:23
<
alexnask >
Oh shit sry
20:23
<
alexnask >
I think it deserves a github issue
20:23
<
leeward >
I was almost there.
20:23
<
leeward >
Stuck on deserves :P
20:23
dermetfan has quit [Ping timeout: 260 seconds]
20:23
<
leeward >
Yeah, I'll open one.
20:25
dongcarl has quit [Read error: Connection reset by peer]
21:01
dermetfan has joined #zig
21:03
doublex has joined #zig
21:06
dermetfan has quit [Ping timeout: 256 seconds]
21:12
neceve_ has quit [Ping timeout: 246 seconds]
21:14
Akuli has quit [Quit: Leaving]
21:17
doublex has quit [Ping timeout: 246 seconds]
21:24
doublex has joined #zig
21:28
oats3 is now known as oats
21:30
nycex- has joined #zig
21:31
nycex has quit [Ping timeout: 240 seconds]
21:37
dermetfan has joined #zig
21:37
doublex has quit [Ping timeout: 260 seconds]
21:39
craigo has joined #zig
21:43
drp_ has joined #zig
21:45
drp has quit [Ping timeout: 256 seconds]
21:57
doublex has joined #zig
21:57
<
scientes >
daurnimator, ?
21:59
ur5us has quit [Ping timeout: 256 seconds]
22:00
drp has joined #zig
22:01
drp_ has quit [Ping timeout: 246 seconds]
22:05
drp has quit [Ping timeout: 258 seconds]
22:15
daex_ has quit [Quit: /me 's znc kicks the bucket]
22:16
daex has joined #zig
22:18
drp has joined #zig
22:21
ur5us has joined #zig
22:23
drp_ has joined #zig
22:23
drp has quit [Ping timeout: 260 seconds]
22:26
xackus has quit [Ping timeout: 272 seconds]
22:33
drp has joined #zig
22:34
drp_ has quit [Ping timeout: 264 seconds]
22:45
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
22:49
craigo has quit [Quit: Leaving]
23:06
xackus has joined #zig
23:10
alexnask has quit [Quit: Leaving]
23:11
xackus has quit [Ping timeout: 260 seconds]
23:38
ur5us has quit [Ping timeout: 256 seconds]
23:56
_Vi has quit [Ping timeout: 246 seconds]