laaron has quit [Remote host closed the connection]
andersfr has quit []
laaron has joined #zig
eagle2com has joined #zig
<mq32>
just noticed that extern is really overloaded as a keyword
hio has joined #zig
vexu has joined #zig
Tetralux has joined #zig
Ichorio_ has joined #zig
<daurnimator>
mq32: did you reread the conversation from yesterday?
<mq32>
i think i followed a bit, but not quite sure what you mean in particular (except for "extern beeing overloaded")
<daurnimator>
mq32: I was just referring to my own realisation of the same. 00:41:47 <daurnimator>wow `extern` is really overloaded in meanings isn't it
<daurnimator>
mq32: heh yep I was thinking about the same issue
<mq32>
i think it's one of the most anticipated issues right now
Ichorio_ has quit [Ping timeout: 264 seconds]
_whitelogger has joined #zig
<nrdmn>
daurnimator: should struct methods be pub? My demo code works fine without them being pub
<daurnimator>
nrdmn: yes. in future non-pub methods will not be visible outside of the struct I think
<nrdmn>
ah okay
<Tetralux>
daurnimator: Really? Will there be a way to specify the current behavior?
<nrdmn>
can `struct`s have a different memory layout than an `extern struct`?
<daurnimator>
Tetralux: okay now I'm having trouble finding the relevalt issue. what do you mean by current behaviour?
<daurnimator>
nrdmn: yes. a plain `struct` has undefined field order and padding.
<Tetralux>
Accessible from file scope, hidden outside file scope.
<daurnimator>
nrdmn: `extern struct` means "same as C struct layout"
<daurnimator>
nrdmn: and `packed struct` means no padding: I mean exactly what I say. in order.
<daurnimator>
Tetralux: ah right. I think I got confused. nrdmn: `pub` means "visible outside the current file".
<daurnimator>
though that has always seemed a bit weird to me
<daurnimator>
==> now that files are structs.. surely it should just meatn "visible outside current struct"
<Tetralux>
But you said that non-pub may become invisible outside the _struct_.
<daurnimator>
Tetralux: yeah sorry. that's only true in my head ;P
<Tetralux>
Does "current struct" mean, `@This()`, or the current file's scope struct?
<daurnimator>
Tetralux: I intended to mean `@This()`
<Tetralux>
Ah yeah - in that case my point still stands I think xD
<Tetralux>
I'd want to be able to export to file scope, but not outside the current file.
<Tetralux>
Maybe `prot fn`
<Tetralux>
(protected)
<Tetralux>
But maybe that's not clear enough.
<Tetralux>
I'd rather `file` honestly - if not for the pollution.
<daurnimator>
Tetralux: I on the other hand like to imagine that `@import("foo.zig")` is the same as writing `struct { <contents here> }`
<daurnimator>
which.... aside from this issue (and obviously file names/line numbers is traces): it is
<Tetralux>
Your suggestion would make it more consistent, sure.
<Tetralux>
Then without pub, the fn would not be accessible from outside the current struct - be it file scope or struct within file.
<Tetralux>
But that would mean that for a file to use the methods of a struct defined within it, they'd have to be pub.
<mq32>
afaik the intent behind "pub" is hiding it from other files and imho that should stay like it. having in-module information hiding only prevents coders from beeing explicit and introduces a lot of unnecessary code
<daurnimator>
so an interesting thing would be to make it available in the std library
<Tetralux>
daurnimator: They didn't have that before?
laaron has joined #zig
<Tetralux>
Please tell me that programs didn't search by exe name to open another processes' stdin or something.
<daurnimator>
> open another processes' stdin
<daurnimator>
wut?
<Tetralux>
So that it can write to it?@
<daurnimator>
Tetralux: the point is more that the whole of "waiting" linux is based around waiting on a file descriptor (select/poll/epoll). However if you want to know if a process exited then you need to call the `wait` syscall instead
<Tetralux>
.. but using this new syscall means you can just epoll/etc on it to wait for it.
<daurnimator>
which has meant that waiting for X fd to be ready *OR* process Y to exit has been either unreliable or CPU intensive
<daurnimator>
Tetralux: exactly
<Tetralux>
I see.
<Tetralux>
That _does_ seem like that took them long enough! xD
<daurnimator>
yep. I've been wanting it since 2005 or so
<daurnimator>
so.. huzzah!
dimenus has joined #zig
<mq32>
daurnimator, oh, neat
<mq32>
thanks for clarification
<daurnimator>
mq32: ..... uh. on ?
<mq32>
the syscall thing :)
<mq32>
i wasn't aware of that yet
<daurnimator>
`pidfd_open`?
<mq32>
yeah
<mq32>
didn't had the requirement to wait for child processes, but maybe in the future :)
<Tetralux>
I've been getting several pretty fatal weirdnesses.
<Tetralux>
Or so it seems.
<daurnimator>
mq32: one "trick" is to give an FD to a process and wait for it to get closed.
<Tetralux>
Things like optionals implicitly casting away without compile errors.
<Tetralux>
And
<Tetralux>
More troublingly.
<daurnimator>
which is posixly correct. but rarely works in reality
<Tetralux>
Implict cast between !*T (for T = @OpaqueType()) and U. (U = unrelated `struct`.)
<Tetralux>
correction: "and !U"
<mq32>
daurnimator, yeah i already have a project where i use single pipe fd to my epoll that i can use to cancel that epoll :(
<daurnimator>
mq32: use an eventfd2 for that :)
<daurnimator>
suprisingly faster.
<mq32>
okay, never heard of that
<daurnimator>
mq32: on non-linux you don't even need it IIRC
<daurnimator>
e.g. on solaris you can just `port_send`
<mq32>
i'm only coding stuff on linux and windows
<mq32>
(and embedded, but that doesn't count)
<daurnimator>
FWIW dragonflybsd's kqueue is the best model for polling
<daurnimator>
if you design for dragonfly... and then add hacks/workarounds for linux/solaris/other bsds. then you won't end up with a bad result
<daurnimator>
on the other hand, windows.... is a mess. you really need to delve into AFD to get things right. And I can count on one hand the people that know that stuff
vexu has joined #zig
<fgenesis>
AFD=?
<daurnimator>
fgenesis: advanced function driver
<fgenesis>
the name alone is cringey
<daurnimator>
fgenesis: it's the piece of windows that handles TCP/UDP
dimenus has quit [Read error: Connection reset by peer]
<daurnimator>
fgenesis: sorry, Ancillary Function Driver...
<fgenesis>
even better
bgiannan has joined #zig
<Tetralux>
What should I do if I get this from Zig when trying to build:
<Tetralux>
I don't think that's the problem though, I think that's a secondary problem.
<Tetralux>
The cmdline was `zig build-exe -target x86_64-windows file.zig` and all the stack trace that it _does_ print both before and after the segfault do not have debug information.
companion_cube has quit [Ping timeout: 244 seconds]
<emekankurumeh[m]>
can someone else confirm if stack traces are broken on windows?
<Tetralux>
Note that what I've posted is the output when cross compiled from Linux.
radgeRayden has joined #zig
<Tetralux>
If I attempt to compile it on Windows, it just says that an assertion failed and tells me that it cannot dump the stack trace: Unable to dump stack trace: Unable to open debug info: InvalidPEMagic
<emekankurumeh[m]>
i'm talking about a separate issue (I think)
<Tetralux>
I'd be amused if it was the same one xD
<emekankurumeh[m]>
lld seems to have changed where it places the pdb path in the binary breaking stack traces
<emekankurumeh[m]>
go to getPDBAPath in std/coff.zig and change the section it looks in from .rdata to .buildid
<emekankurumeh[m]>
hmm, ever since I updated my system llvm/lld stack traces have been broken
<mikdusan>
i use the same llvm binary package that CI server does. but other than that, msvc compiler driven by msys64 environment
<emekankurumeh[m]>
perhaps it's because i'm targeting windows gnu
<fgenesis>
what about targeting a non-moving system, like xp, that would at least be viable and guaranteed to work :P
<emekankurumeh[m]>
can you try listing all the sections in your executable?
<Tetralux>
I have, .text, .rdata, .data, .pdata, .rsrc, and .reloc.
Tetralux_ has joined #zig
Tetralux has quit [Ping timeout: 245 seconds]
Tetralux_ is now known as Tetralux
return0e has quit [Ping timeout: 248 seconds]
darithorn has joined #zig
return0e has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
radgeRayden has quit [Quit: Ping timeout (120 seconds)]
Akuli has joined #zig
kristoff_it has joined #zig
firefox317 has joined #zig
<firefox317>
andrewrk: Are you streaming tonight?
eagle2com has quit [Ping timeout: 245 seconds]
<Sahnvour>
emekankurumeh[m]: I'm doing improvements in coff/pdb parsing as it wasn't able to read it from link.exe, might as well benefit lld if the behaviour changed
radgeRayden has joined #zig
<Sahnvour>
this close to have stack traces finally working in zig1, too, but there's something that gives me headaches at the moment
kristoff_it has quit [Remote host closed the connection]
kristoff_it has joined #zig
fubd has joined #zig
<fubd>
I have: if (thing_maybe) |thing| {} else { do_something(); }
<fubd>
but if (!thing_maybe) { do_something(); } doesn't work
<fubd>
am I missing an obvious null check from the docs?
kristoff_it has quit [Ping timeout: 245 seconds]
fubd has quit [Remote host closed the connection]
<gonz_>
I haven't done it, but you could try `thing_maybe orelse do_something()`
<gonz_>
The "haven't done it" part is to have it naked, not as part of an assignment
<scientes>
gonz_, you mean like in a function call?
<gonz_>
Oh, he quit :|
<gonz_>
That's too bad
<gonz_>
scientes: I just wanted to put a disclaimer on it saying I haven't used it as a naked expression not assigning to anything
<gonz_>
I wouldn't *expect* it to not work, obviously, but you never really know and I didn't try it out before suggesting it
<scientes>
that's why we have tests
<scientes>
hmmmm, no test for that
<scientes>
but wait
<scientes>
you would probably just want to use "or" in that case
<scientes>
as it would be the same
fubd has joined #zig
<fubd>
gonz_: i check the logs :) irc connectivity is tough, i would be into a discord bridge or something
<fubd>
ah ok i see, i'll try something like that
<fubd>
ah yeah, the problem with those two
<gonz_>
scientes: No, I think it has to be `orelse`
<Tetralux>
I'm excited to see how that goes, but I tend to write simple non-async code so I'm not sure how easy it will be for me to maintain comprehension of what's happening.
<Tetralux>
I also really hope it has good stacktraces.
<Tetralux>
Or I ain't using it XD
<Tetralux>
I've had that pain quite enough with .NET.
<fubd>
parent orelse {
<fubd>
C:\Users\Kevin\src\wasm-tetris\src\prefabs.zig:12:12: error: incompatible types: 'void' and '*components.transform.Transform'
<halosghost>
gonna hold out for the ANSI model though
<THFKA4>
scientes: he was setting up the latest XPS in #nixos yesterday
<THFKA4>
also holding out for the ANSI model here
<scientes>
what is wrong with 3 extra buttons?
<scientes>
i'm currently using a portugeese keyboard in en_us mode so all the labels are wrong
<scientes>
i can get that people wouldn't want the ANSI keyboard, but I don't get the other way around
<THFKA4>
iono, personal preference, existing muscle memory, etc.
<scientes>
yeah but I've used the mac keyboard and thinkpads that get the ctrl-alt-super-fn all messed up
<scientes>
and it gets me everything
<scientes>
every time
fubd has quit [Remote host closed the connection]
<scientes>
that damn fn key in differn't places
<scientes>
oh strange place for the delete button
<halosghost>
scientes: I grew up with ANSI; having |\ above return is just what my brain expects now
<halosghost>
that's really the only reason
<scientes>
I hardly use that key
<halosghost>
I use it all the time
<halosghost>
mostly for |
<halosghost>
because shell stuffs
<halosghost>
and also escape characters
<halosghost>
🤷
avoidr has joined #zig
darithorn has quit [Quit: Leaving]
tgschultz has joined #zig
Tetralux has quit [Ping timeout: 258 seconds]
bheads has joined #zig
firefox317 has quit [Ping timeout: 260 seconds]
eagle2com has joined #zig
<emekankurumeh[m]>
Sahnvour I may have gotten backtraces to work in stage 0 by using lld to link and emit a pdb
Akuli has quit [Quit: Leaving]
<Sahnvour>
yeah same for me, but not with link.exe (which is the default linker used for zig on windows)
<Sahnvour>
our implementation needs to be more robust
<Sahnvour>
as in, correct :D
eagle2com has quit [Ping timeout: 245 seconds]
darithorn has joined #zig
wilsonk_ has quit [Ping timeout: 244 seconds]
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 258 seconds]
<scientes>
yeah I can't run the test suite on my computer
<scientes>
it takes like 8 GB of ram
Lahvuun has joined #zig
wilsonk_ has joined #zig
<emekankurumeh[m]>
I should not I'm on mingw-w64
Tetralux has joined #zig
<emekankurumeh[m]>
*note
<Lahvuun>
Hello. What's the correct way to access fields of an imported C struct? I'm getting this error: "type '.cimport:4:17.struct_wl_display' does not support field access"
<Tetralux>
I seem to remember someone else asked that a few weeks ago. Alas, I don't quite remember what the problem was. Anyone else?
<darithorn>
Lahvuun afaik wl_display is an opaque struct. it's not designed for direct field access
<Tetralux>
If that's the problem, the error should probably point out that it's opaque.
<darithorn>
yeah i agree. it may have to do with the fact that wayland doesn't typedef any of its structs
<Lahvuun>
It looks like that's the case. Thank you.
<hryx>
at a glance, looks fine, and I don't think an assertion should be triggered. side note, why are you using an arena allocator? zig.parse is already going to wrap the allocator you pass in an arena
<ntgg>
That was just part of the code from an acutal project
<ntgg>
allocator is used more than just there
<hryx>
I think an assert getting triggered is a bug. can you try to create the smallest case that reproduces the isseue?
<hryx>
or does your paste also reproduce it?
<ntgg>
the paste reproduces it
<hryx>
great. and you're on master?
<ntgg>
I just rebuilt the zig-git package from the AUR, version 0.4.0+9e11f67f0
<Tetralux>
For reference, master is version 0.4.0+9e11f67f