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)
<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]