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/
hnOsmium0001 has joined #zig
gazler has quit [Read error: Connection reset by peer]
gazler_ has joined #zig
<dkibi> marler8997: thanks, I think I need to understand the semantics of zig better to fully grok this, but it's certainly a "huh" when someone tries to use intuition from other languages
<dkibi> (that said, so far I had three instances of "I wonder if I can" and the compiler said "yes", which felt amazing)
Patrice_ has quit [Ping timeout: 272 seconds]
jonase has joined #zig
jonase has quit [Ping timeout: 256 seconds]
pixelherodev has joined #zig
jmiven has quit [Quit: reboot]
jmiven has joined #zig
<daurnimator> andrewrk: marler8997: yes on windows you do a syscall per ".."
<olabaz> How can I use "pub const Config = struct { }" inside of std/heap/general_purpose_allocator.zig in order to initialize my general purpose allocator?
<marler8997> daurnimator, huh? I tested and it looks like windows doesn't do that
<olabaz> I want to pass it into: pub fn GeneralPurposeAllocator(comptime config: Config)
<daurnimator> olabaz: `var mygpa = GeneralPurposeAllocator(Config{.foo = some_value}){};`
<daurnimator> olabaz: or just `var mygpa = GeneralPurposeAllocator(.{.foo = some_value}){};`
<olabaz> daurnimator: If I want the default config can I just do Config{}?
<olabaz> I get undeclared identifier Config
<fengb> You can do GeneralPurposeAllocator(.{}){}
<olabaz> ah ok, but what if I wanted to use Config, it is pub after all so I should be able to call it directly right?
<daurnimator> olabaz: you don't call Config, you instantiate it
<pixelherodev> It's a structure, not a function
<olabaz> ok how do I use it?
<olabaz> In the allocator code they do: const test_config = Config{};
<olabaz> but this gives me undeclared identifier
<daurnimator> olabaz: just leave it anonymous
<olabaz> I will but it seems like I should be able to do something like std.heap.Config or something since it's pub?
<daurnimator> na its in the general_purpose_allocator file; which doesn't seem to be exposed anywhere
<olabaz> oh ok
olabaz has left #zig ["WeeChat 2.3"]
jonase has joined #zig
jonase has quit [Ping timeout: 246 seconds]
Bekwnn has quit [Ping timeout: 245 seconds]
jonase has joined #zig
jonase has quit [Ping timeout: 240 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
knebulae has quit [Read error: Connection reset by peer]
cole-h has quit [Ping timeout: 264 seconds]
stzsch has quit [Ping timeout: 256 seconds]
jonase has joined #zig
jonase has quit [Ping timeout: 256 seconds]
ur5us has joined #zig
jonase has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
jonase has quit [Ping timeout: 264 seconds]
ur5us has joined #zig
Stephie has quit [Read error: Connection reset by peer]
Stephie has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
ky0ko has quit [Remote host closed the connection]
ur5us has quit [Quit: Leaving]
ur5us has joined #zig
osa1_ has joined #zig
osa1_ has quit [Client Quit]
ur5us has quit [Ping timeout: 264 seconds]
gpanders has quit [Quit: ZNC - https://znc.in]
gpanders has joined #zig
knebulae has joined #zig
ky0ko has joined #zig
jonase has joined #zig
jonase has quit [Ping timeout: 246 seconds]
waleee-cl has joined #zig
<tyrion-mx> Hello, why comptime fields of a struct require an initializer?
<tyrion-mx> I mean in the declaration of the struct
wootehfoot has joined #zig
jonase has joined #zig
jonase has quit [Ping timeout: 246 seconds]
jorangreef has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
jorangreef has quit [Remote host closed the connection]
osa1 has quit [Ping timeout: 260 seconds]
ofelas has quit [Quit: shutdown -h now]
nycex has quit [Ping timeout: 240 seconds]
waleee-cl has joined #zig
<ifreund> Nypsie[m]: o7 I'm around now
jonase has joined #zig
cole-h has joined #zig
FireFox317 has joined #zig
jonase has quit [Ping timeout: 256 seconds]
FireFox317 has quit [Quit: Leaving]
FireFox317 has joined #zig
<FireFox317> andrewrk, thanks for merging my PR :)
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
fputs has quit [Quit: WeeChat 3.0]
fputs has joined #zig
olabaz has joined #zig
Akuli has joined #zig
<olabaz> Hi, I have a var c: anyerror!u8 and I tried doing if (c == '\n') but I get error ./src/main.zig:13:18: error: integer value 10 cannot be coerced to type 'anyerror!u8'
<olabaz> should I be using @as(u8, c)?
<olabaz> I mean @as(u8, '\n')
<FireFox317> olabaz, you can only set anyerror!u8 as the return type of a function, its not valid to use the `!` for types of variables etc
<olabaz> FireFox317: oh I see, thanks for the clarification
wootehfoot has quit [Ping timeout: 256 seconds]
wootehfoot has joined #zig
wootehfoot has quit [Remote host closed the connection]
jonase has joined #zig
wootehfoot has joined #zig
moo has joined #zig
moo has quit [Client Quit]
moo has joined #zig
wootehfoot has quit [Ping timeout: 256 seconds]
jonase has quit [Ping timeout: 260 seconds]
FireFox317 has quit [Ping timeout: 240 seconds]
bitmapper has joined #zig
a_chou has joined #zig
moo has quit [Quit: Leaving]
wootehfoot has joined #zig
<olabaz> what's the difference between @cos and std.math.cos?
<olabaz> Also, why isn't it implemented for comptime_float?
<ifreund> FireFox317, olabaz: you totally can assingn error sets to variables, but the coerceion isn't automatic in that specifc case
<ifreund> also you cant use the == operator on error sets
<ifreund> so you'd need if (if (c) |value| value == '\n' else |_| false) { ... }
<ifreund> though this certainly wouldn't be idomatic
<olabaz> yeah I just changed it to a u8
<olabaz> I was using the error because I was reading from stdin
<olabaz> but I just put a try before it: c = try stdin.readByte();
<ifreund> yeah, usually you want to unwrap errors right away
seadragon-droid6 has joined #zig
seadragon-droid6 is now known as seadragon-droid
<seadragon-droid> Is it possible to add methods (decls) to a type dynamically at comptime?
jonase has joined #zig
<ifreund> seadragon-droid: not currently, though there is an open proposal to allow that I believe
FireFox317 has joined #zig
jonase has quit [Ping timeout: 264 seconds]
<seadragon-droid> OK thanks, I think I found it (#6709) I'll play around with some of the workarounds alexnask showed in #383 and see if they can be used to emulate dynamically-added methods
<FireFox317> ifreund, oh yeah ofcourse that is possible haha
seadragon-droid has quit [Quit: Ping timeout (120 seconds)]
jonase has joined #zig
jonase has quit [Ping timeout: 264 seconds]
notzmv has quit [Ping timeout: 246 seconds]
<Nypsie[m]> ifreund: o/ Wanted your opinion on something wasm-backend related. But instead asked Kubkon to put it up as a discussion point during the next stage2 meeting, so it's not really needed anymore :)
notzmv has joined #zig
jonase has joined #zig
<Nypsie[m]> Correct (or on an error)
<olabaz> ok, also I'm reading stdin byte by byte and it crashes when I enter Ctrl+D
<olabaz> ah it gives error on EOF
jonase has quit [Ping timeout: 240 seconds]
ur5us has joined #zig
FireFox317 has quit [Ping timeout: 272 seconds]
osa1 has joined #zig
__foobles has joined #zig
<__foobles> hello :)
jonase has joined #zig
hnOsmium0001 has joined #zig
jonase has quit [Ping timeout: 246 seconds]
dingenskirchen has quit [Quit: ZNC 1.8.1 - https://znc.in]
dingenskirchen has joined #zig
Akuli has quit [Quit: Leaving]
olabaz has left #zig ["WeeChat 2.3"]
wootehfoot has quit [Read error: Connection reset by peer]
ur5us_ has joined #zig
<leeward> Is there a better way to iterate over the possible values of an enum than @typeInfo(E).Enum.fields?
ur5us has quit [Ping timeout: 264 seconds]
jonase has joined #zig
<leeward> I guess std.meta.fields(E) gets me that, but the thing I want to avoid is the @intToEnum call on the EnumField.value.
jonase has quit [Ping timeout: 256 seconds]
<ifreund> leeward: pretty sure @field(E, field_name) works too
<ifreund> though I suppose it isn't any less code
<leeward> I feel like there should be an iterator in std.meta.
<leeward> Maybe I'll come up with something genericizable.
jonase has joined #zig
jonase has quit [Ping timeout: 260 seconds]
a_chou has quit [Remote host closed the connection]
scientes has quit [Read error: Connection reset by peer]
fputs has quit [Ping timeout: 265 seconds]
CommunistWolf has quit [Ping timeout: 258 seconds]
CommunistWolf has joined #zig
__foobles has quit [Quit: Connection closed]
ur5us_ has quit [Ping timeout: 264 seconds]
ur5us_ has joined #zig
ur5us has joined #zig
ur5us_ has quit [Ping timeout: 264 seconds]
jonase has joined #zig
jonase has quit [Ping timeout: 260 seconds]