ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dd3 has quit [Ping timeout: 256 seconds]
cenomla has joined #zig
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk> coroutines proposal is up
davr0s has joined #zig
sepisoad has joined #zig
sepisoad has quit [Client Quit]
cenomla has quit [Quit: cenomla]
ofelas has quit [Quit: shutdown -h now]
dd3 has joined #zig
achamb has joined #zig
<achamb> has any thought been given to things like restricted ranges for integer types in zig?
<achamb> seems like a safety mode sort of thing
<achamb> e.g. an integer that must be in the range 0-59
<achamb> or 1-12
<achamb> i think it is something ada has
arBmind has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
<MajorLag_> Closest we have right now is arbitrary bit-length integers. In safe and debug mode those would be checked for range at runtime.
steveno_ has joined #zig
davr0s has joined #zig
steveno_ has quit [Ping timeout: 276 seconds]
steveno_ has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
jfo has joined #zig
<jfo> achamb: I was actually thinking how much I would like that in the context of an index to a fixed length array. Like a modified usize. Then out of bounds access on the array would be synonymous with integer overflow for the derived type. I don't know how useful that would be in that context or if it's a thing that exists other places but it's a though
<andrewrk> achamb, I've been thinking a lot about this recently
<andrewrk> I haven't typed out any proposals
return0e has quit [Ping timeout: 248 seconds]
return0e has joined #zig
return0e has quit [Read error: Connection reset by peer]
jfo has quit []
return0e has joined #zig
cenomla has joined #zig
davr0s has joined #zig
arBmind has quit [Quit: Leaving.]
<sient> re https://github.com/zig-lang/zig/issues/781, is there a way to mirror the `struct Foo {}; REGISTER(Foo);` pattern in C?
<sient> (C -> C++)
<andrewrk> sient, what does REGISTER do?
<sient> depends, but what I have done in the past is register a static variable that has a ctor which constructs a singleton instance and adds it to a static list
<sient> I can share a link to code if need be
<andrewrk> yes please, may I see?
<sient> I used to maintain a list of all handlers, it would sometimes causes wasted time spent debugging due to forgetting to register
steveno_ has quit [Quit: Leaving]
<andrewrk> sient, it looks like it still registers at runtime, but the difference is that now you can put REGISTER_IPC_MESSAGE below the type declaration instead of in the Run function. is that right?
<andrewrk> one strategy you could have in zig, is iterate over a list of modules (files) at compile time and instantiate them this way
<andrewrk> then you would get compile errors for not fulfilling the plugin interface or whatever
<andrewrk> the short answer to your question is no, there are no static constructors. but I really think you can accomplish the goals a better way with comptime machinery
<sient> ah, that'd be perfect - didn't realize comptime could introspect like this; is there a test for the feature I can look at?
<andrewrk> hm, no but I should add some
<sient> yes, banning static ctors seems like a good idea ; chrome bans them outright due to startup time penalties
<andrewrk> as you noted, there aren't a lot of tests for things like this. if you run into bugs I'll try to get them sorted right away to unblock you
<sient> that example looks perfect, thanks
dd3 has quit [Ping timeout: 240 seconds]
<MajorLag_> Pretty much any time I try to do something with (type)"var" other than take it as a comptime parameter it crashes the compiler. I'm mentioning this rather than continue to make bug reports.
<MajorLag_> Most of these should never be allowed anyway, I'm just poking around trying to see if I can make reasonable implementations of things that might otherwise be language features.
arBmind has joined #zig
<andrewrk> MajorLag_, it's a mistake that "var" is allowed as a type. it's really just syntax that function parameters and return type can use
<andrewrk> I'll fix it in the parser soon
<andrewrk> it's not really a type
<MajorLag_> Yeah, I get that.
<andrewrk> I think we have plans for the stuff you're trying to do though
<andrewrk> right now you can't have a variable at compile time that gets assigned a different type
<andrewrk> that's a problem
<andrewrk> I think we need to make comptime variables support being assigned different types
dd3 has joined #zig
izabera has quit [Ping timeout: 264 seconds]
dd3 has quit [Ping timeout: 240 seconds]
zesterer has joined #zig
achamb has quit [Quit: Page closed]