ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<andrewrk> This is on hacker news right now
<andrewrk> If we did a blog post on how to do this in zig, probably with perfect hashing instead of tries, it would be some good publicity
<scientes> andrewrk, we can replace gperf?
pdmer has quit [Quit: pdmer]
kristate has joined #zig
<scientes> cool
<scientes> keep O(log n) lol
kristate has quit [Remote host closed the connection]
pdmer has joined #zig
kristate has joined #zig
pdmer has quit [Quit: pdmer]
pdmer has joined #zig
qazo has joined #zig
qazo has quit [Ping timeout: 240 seconds]
mahmudov has quit [Ping timeout: 252 seconds]
<scientes> andrewrk, I think this perfect hash algorithm would require a comptime allocator: https://gist.github.com/smhanov/94230b422c2100ae4218
<unique_id> Noob question, how do I open a file for read and write?
<scientes> openRead() or openReadC() unique_id
<scientes> oh read+write
<scientes> the stdlib doesn't use has a generalized (works on windows) function that uses posix.O_RDWR
<scientes> unique_id, windows has OF_READWRITE, you should add a OpenReadWrite+OpenReadWriteC
pdmer has quit [Quit: pdmer]
pdmer has joined #zig
pdmer has quit [Quit: pdmer]
pdmer has joined #zig
pdmer has quit [Quit: pdmer]
<kristate> today seems to be the 700th day since zig was started
_whitelogger has joined #zig
kristate has quit [Ping timeout: 240 seconds]
Hejsil has joined #zig
SimonNa has quit [Remote host closed the connection]
SimonNa has joined #zig
_whitelogger has joined #zig
<scientes> I doubt it makes sense to use llvm to compile DFAS directly with its DAG, (wondering how to commptime DFAs), which means that something like gperf would still be necessary.
Hejsil has quit [Ping timeout: 252 seconds]
<scientes> including for my wish-project: comptime regular expression engine
<scientes> it would be an epic hack, but I don't think llvm could really handle it
<scientes> meh gperf isn't very demanding
davr0s has joined #zig
davr0s has quit [Client Quit]
<unique_id> That feeling when you're using sqlite as an application data format and you learn it doesn't support async ops and so you search for a key value store alternative but can't find anything you like and so you're about to create a bunch of unnecessary threads for streaming in resources :(
<scientes> unique_id, did you ever readwrite that file?
<unique_id> yeah I just copied openReadC and changed it a bit
<scientes> I really think it would make sensin the std lib
<unique_id> im short on time atm
wilsonk has quit [Read error: Connection reset by peer]
<andrewrk> yeah no worries, we'll get it eventually
DutchGh0st has joined #zig
<DutchGh0st> how do I take 'self'or 'this' in a struct method?
<DutchGh0st> " error: use of undeclared identifier 'this'"
<MajorLag> `struct A { fn doStuff(self: *A, ...) }` or `struct A { const Self = this; ... fn doStuff(self *Self, ...)}`.
<DutchGh0st> const Self = this does not work?
<MajorLag> code?
<scientes> ^this is gone
<MajorLag> Oh, I didn't realize that change had gone in yet.
<andrewrk> github mangled the commit message, it's actually `@This()`
<DutchGh0st> doesnt work on the newest compiler
<DutchGh0st> gonna try @this()
<andrewrk> it only can refer to types now. the "block" type is gone
<andrewrk> DutchGh0st, it's @This()
<MajorLag> That's good, one less not-quite-real type.
<scientes> nows for namespace->struct
<MajorLag> that'll just leav ArgTuple and BoundFn I think.
<andrewrk> argtuple will be solved by actual tuples
<andrewrk> BoundFn will probably stay
<scientes> How about allowing comptime DAGs via pointers? (using recursion) but isn't checking for cycles O(n^2)...
* scientes is comtemplating comptime perfect hash function
<andrewrk> what do you mean scientes? is there some reason you can't make a DAG at comptime?
<scientes> I haven't tried
<scientes> but the lack of a comptime allocator means I can't really try
<andrewrk> ah so you're talking about https://github.com/ziglang/zig/issues/1291
<scientes> but i still don't think it woudl be possible
<scientes> and even if so, its probably the wrong approach to load up the whole graph into llvm
<scientes> but it could be really slick: switch(std.perfecthash(a_enum)) { case(enum_instance.key) default...}AND THATS IT
<MajorLag> oh hey, AppVeyor builds started working again.
<scientes> --release-safe was turned off
<andrewrk> yeah I disabled all non debug tests
<andrewrk> but according to https://github.com/ziglang/zig/issues/835 it looks like we can use azure for 6x longer jobs
<MajorLag> unfortunate, but it'll be nice to be able to be on the latest build again.
<scientes> andrewrk, I got arm builds working with buildbot
<scientes> andrewrk, you just have to turn on the github trigger https://github.com/ziglang/zig/pull/1429
<scientes> no need for slow-ass qemu
<scientes> I'm paying 3eu/mo for a scaleway arm64 VPS
<andrewrk> scientes, those URLs are not loading for me - can you give me more specific instructions?
<DutchGh0st> allright, cool, I can now sort of emulate interfaces, and require a signature and name
<DutchGh0st> (the name of the required function that is)
<scientes> click "add webhook"
<andrewrk> application/json or application/x-www-form-urlencoded?
<scientes> json
<andrewrk> empty secret?
<andrewrk> ok I added it
DutchGh0st has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
davr0s has joined #zig
DutchGh0st has joined #zig
<DutchGh0st> you're all probably really bussy with 0.3, but where can I find what is being changed?
<andrewrk> DutchGh0st, you're trying to subscribe to breaking changes, yeah?
<DutchGh0st> ^^ haha, it's fine
<andrewrk> I'll at least mention everything in the 0.3.0 release notes
<andrewrk> you could do a git log -p of the file doc/langref.html.in. that will give you an idea about language changes
<andrewrk> for standard library changes you'll have to pay attention to commits too. everything in the std/ directory
<andrewrk> (unless you stick with releases in which case you can read the release notes)
<DutchGh0st> yeahh once in a while I download a version from the build site haha
mahmudov has joined #zig
DutchGh0st has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
DutchGh0st has joined #zig
DutchGh0st has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<andrewrk> I've done it
<andrewrk> perfect hashing that llvm can fully optimize
<andrewrk> I'm going to make a blog post about this
davr0s has joined #zig
DutchGh0st has joined #zig
<DutchGh0st> error: evaluation exceeded 1000 backwards branches <-- but I have a @setEvalBranchQuota(3500) at the start of the comptime stack
<andrewrk> DutchGh0st, hmm, can I see?
<DutchGh0st> it has an embed file in it tho
<DutchGh0st> the file contains 1130 characters totall
<andrewrk> I'll look in a little bit
DutchGh0st has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<unique_id> extern vs packed structs? I have a struct whose fields I want to control the order of
<unique_id> I know how it works in C/extern, I don't know how packed works
kristate has joined #zig
<andrewrk> unique_id, so i can understand your use case - for what purpose do you need to control the order?
<unique_id> andrewrk: the fields are of dramatically different sizes and I have atomic ints in there. For that reason I want to be able to play around with the order
<andrewrk> ah, I see, for cache reasons
<unique_id> yes
<andrewrk> unique_id, I think you should use extern for this case until https://github.com/ziglang/zig/issues/1512 is solved
<andrewrk> I think your use case is interesting though, it's not perfectly covered by zig's feature set
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
DutchGh0st has joined #zig
<kristate> andrewrk: does zig have a u0 type?
<kristate> i guess it does
<DutchGh0st> 18kB is verry small , right?
<kristate> 640k should be enough for anybody
wilsonk has joined #zig
<DutchGh0st> the executable is 18k..
<DutchGh0st> ohmy
<DutchGh0st> hahaha, maybe it was in the back of mind now you gave that article, I just did not recognize it hahahaha
<DutchGh0st> how could I forget ^^
<kristate> DutchGh0st: although to answer your question, yes it is relatively small
<kristate> $ ls -lah /bin/echo is 18K
<kristate> $ ls -lah /bin/cat # 23K
<DutchGh0st> https://github.com/DutchGhost/Advent-of-Code/blob/master/Zig/day02/day02.zig#L69 <-- comptime can reduce alot of things I guess?
<kristate> well it's calculating that at comptime
<kristate> so, at runtime, there really wouldn't be anything there
<DutchGh0st> so it only holds 2 usizes, and those only get printed
DutchGh0st has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<andrewrk> unique_id, you could put your struct fields that need to be bundled together in their own struct
<andrewrk> that will force them to be next to each other (although unspecified which one is first)
kristate has quit [Ping timeout: 252 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<unique_id> andrewrk: good idea, I might do that. I'm more focused on writing code right now so I have left things as default
davr0s has joined #zig
<andrewrk> unique_id, some day I hope we can have Profile Guided Optimization integrated into zig in a clean way and zig would figure out to do these kind of optimizations
DutchGh0st has joined #zig
DutchGh0st has quit [Client Quit]
wilsonk has quit [Read error: Connection reset by peer]
wilsonk has joined #zig
<unique_id> I see that we have @atomicRmw and std.atomic.Int's xchg, but what about compare-and-swap? https://en.wikipedia.org/wiki/Compare-and-swap
<scientes> unique_id, xchg is compare-and-swap
<scientes> i mean cmpxchg is compare-and-swap
<scientes> is there really a xchg that doesn't compare? cause x86 has an instruction for that?
<scientes> more specifically: compare-and-swap is a way to implement cmpxchg, but most architectures has more performant implementations.
davr0s has quit [Read error: Connection reset by peer]