ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<waleee-cl> right, yeah, makes sense I guess
msingle has joined #zig
<justin_smith> but maybe I'm misunderstanding something, since in the github it's described as erroneous
<waleee-cl> ryuukk_: were you building the model-viewer unmodified?
ur5us has joined #zig
<ryuukk_> waleee-cl: no, i just want reuse the glad lib for opengl
<ryuukk_> i just import header for now
<ryuukk_> https://github.com/ryuukk/zark i put code on github if someone want review
<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]
frett27 has joined #zig
Storyfeet has joined #zig
Techcable has quit [Quit: ZNC - http://znc.in]
Techcable has joined #zig
<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
<Storyfeet> I've got a return of []const u8, Can I declare a function as Comptime only?
<ikskuh> no, that's not possible (yet)
<ikskuh> you can use the pattern used in comptimePrint though :)
<Storyfeet> Thanks for the link, that explains a lot
<ikskuh> brb
<Storyfeet> I'm having trouble with the switch statement too.
frett27 has quit [Ping timeout: 240 seconds]
xackus has quit [Ping timeout: 260 seconds]
ur5us has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
<Storyfeet> I'm trying to switch a string against several strings of different length at comptime.
<Storyfeet> How would I tell the compiler to treat them all as slices?
cole-h has quit [Ping timeout: 246 seconds]
<ikskuh> Storyfeet: either coerce the first switch prong to []const u8 or declare the value as []const u8
<ikskuh> i'm away for work, but others can definitly help, too :)
<Storyfeet> thanks
earnestly has joined #zig
FireFox317 has joined #zig
<FireFox317> Storyfeet, not sure if someone already answered, but in
<FireFox317> Zig you can't switch on a string
<FireFox317> You have to use `std.mem.eql(u8, slice1, slice2)`
<FireFox317> Or use a comptimehashmap or something
<Storyfeet> ah, OK, thanks
Storyfeet has quit [Remote host closed the connection]
freshmaker666 has quit [Quit: ZNC 1.8.2 - https://znc.in]
freshmaker666 has joined #zig
freshmaker666 has joined #zig
freshmaker666 has quit [Changing host]
FireFox317 has quit [Quit: Leaving]
ur5us has quit [Ping timeout: 260 seconds]
frett27 has joined #zig
frett27 has quit [Ping timeout: 260 seconds]
marnix has quit [Ping timeout: 256 seconds]
marnix has joined #zig
][_R_][ has quit [Ping timeout: 265 seconds]
cr1901_modern has quit [Ping timeout: 240 seconds]
msingle has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
[RMS] has joined #zig
<ikskuh> has no one ever tried using std.fs.Dir.setAsCwd() on windows?! :D
<ikskuh> @compileError("TODO implement chdir for Windows");
<ikskuh> huh
<pixelherodev> lol
<pixelherodev> > git grep TODO | grep Windows| wc -l
<pixelherodev> 13
<pixelherodev> :P
marnix has quit [Ping timeout: 246 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
msingle has quit [Ping timeout: 265 seconds]
_whitelogger has joined #zig
<ryuukk__> since there is no default, i assume it is not possible to initialize a fixed array with default value all at once?
<ryuukk__> queue: [256]i32 = undefined and then somewhere i loop and i set the default?
<g-w1> i think there is
<fengb> You can do [_]i32{42} ** 256
<ryuukk__> hmm
<ryuukk__> i have no idea what i read
<ryuukk__> what is **?
<pixelherodev> Comptime array expansion, basically
<pixelherodev> It means "make an array that is lhs repeated rhs times"
<ryuukk__> so it fills aray with 42?
<pixelherodev> Basically, it first makes a [1]i32 with the value 42
<pixelherodev> Then it takes that and produces an array with 256 sequential copies of that
<pixelherodev> Which ends with a 256-length array of i32s, each with the value 42
<ryuukk__> ok thanks
<pixelherodev> If you want a pattern you can add to the initial arrayu
<pixelherodev> array*
<ryuukk__> [_] what is that?
<pixelherodev> Implicit-length array
<ryuukk__> ok
<pixelherodev> Basically, it's the same as [1]i32 in that case
<pixelherodev> but if you do e.g. `[_]i32{42,-1}`, it'll be a [2]i32
<ryuukk__> queue: [256]i32 = [_]i32{0} ** 256, isn't there something cleaner?
<ryuukk__> queue: [256]i32 = 0 ** 256, seems to compile
<fengb> There’s also std.mem.zeroes([256]i32)
<ryuukk__> but will it work? xD
<ryuukk__> oh no nvm it doesn't compile
<ifreund> yeah, ** only works on arrays and slices and only at comptime
<ryuukk__> can't the compiler figure the type?
<ryuukk__> {42} ** 256 would be nicer to type
<pixelherodev> ryuukk__: it's not "can it," it's "should it"
<ryuukk__> why? type is known at compile tyme
<pixelherodev> > * Communicate intent precisely.
<pixelherodev> Like I said, the compiler *could* do that, but core to the Zen of Zig is that *explicit* is better than *implicit*
<ryuukk__> char array[100] = {0} in c++
<fengb> {42} this is a block in Zig
<fengb> C is hard to parse
<pixelherodev> ^
<ryuukk__> but it does the job clean
<ryuukk__> (not all the time, but here yes)
<pixelherodev> That's heavily debatable
<pixelherodev> The key here is that {0} is a different structure in this language
<ryuukk__> queue: [256]i32 = [_]i32{0} ** 256
<fengb> Zig parser is designed with no backwards checks in mind
<ryuukk__> duplicate typing
<pixelherodev> You don't need to define the type there
<pixelherodev> `var queue = [_]i32{0} ** 256` is enough
<fengb> For a struct field there’s no inferencing yet
<ryuukk__> it's in a struct
<ryuukk__> "yet", is it planed?
<fengb> I wrote a proposal a while ago. Hasn’t been rejected so I still have hopes :P
<s-ol> hey, anyone here know their way around stage1/ir.cpp?
<s-ol> I'm working on #4529 and not managing to unwrap, cast, and re-wrap optionals properly
<ryuukk__> well, i'd rather have to type less for basic thing
<s-ol> i'm trying to use ir_analyze_unwrap_optional_payload() but I think I'm just lost around the IrInstGen* structure and ir_get_ref / ir_get_deref
<pixelherodev> one of the core values of Zig is to prioritize reading code over writing code
<ryuukk__> does duplicates really help reading?
<pixelherodev> In this case, it should be possible to have both, since the type is already known
<ryuukk__> yes that is what i thought
<pixelherodev> No, I agree, this is one case writing can be improved without harming reading
<ifreund> I tried to implement something non trivial in stage1 and decided my time would be better spent waiting for and contributing to stage2
<pixelherodev> fengb: which issue?
<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
<ifreund> heh
a_chou has joined #zig
<ryuukk__> would be cool if is show an example how to use it
<ryuukk__> how do i instantiate it?
<ryuukk__> documentation often lack basic examples
<ifreund> const list = List(u32){ .items = foo, .len = bar, };
<ifreund> well, you would probably want it to be var though
layneson has quit [Ping timeout: 260 seconds]
<ifreund> the List() function returns a type, so you can use it anywhere a type is expected
<pixelherodev> List(u32) is, for all intents and purposes, a struct type
<pixelherodev> So you can use it in the exact same way
<ryuukk__> .\src\sandbox.zig:7:42: error: array literal requires address-of operator to coerce to slice type '[]u32'
<ryuukk__> var list = array.List(u32){ .items = [1]u32{0}, .len = 1, };
<ryuukk__> i'm confused with arrays
<pixelherodev> items is supposed to be a slice
<pixelherodev> `[]u32` == slice of u32
<pixelherodev> `[1]u32` == array-len-1 of u32
<ryuukk__> what should i do?
<ifreund> a pointer to an array will coerce to a slice
<pixelherodev> Is that the std list type?
<ifreund> so &[1]{0}
<ifreund> I think it's their own type
<ryuukk__> i'm lost now lol
<ryuukk__> how do i initialize an array?
<ifreund> const foo = [4]u8{1,2,3,4};
<pixelherodev> `[1]u32{0}` initializes a 1-len array with the value 0
<pixelherodev> address-of-array coerces to slice
<ryuukk__> why my code didn't work then, i used same syntax
<pixelherodev> because items isn't supposed to be an array there
<ifreund> []u32 is a slice not an array
<pixelherodev> It's supposed to be a slice
<ryuukk__> var list = array.List(u32){ .items = [1]u32{0}, .len = 1, };
<ryuukk__> what should i do to make this work?
<pixelherodev> The obvious answer is "& before [1]u32"
<pixelherodev> Depending on how the type is supposed to work, that might result in a crash later
<pixelherodev> So the answer might be a bit subtler
<ryuukk__> .\src\sandbox.zig:7:49: error: expected type '[]u32', found '*const [1]u32'
<ryuukk__> var list = array.List(u32){ .items = &[1]u32{0}, .len = 1, };
<pixelherodev> Ah, [_] instead of [1]?
<pixelherodev> No, that shouldn't matter
<ifreund> it's const
<ryuukk__> _ supposed it know the size?
<ifreund> the type wants a mutable array
<ryuukk__> same problem
<ryuukk__> .\src\sandbox.zig:7:49: error: expected type '[]u32', found '*const [1]u32'
<ryuukk__> var list = array.List(u32){ .items = &[_]u32{0}, .len = 1, };
<ifreund> so you have to use a global var or allocate
<pixelherodev> I said that :P
<ifreund> if it were []const u32 that would work
<ryuukk__> hmm
<ifreund> if you want a generic list, try std.ArrayList()
<ryuukk__> well i want to make my own type
<ifreund> well then take a look at the code for std.ArrayList() and see how it works
<ryuukk__> i tried to take a look but it's confusing
osa1 has quit [Remote host closed the connection]
<ryuukk__> Self Slice alignment, all that i don't understand
<ryuukk__> i checked the doc to learn how to do all that
<ryuukk__> but hit road bloat on first code shown in the doc
<ryuukk__> block
kristoff_it has quit [Ping timeout: 260 seconds]
jmiven has quit [Quit: reboot]
<ryuukk__> so far not so userfriendly
<ryuukk__> have to dig deeper and i loose track
jmiven has joined #zig
<ifreund> you can ignore the alignment stuff
<ifreund> if you do so, then Slice is just []T
<ifreund> and Self = @This(); which refers to the type of the struct returned
<ifreund> I agree the docs could use work, have you seen this site? https://ziglearn.org/
<ryuukk__> i didn't, but i will take a look
osa1 has joined #zig
a_chou has quit [Ping timeout: 240 seconds]
<ryuukk__> here is a naive attempt, fail of course lol https://hastebin.com/xekaqoxiwo.zig
<ryuukk__> this is confusing
<ryuukk__> does anyone have a super basic generic array struct, something super basic
<s-ol> ryuukk__: do you mean std.ArrayList?
<ryuukk__> i can't understand that one, it is too complex
<g-w1> i think they want to try to impliment it themselves
a_chou has joined #zig
<ryuukk__> i found this https://github.com/DutchGhost/ArrayVec/blob/master/src/array.zig, now need equivalent, for dynamic array with alloc/free
<ifreund> the equivalent is ArrayList
<ryuukk__> i can't wrap my head around it, the way it is written makes it looks complex
<ryuukk__> this array.zig in contrast is easy to understand
<pixelherodev> arraylist is pretty simple
<ryuukk__> but it's me trying to read it not you :p
<ifreund> the alignment aware version makes things a little harder to read to be fair
<ryuukk__> anyone got one? or maybe help me on my attemp? https://hastebin.com/xekaqoxiwo.zig
<ryuukk__> also i can't call function here?
<ryuukk__> .\src\array.zig:28:13: error: expected 1 argument(s), found 0
<ryuukk__> ret.init();
<ifreund> we all just use ArrayList
<ifreund> here though, I stripped it down for you: https://paste.rs/ee6
<ifreund> eh, forgot to simplify the allocations
<ryuukk__> oh so []T hides a pointer
<ryuukk__> what is []T called in zig?
<ifreund> that's a slice of type T
<ifreund> a slice has two fields, a pointer and a length
<ryuukk__> ok i was assuming it is an array
<ryuukk__> so it's like in D
<ifreund> you can thing of it as a struct { ptr: [*]u8, len: usize }
<ryuukk__> wait, this makes it even more confusing
<ryuukk__> what is [*] ?
<ifreund> that's a pointer to many items
<ryuukk__> why not *usize ?
<ifreund> what?
<ryuukk__> a pointer
<ryuukk__> []u8 = slice [*]u8 = pointer?
<ryuukk__> this make no sense
<pixelherodev> []T = slice, [*]T = pointer-to-many, *T = pointer-to-one
<pixelherodev> [N] = array
<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__> confusion leads to bug too :p
<ifreund> I'd suggest giving chapter one here a good read, it will clear things up a lot: https://ziglearn.org/chapter-1/
<ryuukk__> it is too much, i usually just search when i hit road block
<ryuukk__> i'm "learn by doing" kind of person
<ryuukk__> if there is a book before, high chance i drop it *cought* rust *cought*
<ifreund> same, but I also read the docs when I don't understand something about the syntax before asking here
<ryuukk__> that is what i have done
<ryuukk__> but when it doesn't make sense, it highlight other issue
<ryuukk__> i could write all the book possibles, i wouldn't be able to solve the issue i have, right now
<ryuukk__> read*
<ifreund> what are you stuck on right now?
<ryuukk__> asking, help me move forward
<ryuukk__> no, i'm not stuck anymore, you gave me the anwsers i needed
<ryuukk__> []T is slice that hides a pointer
<ryuukk__> and *T is only for one
<ryuukk__> just one question: why can't i call function inside the function that creates the type?
<ryuukk__> .\src\array.zig:28:13: error: expected 1 argument(s), found 0
<ryuukk__> ^
<ryuukk__> ret.init();
<ifreund> well, you aren't passing an argument to it
<ifreund> ret is a type not an instance of the struct
<ryuukk__> oh i see
<ryuukk__> so i need call init after i create it
<ifreund> yes
hnOsmium0001 has joined #zig
<ryuukk__> is there a way for std.log to print the content of a slice?
<ryuukk__> std.log.info("Content: {}", .{list.slice()}); prints: info: Content: u32@2748a280000
<ifreund> what is the return type of slice()?
<ryuukk__> []T
<ryuukk__> T is u32
<ryuukk__> pub fn slice(self: *Self) []T
<ryuukk__> return self.items[0 .. @intCast(usize, self.count)];
<ryuukk__> }
<ryuukk__> {
<ryuukk__> don't mind the intCast, i don't like typing usize on the struct xD
<pixelherodev> what type is count?
<ryuukk__> the number of elements in the array
<pixelherodev> *Type*
<ryuukk__> u32
<ifreund> log.info("content: {x}", .{slice}); will show you the memory
<ifreund> std.fmt.format doesn't have a specifier for printing out the values of non-u8 slices
<companion_cube> zig can print arbitrary types?
<companion_cube> ah, wait
<ryuukk__> ifreund: doesn't work
<ryuukk__> C:\zig\lib\zig\std\fmt.zig:455:39: error: expected type '[]const u8', found '[]u32'
<ryuukk__> return formatText(value, fmt, options, writer);
<ryuukk__> but i don't want see memory, i want print the values
<ryuukk__> {1, 2, 3} if i add 1, 2 ,3
<ifreund> use a for loop i guess
<ryuukk__> the point is to not have to loop, just print in ony line
<ifreund> for (slice) |x| std.log("{}", .{x});
<ifreund> that's one line
<ifreund> :P
<companion_cube> it's not very compositional :p
a_chou has joined #zig
<ifreund> i agree that std.fmt.format() should probabably have a specifier for this
<ryuukk__> it prints the content
<ryuukk__> i think i broke their site lol
<companion_cube> 502, ryuukk__
<companion_cube> has there been some thoughts about "derive" in zig?
<companion_cube> (could be a comptime `derivePrint(theTypeHere)` I suppose, expanding to code)
<ryuukk__> https://run.dlang.io/ and type this
<ryuukk__> writeln(data);
<ryuukk__> auto data = [1, 2, 3];
<ryuukk__> it'll print: [1, 2, 3]
<ryuukk__> no it's not possible with zig?
<pixelherodev> it's certainly possible, even if it's not implemented in the standard library right now
<pixelherodev> i have an alternate logging function which does it
<ryuukk__> do you mind sharing it?
osa1 has quit [Remote host closed the connection]
<ryuukk__> thanks
<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__> std.log.info("Content: {v}, .{slice}); prints: info: Content: [1, 2, 3]
<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
xd1le has quit [Ping timeout: 260 seconds]
<FireFox317> The arm code is already doing that, so i think that is a good idea for x86 too
<ryuukk__> i have run the formatter, is that ok chance (the bottom, comptime stuff)
<ryuukk__> change*
<ryuukk__> argh i have messed up again
<ryuukk__> it doesn't take the right rule for some reasons
a_chou has quit [Ping timeout: 258 seconds]
<ryuukk__> ok, hopefully it's good now https://github.com/ziglang/zig/pull/6680/
<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]
ur5us has joined #zig
gazler_ has joined #zig
gazler has quit [Ping timeout: 260 seconds]