<waleee-cl>
I get that, I was wondering about when you were getting the error
<ryuukk_>
for now it is simple, open window, and clear color/depth
<ryuukk_>
so far, i'm surprised with zig (positive) i like that language a lot
<ryuukk_>
it was easier to get to this point that i initially thought
<ryuukk_>
i still have to think more to get away from OOP, but if i keep things simple it is smooth
<ryuukk_>
interop with C is super smooth and easy
<ryuukk_>
ZLS is awesome
cole-h has quit [Ping timeout: 260 seconds]
<ryuukk_>
waleee-cl: i just copied the file locally when i tried, i added the same options in the build.zig file
<waleee-cl>
ok
<ryuukk_>
oh i didn't see the previous messages
<ryuukk_>
2:30am it is getting late
<waleee-cl>
(the not so only) Central European Time
<waleee-cl>
also Spanish time, even though Spain is further west than eg. the UK, for reasons
<fengb>
Because fascism! 🙃
<waleee-cl>
probably. Portugal which also had such a stint is on WET/GMT though
ryuukk__ has joined #zig
ryuukk_ has quit [Read error: Connection reset by peer]
gazler_ has quit [Ping timeout: 264 seconds]
gazler has joined #zig
earnestly has quit [Ping timeout: 256 seconds]
msingle has quit [Ping timeout: 260 seconds]
msingle has joined #zig
Wolf480pl has quit [Ping timeout: 258 seconds]
Wolf480pl has joined #zig
xackus has quit [Ping timeout: 260 seconds]
ghostbuster has quit [Quit: WeeChat 2.3]
jjsullivan has quit [Ping timeout: 240 seconds]
kristoff_it has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
msingle has quit [Ping timeout: 240 seconds]
Astolfo` has joined #zig
<jabb>
can i mark a return type as being okay to ignore?
a_chou has joined #zig
<andrewrk>
no and it is not planned
a_chou has quit [Remote host closed the connection]
<Astolfo`>
sounds like allowing that would allow a lot of wasted computing jabb
<Astolfo`>
i see that problem whenever i use a Golang library
<Astolfo`>
"oh, i dont need this part" > puts '_' on return
<Astolfo`>
wonderful, i just did the work to get an answer i actually dont need
<jabb>
i'm just using functions in a chaing style
<jabb>
chaining*
<jabb>
so returning a pointer to self, like matrix.invert().scale() but performed in-place
<Astolfo`>
ah i see
zippoh` has quit [Ping timeout: 256 seconds]
<pixelherodev>
jabb: that's what `_ = ` is for.
ur5us has quit [Ping timeout: 260 seconds]
<pixelherodev>
I think that, as far as Zig is concerned, all else being equal, catching mistakes should be the default, and it's the programmer's responsibility to explain if something was intentional
<pixelherodev>
One option might be to make the return type variable?
<pixelherodev>
e.g. `fn DoAThing(arg: anytype) ReturnTypeFrom(arg)`
<pixelherodev>
That's not something I'd actually suggest though, I'd personally suggest just using `_ =`
_whitelogger has joined #zig
cole-h has joined #zig
xackus has joined #zig
Astolfo` has quit [Remote host closed the connection]
osa1 has joined #zig
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
<ikskuh>
errrm
<ikskuh>
i think there are a lot of safety checks broken by now?
<ikskuh>
huh
<ikskuh>
andrewrk: did semantics of @floatCast change over time? i remember it panic'ing when casting a non-integer float to int (like 2.3 → i32)
GrooveStomp has quit [Ping timeout: 256 seconds]
GrooveStomp has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<Storyfeet>
Hey all, working on getting to grips with zig, I'm Trying to return a comptime string from a function. (And from a switch) Is this possible? If so, what's the type?
<ikskuh>
heya Storyfeet
<ikskuh>
you can just return `[]const u8`
<ikskuh>
comptime variables have static lifetime, meaning pointers to them are valid throughout the whole program
<ifreund>
that payload coercion stuff is something we definitely want, but IMO it doesn't cause enough friction to be worth implementing in stage1 when the code will hopefully be thrown out within the next year
<pixelherodev>
Seconded
<s-ol>
ifreund: yeah i see how that might be true
<s-ol>
although like 80% of it is there already in types_match_const_only()
xd1le has joined #zig
<ifreund>
I mean it's your time not mine, go for it if you feel like it :D
<s-ol>
it does figure out all the nesting and builds a nice list of steps that need to be done, it just doesn't use it and instead runs through a bunch of heuristics
<s-ol>
i just picked something random with a 0.7.0 milestone to get my hands dirty
<ifreund>
it's 0.8.0 milestone now :P
<s-ol>
true :P
<ryuukk__>
and it's bug prone, if i ever want edit length, i'd need not forget edit the ** 256 too, anyways, but now i'll use std.mem.zeroes([256]i32), it has less noise in the syntax
<ifreund>
anyone have the commit before llvm11 was merged handy?
<ifreund>
(found one that works)
<g-w1>
Im still waiting for arch to get llvm ...
<pixelherodev>
Heh, i already have it ;)
layneson has joined #zig
<ifreund>
I mean i could have it too if i did a little work
<ifreund>
but I'd rather not
<pixelherodev>
ifreund: I... actually didn't install it :P. It showed up in an update, so I masked it lol
<pixelherodev>
I meant that I have it *available*, not that I installed it, but I clearly phrased that badly
<pixelherodev>
[]T is basically pointer + runtime-known length
<ifreund>
this is all pretty well documented on ziglang.org and on ziglearn.org
<pixelherodev>
[N]T is pointer and compile-time-known-length
<ryuukk__>
what prevent a pointer to one to be a poitner to many
<ifreund>
pixelherodev: no, that would be *[N]T
<ryuukk__>
use [] for everything is confusing me
<ifreund>
ryuukk__: zig differentiates them for safety purposes
<pixelherodev>
ifreund: s/pointer/items, yeah
<ifreund>
you can @ptrCast() if you think you know better than the compiler but that can come back to bite you
<ryuukk__>
what kind of safety measure?
skuzzymiglet has joined #zig
<ifreund>
well, if you try to access ptr + 1 when ptr is a pointer to only one item, you segfault
<ifreund>
or at least, you hopefully segfault, it's UB
<ifreund>
zig allows you to encode this kind of information in the type system and enforces it
<ifreund>
leading to fewer bugs
<pixelherodev>
ryuukk__: it means that if you have an array of five items, and you try accessing a non-existent sixth item, it fails in the best possible way instead of having random bugs and crashes
a_chou has quit [Ping timeout: 256 seconds]
<pixelherodev>
"Better compile time errors than runtime failures; better runtime failures than bugs"
<ryuukk__>
i don't deny that, it just seems confusing at first
<ryuukk__>
that should be supported out of the box in my opinion
<ryuukk__>
in D you can print every structs
<ryuukk__>
super useful
<pixelherodev>
ryuukk__: the stage2 compiler is the current focus
<g-w1>
since the switch is at compile time could you have a compile error if the type is not supported
<pixelherodev>
g-w1: yes, but I didn't want to
<g-w1>
ok
<g-w1>
i was just checking that it is possible
<pixelherodev>
You can do whatever you want with that code
<pixelherodev>
:)
<companion_cube>
do you think such a generic printer could have a (comptime?) table with type-specific printers in it?
<companion_cube>
to say "this is the way of printing this particular struct" and yet play nice with the generic printer
<pixelherodev>
Probably
<g-w1>
where in the stage 2 compiler needs the most help/is understandable from a person who knows assembly but not that much about compilers? I want to help with it but dont know how.
<pixelherodev>
Honestly, it could do reflection on structs if I really wanted to
<pixelherodev>
g-w1: that'd probably be helpful for code generation
<pixelherodev>
basically, given an abstract operation (add, jump, call, etc), it produces machine code for a given target
<g-w1>
ok yeah. ill look at some of the code once llvm starts working again
<g-w1>
would that be in codegen.zig?
<pixelherodev>
yep
<g-w1>
wow. it goes straight to hex. no assembly involved. thats pretty cool
juanfra__ has quit [Quit: Idle for 30+ days]
<ifreund>
yeah, gotta go fast
a_chou has quit [Ping timeout: 240 seconds]
a_chou has joined #zig
cole-h has joined #zig
<ryuukk__>
i adapted your code, and patched fmt.zig pixelherodev
<ryuukk__>
i think it could be a default, without having to use {v}, what do you think?
<ryuukk__>
worth to send PR?
FireFox317 has joined #zig
<FireFox317>
g-w1, note that it would probably be nice to have an assembly like abstraction in there. Such that we can use the same code for inline assembly as for the codegen.
<g-w1>
yeah that would be nice
<g-w1>
is that a plan?
<FireFox317>
For example this library can be integrated i think? https://github.com/momumi/x86-zig andrewrk what do you think of that?
<FireFox317>
I'm not sure that why I tagged the master himself :P
<pixelherodev>
ryuukk__: worst that can possibly happen is it gets rejected
<FireFox317>
ryuukk__, did you check what happens when you pass in a string? :P
<FireFox317>
Because we don't want the default to print a string as an array
<pixelherodev>
FireFox317: their code is explicitly in the else branch of if u8
traviss has joined #zig
<FireFox317>
pixelherodev, aah i see. Then default might be okay yes. But maybe we have to keep the length in mind then
<FireFox317>
ryuukk__, we probably want to print it as an zig array instead?
<ryuukk__>
{} instead of [] ?
<traviss>
anyone in here using zls with emacs able to use goto definition? i think i have everything else working expect this. getting a long and mysterious error message.
<g-w1>
goto definition only works half time for me in zls vim
<FireFox317>
ryuukk__, yes for example. or maybe also add the type and length i dunno
<ifreund>
goto definition isn't available for everything in zls yet, it can still hit cases it doen't know how to handle
<ifreund>
it works pretty well for me in general though with kakoune
<ryuukk__>
well the v means values, if want add .len, i think user has to be explicit, std.log.info("L: {}, Content: {}, slice.len, slice)
<traviss>
interesting. yeah goto def its pretty flawless from vscode. i guess i'll make an issue for the emacs error i'm getting.
<ifreund>
yeah I'm guessing in your case emacs is at fault not zls
<traviss>
ah, maybe an lsp-mode or lsp-ui error then. i can't even tell where the error is coming from.
<traviss>
i'll try disabling things to narrow down and make an issue where appropriate. thx.
<FireFox317>
ryuukk__, yeah true. Then {1,2,3} would be better than [1,2,3] i think
wootehfoot has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
Akuli has joined #zig
ryuukk_ has joined #zig
ryuukk__ has quit [Ping timeout: 256 seconds]
<g-w1>
/quit
<pixelherodev>
:P
g-w1 has quit [Quit: WeeChat 2.3]
g-w1 has joined #zig
<g-w1>
my irc client is not working as you can see
<pixelherodev>
What I saw was a /quit ;)
waleee-cl has joined #zig
ryuukk__ has joined #zig
ryuukk_ has quit [Read error: Connection reset by peer]
jjsullivan has joined #zig
xackus has joined #zig
ryuukk_ has joined #zig
ryuukk__ has quit [Ping timeout: 246 seconds]
ur5us has joined #zig
ryuukk__ has joined #zig
ryuukk_ has quit [Ping timeout: 264 seconds]
Snetry has quit [Quit: left Freenode]
Snetry has joined #zig
FireFox317 has quit [Ping timeout: 260 seconds]
kristoff_it has joined #zig
wootehfoot has quit [Quit: Leaving]
marnix has quit [Ping timeout: 272 seconds]
skuzzymiglet has quit [Ping timeout: 260 seconds]
<bfredl>
/ragequit
wootehfoot has joined #zig
<ifreund>
anyone have a good way of binding C enums used as bitfields?
<ifreund>
just throwing some constants in a namespace is the only solution I see that doesn't require a ton of @enumToInt()
wootehfoot has quit [Read error: Connection reset by peer]
Akuli has quit [Quit: Leaving]
<ifreund>
hmm, guess putting the constants inside a non exhaustive enum is better
kristoff_it has quit [Ping timeout: 260 seconds]
procnto has quit [Ping timeout: 272 seconds]
procnto has joined #zig
euantorano has quit [Ping timeout: 272 seconds]
euantorano has joined #zig
<g-w1>
where do the optimisations happen in the self-hosted compiler. are there multiple (at the ir level and at arch level)?
<ifreund>
there are no real optimizations yet, as the self hosted compiler is not yet capable of compiling all zig code
<ifreund>
that said, the codegen is not needlessly inefficient
kristoff_it has joined #zig
solaire has joined #zig
msingle has quit [Ping timeout: 258 seconds]
solaire has quit [Quit: WeeChat 2.9]
<pixelherodev>
Zig's optimization-less codegen is better than LLVM's optimization-less codegen, if I'm remembering an off-hand microbenchmark from a month ago correctly :P
<ifreund>
not a super meaningful benchmark with how much zig we currently have implemented
<ifreund>
however I'd not be at all surprised if that turns out to be the case in the end
ur5us has quit [Ping timeout: 260 seconds]
<g-w1>
Will the compiler eventually have them? I feel that they will be the hardest to impliment, just given the sheer number of them. Do you agree?
a_chou has joined #zig
travv0 has joined #zig
msingle has joined #zig
a_chou has quit [Remote host closed the connection]