gazler__ has quit [Read error: Connection reset by peer]
bsrd has quit [Quit: WeeChat 3.0]
<v0idify>
why is there no .write on CreateFlags?
<v0idify>
i wish try was something like `.!` instead
<g-w1>
iirc the reason there is not is that there is *supposed* to be friction when disgarding errors. you can do catch unreachable to reach the same effect
<v0idify>
?
<v0idify>
i mean that .! would act like try
<v0idify>
because it would be more chainable , for example (try file.getPos()) + 1 vs file.getPos().! + 1
<v0idify>
maybe not .!, i don't know
<g-w1>
oh i read your message wrong, sorry
brzg has joined #zig
dozens has joined #zig
zags has quit [Ping timeout: 256 seconds]
earnestly has quit [Ping timeout: 240 seconds]
cole-h has quit [Ping timeout: 272 seconds]
nvmd has joined #zig
brzg has quit [Quit: leaving]
ur5us_ has joined #zig
bsrd has joined #zig
ur5us has quit [Ping timeout: 258 seconds]
rowbee is now known as rowbee\
xackus__ has quit [Ping timeout: 240 seconds]
<v0idify>
how do I make .format print raw strings
Kiori has quit [Read error: Connection reset by peer]
midgard has quit [Ping timeout: 272 seconds]
jukan_ has joined #zig
jukan has quit [Ping timeout: 246 seconds]
midgard has joined #zig
<daurnimator>
v0idify: what is a raw string?
<daurnimator>
and maybe {s}?
drawkula has joined #zig
yeti has quit [Ping timeout: 264 seconds]
drawkula is now known as yeti
jukan has joined #zig
osa1 has quit [Ping timeout: 256 seconds]
jukan_ has quit [Ping timeout: 256 seconds]
a_chou has quit [Quit: a_chou]
ur5us has joined #zig
ur5us_ has quit [Ping timeout: 264 seconds]
<pixelherodev>
Hahaha, I love this :D
<pixelherodev>
7920 and my tree are converging on each other :)
<pixelherodev>
Not completely, but surprisingly, and much more than I expected
<v0idify>
daurnimator, {s} works, it was printing each byte as a decimal
<v0idify>
i couldn't find {s} in the docs
jukan has quit [Ping timeout: 272 seconds]
a_chou has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
kwilczynski has quit [Read error: Connection reset by peer]
r0bby has quit [Read error: Connection reset by peer]
r0bby has joined #zig
kwilczynski has joined #zig
kwilczynski has quit [*.net *.split]
waleee-cl has quit [*.net *.split]
larme has quit [*.net *.split]
terinjokes has quit [*.net *.split]
kragacles has quit [*.net *.split]
Stephie has quit [*.net *.split]
CommunistWolf has quit [*.net *.split]
vazub[m] has quit [*.net *.split]
dch has quit [Ping timeout: 264 seconds]
casaca has quit [Ping timeout: 264 seconds]
dch has joined #zig
waleee-cl has joined #zig
Stephie has joined #zig
CommunistWolf has joined #zig
vazub[m] has joined #zig
kragacles has joined #zig
larme has joined #zig
kwilczynski has joined #zig
terinjokes has joined #zig
kwilczynski has quit [Max SendQ exceeded]
kwilczynski has joined #zig
pafmaf[m] has quit [Ping timeout: 240 seconds]
vazub[m] has quit [Ping timeout: 253 seconds]
ugla has quit [Ping timeout: 246 seconds]
hamoko[m] has quit [Ping timeout: 246 seconds]
fengb has quit [Ping timeout: 246 seconds]
Nypsie[m] has quit [Ping timeout: 260 seconds]
ifreund_ has quit [Ping timeout: 260 seconds]
Snektron has quit [Ping timeout: 260 seconds]
dvaun has quit [Ping timeout: 244 seconds]
mtiljeset[m] has quit [Ping timeout: 265 seconds]
BitPuffin has quit [Ping timeout: 260 seconds]
dtz has quit [Ping timeout: 265 seconds]
jaens[m] has quit [Ping timeout: 240 seconds]
motiejus has quit [Ping timeout: 265 seconds]
siraben has quit [Ping timeout: 268 seconds]
kameliya[m] has quit [Ping timeout: 268 seconds]
bitmapper has quit [Quit: Connection closed for inactivity]
<marler8997>
so where is Zig's instance of lld-link look for .lib files on Windows?
texno has quit [Ping timeout: 246 seconds]
<marler8997>
maybe it's getting generated from libc/mingw?
a_chou has quit [Remote host closed the connection]
<andrewrk>
ifreund, I'm done for the day - all the syntax is implemented and what remains is passing all the test cases. there are quite a few. some bigger sub-tasks are multiline strings, line comments (handled by renderToken), and the rest of the TODOs in lastToken()
<andrewrk>
we're at roughly 50% test cases passing right now
<andrewrk>
also looks like we need to port over the array element alignment code
waleee-cl has quit [Quit: Connection closed for inactivity]
osa1 has joined #zig
gazler__ has joined #zig
gazler_ has quit [Ping timeout: 246 seconds]
leon-p has quit [Ping timeout: 265 seconds]
<daurnimator>
marler8997: would you be able to take off prefixes for things like MSHLFLAGS_ ?
<daurnimator>
there was an issue around somewhere for translate-c to do that
<daurnimator>
marler8997: `return self.vtable(self);` -> you're calling a struct?
<marler8997>
woops
<marler8997>
as for prefixes, that's not a bad idea, I could have the enum values without the prefixes, and then aliases outside the enum with the prefixes
<daurnimator>
`vtable: *VTable,` -> should this be `*const VTable` ?
cole-h has joined #zig
<marler8997>
yeah, thanks for that
<daurnimator>
marler8997: ooo, idea for the "bare" enum values.. a helper function called like: `pub usingnamespace std.meta.enumValues(MSHLFLAGS)`
<marler8997>
yeah that's not a bad idea
<marler8997>
I wonder if there's a way we could do something like that for COM methods
<marler8997>
actually I think there is
<marler8997>
I'll probably need like 10 or 15 minutes
<marler8997>
I already pushed your 2 suggestions btw
<daurnimator>
actually I don't think that `std.meta.enumValues` would work: we'd need @Type to work with decls; right now it only works with fields
<daurnimator>
marler8997: how do the "Async" ones work? you call begin; yield to the main loop; then call end?
<marler8997>
shoot that's the first I've heard of those
yyp has joined #zig
<marler8997>
I've updated the COM generation a bit, still not finished but getting closer
yyp has left #zig ["bye!"]
geemili has quit [Ping timeout: 240 seconds]
ur5us has joined #zig
<marler8997>
ran into an issue because Zig doesn't support overloading. Current idea is to prefix all COM methods with the interface they belong to, i.e. instead of "obj.Release()" you write "obj.IUnknown_Release()"
<marler8997>
and if there is a conflict within in the same interface, then I add a numeric suffix, i.e. "obj.Foo(a)" and "obj.Foo1(b)"
<KoljaKube>
And I would need to do some copying myself, or check if std has something for me, I guess
<marler8997>
I actually did the rewrite on std.Allocator, and we put in pretty good explanations of how the new interface works in std/mem/Allocator.zig
<KoljaKube>
I think I only read an earlier version, the comments are very helpful, thanks
[RMS] has quit [Ping timeout: 240 seconds]
<KoljaKube>
So I'll try reallocBytes next
<marler8997>
if you just want raw u8 buffers, and you allow move then that's the one you want
<KoljaKube>
I have to admit, the whole reallocation thing is new to me, I've only ever known simple usages of new/delete and maybe placement-new
<KoljaKube>
Since I'm trying to provide a libc-realloc-like experience to the VM, I think that's what I need
<marler8997>
allocation can be a pretty deep topic
<KoljaKube>
Hehe
<KoljaKube>
In any case, thank you so much! I think I know enough now to implement what I need, even if reallocBytes is not enough by itself (should be, though)
<marler8997>
good luck
ur5us has quit [Ping timeout: 264 seconds]
cole-h has quit [Ping timeout: 256 seconds]
[RMS] has joined #zig
jukan has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
jukan has quit [Ping timeout: 240 seconds]
Kiori has joined #zig
Kiori has quit [Ping timeout: 264 seconds]
dyeplexer has joined #zig
earnestly has joined #zig
zags has joined #zig
Kiori has joined #zig
jukan has joined #zig
jukan has quit [Ping timeout: 240 seconds]
<ifreund>
andrewrk: fixed one typo in firstToken() PtrType, implementing pub/extern for functions now
<ifreund>
hrm, looks like the pub/extern functions aren't even supported by the parser yet...
<zags>
am I correct the goal is to make copy ellision so good that I can rely on value semantics (over allocating and passing pointers around), as a decent default?
<ifreund>
if you're talking about result location semantics, yes that will be guarenteed by the language spec
<zags>
another question: does Zig expose anything for source locations? Like __FILE__ in C, or even better, std::source_location in C++20
<ifreund>
@src();
<zags>
nice, thanks
<ifreund>
also I lied, the parser does support modifiers on function decls, but there's a bug
commander has joined #zig
waleee-cl has joined #zig
osa1 has quit [Ping timeout: 265 seconds]
tane has joined #zig
osa1 has joined #zig
donniewest1 has joined #zig
bitmapper has joined #zig
zags has quit [Quit: Lost terminal]
xackus__ has quit [Ping timeout: 265 seconds]
Biolunar has quit [Ping timeout: 240 seconds]
kchambers has joined #zig
dmgk has left #zig [#zig]
Biolunar has joined #zig
<ifreund>
function thing fix, there was no bug just an unimplemented case it turns out
<ifreund>
now to figure out how to deal with the ** token in pointer types cleanly...
jukan has joined #zig
dozens has left #zig ["WeeChat 2.8"]
<pixelherodev>
andrewrk: why do you store start and end in extra_data instead of using lhs as start and rhs as end?
<ifreund>
pixelherodev: start and end of what?
<pixelherodev>
The AST rework?
<pixelherodev>
Well, th elatest one :P
<ifreund>
which node type
<pixelherodev>
Ah wait, no, I see...
<ifreund>
I assume my question makes sense now? :P
<pixelherodev>
You're encoding a little differently than I am, because your conceptualization is a bit different
<pixelherodev>
For FUnctionCall as an example: lhs is fnexpr, rhs is parameters
<pixelherodev>
For nodes with many children, such as a function call, I use lhs as start and rhs as end, and have a minimum length of one, where the first child is the real "lhs" of the FnCall
<pixelherodev>
Thus saving two entries in my "extra_data" equivalent
xackus__ has joined #zig
<ifreund>
that'd be pretty easy to add after the rest of the work is done
<ifreund>
can probably have a nice abstraction for it cause comptime too
<pixelherodev>
Not necessarily necessary - arguably, your view is more "honest" to the source
<ifreund>
those bytes add up though
<pixelherodev>
8 bytes per index into extra_data, yeah...
<pixelherodev>
Well
<pixelherodev>
4, actually
<pixelherodev>
Since you'd be going from {lhs, index} to {start, end} - thus moving two indices from extra_data into the node, and deleting four bytes - and you'd move that lhs in to extra_data
<pixelherodev>
Still significant, potentially
<ifreund>
I love kakoune, it saves me so much time
leon-p has joined #zig
mikdusan has joined #zig
<pixelherodev>
vs.?
<ifreund>
idk, writing a marco in vim
<ifreund>
which would take me much more time to get write than simply doing everything at once, interactively
<pixelherodev>
true
_fritchie has quit [Ping timeout: 264 seconds]
Kiori has quit [Remote host closed the connection]
<pixelherodev>
ifreund: given that I'm now modifying mine to store the full token list and use indices into it... I think after that PR is merged, the trees will be nearly indistinguishable :P
<ifreund>
andrewrk: currently implementing lastToken for the remaining cases and adding tests by the way
ave_ has joined #zig
ave_ has quit [Changing host]
a_chou has joined #zig
<ifreund>
v0idify: by the way, the reason zig has `try` instead of `.!` is that control flow is reserved for keywords
<ifreund>
i.e. operators never affect control flow
_whitelogger has joined #zig
sord937 has joined #zig
jukan has quit [Ping timeout: 272 seconds]
donniewest1 has quit [Quit: WeeChat 3.0.1]
sord937 has quit [Ping timeout: 268 seconds]
sord937 has joined #zig
Akuli has joined #zig
<v0idify>
ifreund, that makes sense!
hnOsmium0001 has joined #zig
donniewest1 has joined #zig
xackus__ has quit [Ping timeout: 240 seconds]
jukan has joined #zig
zags has joined #zig
xackus__ has joined #zig
dyeplexer has quit [Remote host closed the connection]
<zags>
why won't valgrind catch not deallocating from GeneralPurposeAllocator >.<
<ikskuh>
do you use libc?
<g-w1>
the GeneralPurposeAllocator catches it!
<ikskuh>
g-w1: nah, if you never call deinit(), it doesn't ;)
<ikskuh>
valgrind afaik hijacks malloc() and mmap() as C abis
<ikskuh>
not as syscalls
<ifreund>
^
<g-w1>
well call deinit then; yeah you can do if link libc use c allocator else use gpa
<zags>
haha, the point is catching not having called deinit and such
<ikskuh>
why that?
<ikskuh>
if you panic(), memory will be freed anyways
<ikskuh>
*grin*
<zags>
funny boy
<ifreund>
you only need to deinit() the allocator to catch all the other missing deinits
<ikskuh>
and if not, you can call deinit() in main
<ikskuh>
which will solve *all* other cases
<zags>
it's also not catching arena allocator's missing denits
<zags>
there might be a few arenas
<ikskuh>
it should
<ikskuh>
as long as the arena uses the GPA as a backing allocator
<zags>
it doesn't :(
* ikskuh
opens godbolt
<zags>
==5425== All heap blocks were freed -- no leaks are possible
* mikdusan
plays tada music
<ikskuh>
valgrind cannot interact with zig-libc
<ikskuh>
you *need* libc
<ifreund>
valgrind can only see stuff you alloc with libc's malloc and free with libc's free
<ifreund>
it
<ifreund>
it does not
<zags>
i see, so valgrind is useless for debugging memory leaks in zig unless i use libc?
<ifreund>
it does not capture mmap syscalls
<ifreund>
(sorry for the overzealous enter key)
<zags>
that's ok
<ifreund>
zags: yes that is right, but you can easily link libc optionally. The self hosted compiler does this for example
<ikskuh>
zags: zig's memory management is purely based on mmap ;)
<ifreund>
and zig's undefined has integration with valgrind by the way :)
a_chou has quit [Ping timeout: 246 seconds]
<ikskuh>
GPA in debug mode is also way more useful than valgrind :D
<g-w1>
yeah, you dont have to deinit each object, just the allocator for leaks to be detected
Kiori has joined #zig
<zags>
leak detection is rad, but is GPA a good allocator in terms of fragmentation and perf?
<ifreund>
no
<zags>
great
<ifreund>
though you should benchmark it
<ikskuh>
zags: it is "there" for now
<ikskuh>
if you want a battle-proven allocator, link libc and use the C allocator
<ifreund>
or use arenas everywhere
<zags>
the typical arena use is... one big or multiple? Say for a server that keeps per-user data and handles requests. One big still, or one per request?
<zags>
if multiple, then there's a chance there's a leak due to missing deinit (bug) and i'd like a tool to catch that
<ifreund>
one per request is definitely the way to go
<ifreund>
you
<ifreund>
you can swap out your backing allocator in test builds and "real" builds of coruse
<zags>
alright
jukan_ has joined #zig
jukan has quit [Ping timeout: 256 seconds]
<v0idify>
GPA detects leaks on ReleaseSafe no?
<v0idify>
that's an advantage over valgrind
<ifreund>
why wouldn't valgrind work on ReleaseSafe?
<v0idify>
it would but it would be painfully slow for "prod"
<v0idify>
while you can use ReleaseSafe on "prod" and still know if there's leaks
<ikskuh>
it detects leaks, but doesn't store any information about them
cole-h has joined #zig
<ifreund>
andrewrk: Tree.lastToken() is complete, plus several other fixes. I'm off for dinner now
<marler8997>
ok, COM is now working, I'm calling COM from Zig! :)
<marler8997>
andrewrk, as I understand, we are using libc/mingw to create Windows .lib files to link against? If so, what's our stance on those lib files? Should they have everything in win32? If not, then do you have any thoughts on how one might link against a lib that's not in there?
<marler8997>
maybe all I need to do is generate ".def" files as apart of my win32 codegen? If there's some way to tell Zig to create a .lib file to link against?
Kiori has quit [Remote host closed the connection]
zags has joined #zig
zags_ has joined #zig
zags has quit [Ping timeout: 264 seconds]
<andrewrk>
marler8997, which libs do you need that we're not providing?
<andrewrk>
the set we ship from mingw-w64 is not complete, and it's so far undecided how to choose that set
<v0idify>
if (SUCCEDED(hr)) if (SUCCEDED(hr)) if (SUCCEDED(hr)) if (SUCCEDED(hr)) if (SUCCEDED(hr)) if (SUCCEDED(hr))
<andrewrk>
ifreund, wow that's a lot more passing test cases now, thanks!
<ifreund>
:)
<ifreund>
we're definitely getting there, line comments are holding back the majority of the rest of the test cases I think
<ifreund>
also I doubt we have complete test coverage for first/lastToken(), so there're probably some off-by-one errors lurking there
<marler8997>
andrewrk, I was trying to port a direct2d example, which uses d2d1.lib
<marler8997>
v0idify, yeah it's pretty ugly
<andrewrk>
marler8997, all we need to do is copy the def files from mingw-w64 into the respective place in zig lib/ dir
<marler8997>
I should rewrite the ported example in Zig-style as well
<marler8997>
andrewrk, gotcha, is that scalable though?
<marler8997>
do we want to include everything in win32?
<andrewrk>
yes. I think if we copied all of them, it would be unnecessary bloat, but we can include anything that is even remotely commonly used
<andrewrk>
we could also get away with copying all of them, it would be ok, but I didn't want to do it unless it seemed necessary
<marler8997>
ok, they must not be that big then
<andrewrk>
at the very least, feel free to look at a list of the .def files that mingw-w64 provides and the list that we ship in zig and add any that you deem useful
<marler8997>
hmmm, my mingw version was 6.0.0, but it looks like there are newer verions, should I be using 8.0.0?
kenran has joined #zig
kenran has quit [Client Quit]
<marler8997>
I answered my own question, when I switched to 8.0.0, now my file copies aren't changing the files that are already there
<KoljaKube>
What's currently the "correctest" (most idiomatic? preferred?) specifier for printing enum values? Nothing, any, or did I miss something?
geemili has joined #zig
<mikdusan>
there's @enumToInt() and @tagName()
<KoljaKube>
mikdusan: Sorry, I meant something like `debug.print("{}", .{MyEnum.Value});`
<ifreund>
KoljaKube: well what do you want? the name of the tag or the integer?
<KoljaKube>
I've been adding specifiers where now required for array types, and was wondering if I should ban empty {} in format strings in my code
<ifreund>
empty {} is used for e.g. structs
<KoljaKube>
ifreund: The name
<mikdusan>
just fyi, afact, there is _no_ specifier for enum types using std's formatter and any specifier is ignored. just use `{}`
<KoljaKube>
To be clear, my line there works, I just want to know if that's how I should do it
<ifreund>
if that line there prints the name in the format you want, there's nothing wrong with it
<KoljaKube>
OK, good
<KoljaKube>
I didn't have time to follow zig development for a few weeks, and wasn't sure if there was some movement for specifying all the things going on
<KoljaKube>
Since the compiler complained about my naked {} for []const u8
<mikdusan>
that's a type-specific error. since you're using enum, it's not related
<KoljaKube>
Yeah, the respective commit read like that, I just wasn't sure if I was missing some bigger picture stuff going on in that regard
<KoljaKube>
Thanks to you both
<Cadey>
where's the support tier list for zig?
<ifreund>
KoljaKube: the issue with arrays/slices is that it is ambiguous whether they should be printed as a list of values or as a string
<KoljaKube>
Man, it was really stupid of me to update zig and the library I'm wrapping at the same time. Now I have no idea where all these new errors are coming from :D
<ifreund>
it's kinda hidden post website redesign tbh...
sord937 has quit [Quit: sord937]
riba has quit [Ping timeout: 256 seconds]
<andrewrk>
marler8997, thanks for the PR on the def files. Mind checking for me, how much more bytes does this add? just curious
<marler8997>
about 2.1MB
<andrewrk>
ok that sounds fine
<andrewrk>
why does creating files on windows take so long?
<ifreund>
isn't their filesystem shitty?
<ifreund>
decompressing stuff takes ages from what little I've seen
<KoljaKube>
Had a situation where compiling Java in a Linux vm and copying to Windows was faster than compiling in Windows
xackus__ has quit [Ping timeout: 264 seconds]
<andrewrk>
30ms to create a file is really really slow
<marler8997>
on my machine its 20ms to "touch foo", that can definitely add up
leeward has quit [Remote host closed the connection]
donniewest1 has quit [Quit: WeeChat 3.0.1]
ur5us has quit [Ping timeout: 264 seconds]
a_chou has joined #zig
Akuli has quit [Quit: Leaving]
ur5us has joined #zig
<g-w1>
wow, it takes like 12 secs total to unzip zig on my ssd
<g-w1>
linux
dddddd_ has joined #zig
dddddd has quit [Ping timeout: 256 seconds]
a_chou has quit [Ping timeout: 240 seconds]
<fengb>
$ time touch foo -- real0m0.005s
<fengb>
I think that's fork latency
riba has joined #zig
tane has quit [Quit: Leaving]
zags has joined #zig
zags_ has quit [Read error: Connection reset by peer]
<marler8997>
daurnimator, I solved the enum prefix issue. for all the values inside the enum, if the value name contains the name of the enum then it is stripped off. Along with that, you can still access the enum value outside the enum with the fully-qualified name. Checkout MSHLFLAGS again at https://github.com/marlersoft/zigwin32/blob/main/src/win32/api/com.zig
ur5us has quit [Ping timeout: 272 seconds]
<andrewrk>
1.34 seconds to unzip zig-windows-x86_64-0.7.1.zip on my linux machine
<andrewrk>
I feel like microsoft could have worked on that instead of putting ads in my start menu
<marler8997>
but waiting for you files to unzip gives you more time to look at the ads :)
<marler8997>
Microsoft Stonks!
riba has quit [Ping timeout: 256 seconds]
zags has quit [Ping timeout: 240 seconds]
<marler8997>
how does ziglang.org downloads get updated?
<marler8997>
actually a better version of my question, is there a way to track the progress of the next version to be deployed?