ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
noonien has quit [Quit: Connection closed for inactivity]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
isd has joined #zig
isd has quit [Quit: Leaving.]
SimonNa has quit [Ping timeout: 255 seconds]
SimonNa has joined #zig
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ichorio has joined #zig
Hejsil has joined #zig
<alexnask> This is an Iterator interface implementation with a SBO and automatic vtable generation if anyone is interested: https://gist.github.com/alexnask/d30c7cbeaccd30bacfa32748dba9045a
<alexnask> Iterator(T) (our interface type) holds an implementation object either in an inplace small buffer or on the heap (in which case the buffer is used to hold the heap + alloc pointers)
<Hejsil> You could probably generate most of that once you have @reify and @reflect
<Hejsil> Which is exiting
<Hejsil> exciting*
<Hejsil> A none owning interface would be a lot simpler to implement though (all interfaces in std are none owning)
<alexnask> I know
<alexnask> I actually have some code that does that
<alexnask> Well, theoretical code
<alexnask> Btw, @reflect (which I decided to call @typeInfo) is nearly done
<alexnask> Only function def info is left
<Hejsil> I have code (that crash the compiler) that does it too :)
<Hejsil> Uuuh
<Hejsil> Hype
<alexnask> I'm going to start work on @reify (perhaps @renderType, I'd like your opinion on the name) after that
<alexnask> I want to make it explicit you can only reflect/reify types so @typeInfo/@renderType sound good to me, what do you think?
<Hejsil> I like @typeInfo, but @renderType i'm not sure
<Hejsil> When I think render, I think, output assembly, video rendering, pretty printers
<alexnask> Right
<Hejsil> But I guess it is a kind of code generation
<Hejsil> So idk
<Hejsil> @createType ?
<alexnask> @mixinType, @generateType could be other option
<alexnask> options*
<alexnask> or @createType, yes
<Hejsil> The name shouldn't stop you from implementing it though :)
<alexnask> Hehe
<Hejsil> I'm sure, if something half decent is chosen, people will accept it
<alexnask> I'm sure @reify will be a alot more involved though
<Hejsil> Probably
<Hejsil> I wish you all the best of luck
<alexnask> Thanks
<alexnask> The only part that kind of bums me out is that we will not be able to generate methods
<Hejsil> Hmm
<alexnask> That would involve a full blown mixin-like construct like Dlang (to get from AST to function definition body)
<Hejsil> Types have some storage data (fields) and global data (const vars and fn). Is it not possible to add a fn to the global data of the type an then generate it?
<Hejsil> typeinfo.functions.add(some_function)?
<alexnask> Sure but I don't think this will actually work for more than non-trivial methods
<alexnask> Idk I'll see what I can do when writing it
<alexnask> I mean it could be semi/useful if you could bind generic functions and instanciate them somehow
<Hejsil> I mean. Generating code inside the method can be done with inline loops @field and all that stuff on the Type/Parameter
<alexnask> Right
<Hejsil> Anyways, we'll see how that all goes
<Hejsil> I have no idea of the backend of types in zig
<alexnask> I guess if the FnDef has a func_type + a function pointer
<Hejsil> You probably know better that I
<alexnask> The issue is that if you want your method to have a &Self parameter
<alexnask> Self is not an actual type yet
<Hejsil> Oooh right
<Hejsil> Hmmm
<Hejsil> That's a hard one
<alexnask> If you need methods that don't rely on types that are yet to be generated
<alexnask> Then you could do it, even instanciate a generic function with the type of args you need I think.
<Hejsil> Is fn def a struct like this: struct { args: []type, arg_names: []const u8, return: type, } ?
<Hejsil> Or something simular
<alexnask> It's the only part left but something similar, yes
<Hejsil> Hmm.
<alexnask> or rather FnDef = struct { calling_convention etc., args: ArgDef[] }
<alexnask> ArgDef = { name, type, etc. }
<Hejsil> Right, my point was that it is `type` and not `TypeInfo` that is stored
<alexnask> Right, I started with "deep" TypeInfo's
<Hejsil> Or whatever the @typeInfo returns
<alexnask> But we agreed with andrew "shallow" typeinfos are better
<alexnask> So, type's, yup.
<Hejsil> They probably are, but I could see method generation maybe working if it was deep TypeInfo's
<Hejsil> But there are probably problems with this
<alexnask> Deep typeinfos would actually make that possible, you could just point it to the root typeinfo
<alexnask> Hmm
<Hejsil> What was the reasoning for shallow?
<alexnask> Easier to generate, you can cache them (with deep typeinfo there is some non-trivial reasons that make caching more involved), you can just get child info with @typeInfo again
<alexnask> I didn't think about the methods at the time
<Hejsil> I see
<Hejsil> Caching is a good reason
<alexnask> The code is also much less error prone (I was doing some pretty funky stuff to avoid infinite loops while generating typeinfo's)
<alexnask> Anyways, I still thionk it's up to debate since this usecase is pretty good, we
<alexnask> we'll have to see with @andrewrk*
<Hejsil> Right
<Hejsil> Methods are important, so it's worth thinking about
<alexnask> Well I could do something funky like using @typeOf(undefined) to represent Self in argument types but it seems like too much magic :p
<Hejsil> Could we use `this`?
<alexnask> 'this' always refers to the parent scope right?
<Hejsil> This works
<alexnask> Right, the issue is that if you use 'this' while generating your typeInfo
<alexnask> 'this' will just point to the scope you are doing your generating in
<Hejsil> Hmm right
<alexnask> (I think)
<Hejsil> Hmm
<Hejsil> Curses!
<Hejsil> Maybe we need some @lazyThis() that gives a type that resolves `this` when @createType is called on TypeInfo
<Hejsil> Idk how complicated that would be
<alexnask> I can't just use a union for an ArgType since 'Self' could be nested inside any arbitrary type expression
<alexnask> Hmm
<alexnask> @lazyCreateType(&root_typeinfo) could be an option too
<Hejsil> True
<Hejsil> Probably better too
<alexnask> Another solution is just using deep type infos for @createType and shallow type infos for @typeInfo
<alexnask> And have a .expand() method for shallow -> deep conversion
<alexnask> Idk
<alexnask> We'll see
<alexnask> Gotta go, I'll be finishing off @typeInfo later, see you around
<Hejsil> Cya
davr0s has joined #zig
<GitHub18> [zig] Hejsil pushed 1 new commit to master: https://git.io/vp44p
<GitHub18> zig/master 3178528 Jimmi Holst Christensen: Removed zero sized error set optimization...
Dodo has joined #zig
<Dodo> alexnask, what name should I put on the contributors? :) https://github.com/DutchGhost/Zigerator/tree/master
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
<alexnask> @Dodo Alexnadros Naskos
<alexnask> :D
<Dodo> okey!
<alexnask> Alexandros*
<Dodo> oh hahaha, that'll be pushed in the next push
<alexnask> I updated the gist with a heap + SBO optimization for the interface btw :)
<alexnask> And plenty of comments + a couple of examples
<Dodo> look at the new branch I created xD
<Dodo> already bussy working on it ^^
<alexnask> Nice!
<alexnask> Hit me up if you run into any issues, I haven't tested much though it seems solid
<Dodo> the few tests so far have not blown up
<Dodo> soo all going well haha
<alexnask> I'm just a touch concerned with the comptime vtable generation, I'm not sure if the compiler is smart enough to cache the vtable for an implementation type
<alexnask> Or if it will create multiple vtables for each use
<alexnask> I'll check it out
<alexnask> But at worst I think an intermediate function that just calls IteratorVTable(T).init(ImplType) will be enough to force caching
<alexnask> But at worst I think an intermediate function that just calls IteratorVTable(T).init(ImplType) will be enough to force caching
<alexnask> woops
<Hejsil> Are you sure https://gist.github.com/alexnask/d30c7cbeaccd30bacfa32748dba9045a#file-iterator-zig-L79 wont be left on the fn stack and then you have a dangling pointer?
<alexnask> It seems to work fine
<Hejsil> Stack pointer does that sometimes
<Hejsil> Just work, that is
<Hejsil> Even if it is undefined
<alexnask> Right, I'll make sure that it isn't on the stack but I'm 90% certain it's in static memory
<Dodo> Once(usize).init_iter(49).chain(&range) it too big,
<Dodo> darnit xD
<Dodo> *is
<alexnask> The Chain iterator?
<Dodo> yeahh
<Dodo> well, it has 2 ptr's to Iterators, and a ptr like what, 4 bytes?
<Dodo> so thats 8
<alexnask> On x64 a pointer is 8 bytes
<alexnask> (64 bits)
<Dodo> 8!
<Dodo> oh dar
<Dodo> *dar
<Dodo> *dear
<alexnask> :D
<Dodo> can we bump the buffersize? :3
<alexnask> Sure, just change Iterator_Buffer_Size
<alexnask> I would suggest keeping it as small as possible though :P
<Dodo> however, would that be a good idea?
<alexnask> Atm @sizeOf(Iterator(T)) is 32 bytes
<Dodo> I wonder how the performance is if Chain is heap allocated
<alexnask> It's just 1 allocation
<alexnask> And 1 free
<alexnask> However, I think it should fit
<alexnask> If it's just 2 pointers + 1 enum it should be 17 bytes
<alexnask> And you can fit up to 23 bytes with a 24 byte buffer
<Hejsil> It seems to be static data: frame: u8@7ffe24a31070 vtable: IteratorVTable(usize)@23e3e0
<Hejsil> You win this time
<alexnask> :D
<Hejsil> :)
<alexnask> That's why the comptime is after the ref
<Dodo> so 24 should be enough?
<Hejsil> I assumed it would just put the comptime data on the stack of the function
<alexnask> I think so
<Dodo> well thats funny
<alexnask> @Hejsil I think it would do that if the whole expression was comptime
<Dodo> its already 24 xD
<Dodo> 25 works
<alexnask> Yes, is it erroring saying Chain is too big? Are you sure you are keeping pointers to iterator's and not iterators?
<alexnask> Ah well
<alexnask> :p
<Hejsil> True, but you can do &someFn(), and that will give you a ptr to stack memory
<Hejsil> I'll play around and see when comptime is stack, or static
<alexnask> Sure, it will initialize var __temp = someFn(); then take &__temp
<Dodo> state: ChainState, iter_a: &Iter, iter_b: &Iter,
<Dodo> thats all Chain has
<Dodo> and a 'const Self = this';
<alexnask> If you did &comptime someFn(); someFn is evaluated at comptime
<alexnask> So I think the data will always be in static memory
<alexnask> Not 100% sure though.
<Hejsil> I think that's an optimization
<alexnask> @Dodo You caould try making ChainState an enum(u8)
<Hejsil> You can probably rely on it
<Dodo> nope
<alexnask> @Dodo ah well LLVM probably bumps Chain up to 24 bytes
<Dodo> should we make it 32 bytes?
<Dodo> thats a nice multiple of 8
<alexnask> @Hejsil I think if your comptime value is ConstValSpecialStatic it will end up in static memory
<Hejsil> I'd probably do this to ensure that it is static: https://pastebin.com/raw/c6p1dSrt
<alexnask> @Dodo Yes, it should be fine
<Hejsil> This makes it pretty clear at least
<Hejsil> But whatever
<Hejsil> If it works it works
<alexnask> I think it's pretty clear with the comments
<Hejsil> True, a comment would do just fine
<Dodo> how can this: "self.data.small_buffer.flag_byte = 1;" be turned into a comptime expression?
<alexnask> ConstValSpecialRuntime constexpr values probably get shoved into the frame
<Dodo> than we can make comptime iterators
qazo has joined #zig
<alexnask> @Dodo They should work at comptime as is
<alexnask> Well, on my branch
<alexnask> So on master in a bit, comptime union field access is broken atm
<Dodo> well, it doesnt work for me haha
<alexnask> Yup, that's a bug ^^
<Dodo> error: unable to evaluate constant expression :(
<alexnask> Let me try to make sure it does work on mine
<alexnask> Yes, the union access is broken
<alexnask> But my PR should make it into master today or tomorrow
<Dodo> mh, I should git clone the compiler... but that also involves building it
<Dodo> can I just go into visual studio and compile?
<Dodo> I've never really build a C/C++ project...
<alexnask> You need cmake + visual studio
<alexnask> But it's really easy
<Dodo> I dont know if I have cmake,
<alexnask> @Dodo You don't really need to build the compiler though
<alexnask> You can find builds for every commit here: https://ci.appveyor.com/project/andrewrk/zig-d3l86/history?branch=master
<Dodo> \o/
<alexnask> I should probably enable them for my fork too
<Dodo> there is actually quite some stuff I got to change now hahaha
<Dodo> which means there's quite some functions already :)
<alexnask> Yes, I saw there's a lot of stuff in there :)
<Dodo> I hope I can make it work before dinner
<alexnask> @Dodo Actually Once fails in comptime on my branch too, I'll take a look after I'm done with @typeInfo
<alexnask> It doesn't even fail with an error message, it just crashes the compiler :p
<alexnask> I enabled travis CI and appveyor builds for my fork btw, if anyone wants to play with @typeInfo I'm @alexnask on github and the branch is reflect_reify
<alexnask> (Or you can find them in PR#951)
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Dodo> it crashes the compiler :O
<Dodo> sounds good xD
<alexnask> Meh that happens :p
<alexnask> The compiler is just a program after all ;)
<alexnask> I've crashed clang lots of times too :P
<GitHub170> [zig] Hejsil pushed 1 new commit to master: https://git.io/vp4u6
<GitHub170> zig/master 2fc34ea Jimmi Holst Christensen: Functions with infered error set can now return literals...
<alexnask> @Hejsil Nice, that one was so annoying :P
<Hejsil> :)
<Hejsil> I'm not sure I've covered everything. The code for this is a little complicated
<Hejsil> Code for infered error set
<alexnask> @Dodo fwiw form the quick look I took it's just a 1-liner fix
<alexnask> from*
<Dodo> why does that work?
<Dodo> next_front_iter gets destroyed when the function exits, right?, sooooo that would mean self.frontiter has a reference to garbage
<Dodo> yet the test passes
<alexnask> Hmm let me see
<Hejsil> As far as I know, pointers to invalid stack can happen to work
<alexnask> Yup
<Dodo> or it works because I use an array there, so the Iterator in that memory is still valid
<alexnask> I think it's just randomly working
<Hejsil> My question is why you are even able to do next_front_iter.next() when next_front_iter is nullable :)
<Hejsil> Ooh wait
<alexnask> ;)
<alexnask> var next_front_iter = self.iter.next() ?? return null;
<Hejsil> no
<Hejsil> My bad
<Hejsil> Did not spot the return
<Hejsil> lol
<Dodo> I wish we had like a .map() on nullables
<Dodo> where it applies the function if its not null, otherwise returns null
<alexnask> @Dodo I don't think it works because of the array, because the Iterator gets copied on the stack anyways
<alexnask> It's just random
<Dodo> well, that randomness is reproducable
<Hejsil> Dodo, you could do (it ?? return null).map()
<alexnask> Sure
<Dodo> it has not crashed yet xD
<alexnask> I mean, it will keep running well :P
<MajorLag> try compiling in a different release mode, that usually breaks that sort of behavior on at least one build for me.
<alexnask> Probably because of some optimization
<alexnask> Or because you don't touch the stack much between next() calls
<Dodo> but still, what Im doing there is horribly terribly wrong,
<Dodo> so I should change it
<alexnask> Yes :P
<Dodo> this would not compile in *another language* :3
<alexnask> Rust is great, yes ;)
<alexnask> zig is great too though, just in different ways ^_^
<Dodo> it's kind of scary how things like that can creep up so easily
<alexnask> zig is more like C than Rust
<Dodo> what if you're writing some kind of super important code, and you do this...
<Hejsil> I think, for trivial cases, Zig could detect that you're returning pointers to invalid data
<alexnask> In C even hello world is usually written in a buggy way
<alexnask> (not returning 0 and ignoring printf() return)
<alexnask> Right, some escape analysis would be great
<Dodo> I remember I once saw a video of people using multiple kernel bugs to gain privileges on a system
<Dodo> and bugs in browsers like firefox, safari and edge..hell, even one or two in VirtualBox and VMware
<Dodo> they got quite some money for it tho haha
<alexnask> C: sustaining bug bounties since 1972
<alexnask> :P
<Hejsil> If we didn't have security bugs, then how would hackers earn money :)
<Hejsil> I tend to leave a few in my programs. That way, I keep the economy going.
<Dodo> stealing passwords from the backup that's stored on "http://somesite/backup"
<Dodo> have you guys done Capture the Flag's?
<alexnask> inurl:"/AppData/Filezilla/*" filetype:xml :P
<alexnask> @dodo nope
<Hejsil> Nope
<alexnask> Never really got into cybersecurity stuff tbh
<Hejsil> ^
<alexnask> Just give me a compiler and/or systems code :P
<alexnask> Compilers are the greatest, I remember debugging away for 10-12 hours on rock (ooc-lang compiler) to end up with a 5-line fix
<alexnask> But damn it those 5 lines were good :p
<Dodo> xD
<Dodo> I seem to enjoy writing stuff more than to break it, but both are just cool haha
<Dodo> allright, Flatten seems to brake compilition, even when the Iterator_Buffer_Size is 100
<Dodo> it holds an &Iterator(Iterator(T)), that should only be 8 bytes, and an ?Iterator(T), which is...32(???) bytes
<alexnask> If you're holding an Iterator by value then it will never fit into an Iterator
<alexnask> @sizeOf(Iterator(T)) > @sizeOf(Iterator(T).data)
<Dodo> but holding it by reference is also wrong
<Dodo> or well, at least how I did it
<alexnask> Right, so Flatten needs to be heap allocated
<alexnask> I think, I don't think you can ever make it fit into the small buffer
davr0s has joined #zig
davr0s has quit [Client Quit]
<alexnask> @Dodo It's pretty trivial, just pass in a &mem.Allocator into your Flatten.init_iter and then pass it trhough to Iterator(T).init
<alexnask> But you'll have to .deinit your Flatten iterators
<Dodo> defer flatten.deinit
<Dodo> right?
<alexnask> yup (+ a parentheses pair obviously)
<Dodo> mh, but `frontiter: ?Iter`, can just be 'frontiter: ?&Iter`, but malloc the Iter, and overwrite it each time?
<Dodo> still need to have deinit to clean up, but well
<alexnask> Yes, you could handle the allocation in Flatten for sure
<Dodo> what would be better to do?\
<alexnask> Hmm
<alexnask> Well imho you should let Iterator handle the allocation, since it's not strictly necessary for Flatten
<alexnask> Flatten can work without an allocation
<alexnask> It's just that if you need it as an Iterator, since Iterator owns the memory if needs to be pushed onto the heap
<Dodo> so it should only have a .next() method,
<Dodo> and something to set it up obviously
<alexnask> Right, any struct with a next(&Self) ?T is compatible with Iterator(T)
<alexnask> Iterator(T) just handles the vtable stuff + holds the memory
<alexnask> You could set up Iterator(T) to just point to the iterator implementation instead of owning it but that makes stuff even harder to keep track of imo
<alexnask> You don't even need an init method that returns an Iterator(T)
<alexnask> I just wrote it for convenience
<alexnask> Iterator(T).init(alloc, some_object) will work as long as @typeOf(some_object) has a next(&Self) ?T method
<alexnask> (which means people could use Zigterator with types made in other packages)
<Dodo> https://github.com/DutchGhost/Zigerator/blob/BetterInterface/src/main.zig#L119 <-- it's not really a pleasure to write honestly
<Dodo> or Im just overcomplicating things
<alexnask> @Dodo I would suggest having an init_iter method on Flatten just like other iterators
<alexnask> But taking the allocator in init_iter and calling Iterator.init instead of Iterator.init_inline_ptr
<Dodo> oh mh yeah
<alexnask> That way you can write 'var flatten = Flatten(Iterator(usize)).init_iter(std.debug.global_allocator, &sliceiter);'
<alexnask> And you can catch unreachable in Flatten.init_iter or return !Self, your call
<Dodo> !Self is nicer
<alexnask> Yes, I think so too :)
<Dodo> so that would be 'try return ....' ?
<alexnask> Nah, just return Iterator(T).init(...);
<alexnask> I meant !Iterator(T) btw
<alexnask> try A; compiles down to A catch |err| return err;
<alexnask> You want to return the error or the object anyways, so you can just return the expression itself
<GitHub34> [zig] Hejsil pushed 1 new commit to master: https://git.io/vp42v
<GitHub34> zig/master fba0347 Jimmi Holst Christensen: .ReturnType and @ArgType now emits errors on unresolved types...
<Dodo> mhhh Im a bit confused haha
<Dodo> Or Im just really dumb by not writing 'catch unreachable'
<GitHub89> [zig] Hejsil pushed 1 new commit to master: https://git.io/vp4aR
<GitHub89> zig/master 341f8c1 Jimmi Holst Christensen: Fixed wrong formatting for arg_index when reporting @ArgType error
<Hejsil> printf format strings are the worst ):
<Dodo> almost there
<Dodo> just .map() and .filter()
qazo has quit [Quit: leaving]
<Dodo> Done!
<Dodo> okey nearly done, the slice bit still has to be updated
<Dodo> but well xD
<alexnask> Close enough ;)
<Hejsil> Well, the failing travis build for osx is andrewrk's problem now. The log is to long for me to see the error...
Hejsil has quit [Ping timeout: 260 seconds]
Hejsil has joined #zig
<Hejsil> Hmmm, something tells me that unresolved types might not be null, but be uninitialized memory
<Dodo> whoa, git is actually really easy to use
<Dodo> I never made a branch to update something and then merge
<Dodo> alexnask: , with fix of the comptime issue, this: https://github.com/DutchGhost/Zigerator/blob/master/src/main.zig#L210 can run at compile-time?
<Dodo> because that would be so powerfull
<Dodo> with some more magic you could turn the arraylist into an array as well, and you can collect any comptime known Iterator into an array \o/
<alexnask> hmm
<alexnask> Not sure if ArrayList works at comptime
<alexnask> Actually I think anything that uses an allocator won't work
<alexnask> Not 100% on that though
<Dodo> could create a function that collects into an array, all that's needed is the type, and the length
<alexnask> It may be th @ptrCast that doesn't work, which may also be the cause of Iterator's not working at comptime atm.
<Dodo> actually I only need a length...I already know the type !
<alexnask> It should work in theory (although it's pretty complex to implement in the IR evaluation)
<alexnask> Right, you can pass a slice to write in and return an error if the slice is not big enough
<alexnask> Or something similar
<Dodo> collect_array and collect_slice it is
<alexnask> @Hejsil Users/travis/build/zig-lang/zig/src/ir.cpp:18733:21: error: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
<alexnask> arg_index, buf_ptr(&fn_type->name)));
<alexnask> is the error on the MacOS build
<Dodo> which reminds me, .count() is also a usefull method. That consumes an Iterator, returning how many items it contained
<alexnask> Alathough that's on my branch so the line number is probably incorrect
noonien has joined #zig
<Hejsil> alexnask I did fix that :)
<alexnask> Right, I'm probably quite behind master atm
<Hejsil> I think I found it, but this time I'll push to a branch so I don't pollute this chat or master with commits
<Hejsil> It seems to be a not initialized ptr that is checked for null
<Hejsil> And only on osx does this fail
<alexnask> I feel like the function def code will be bigger than the rest of the typeinfos combined :P
<Dodo> how do I have a noreturn `anonymous` function?
<Dodo> struct { fn apply(tup: &Tuple(Item, Item)) { *tup.t1 = *tup.t2; } }.apply
<Dodo> but that does not compile
<Hejsil> struct { fn apply(tup: &Tuple(Item, Item)) void { *tup.t1 = *tup.t2; } }.apply
<Hejsil> The compiler errors for forgetting the return type is bad
<Hejsil> are bad*
<Dodo> darnit
<Dodo> I cant take my tuple type by value
<Dodo> but I ..need to xD
<Dodo> anyway, dinner
<Hejsil> We'll get it soon :)
Dodo has quit [Quit: Page closed]
isd has joined #zig
<GitHub121> [zig] Hejsil merged osx-fix-for-param-info into master: https://git.io/vp4Ko
Dodo has joined #zig
<Dodo> well Hejsil , once it's possible to take user defined structs and enums by value, this function works: https://github.com/DutchGhost/Zigerator/blob/master/src/Iterator.zig#L256
<Dodo> and honestly, I think that looks really clean
<Hejsil> Couldn't you just take by &const and then take a copy inside
<Hejsil> But yes
<Hejsil> We need "Pass by value" semantics
<Hejsil> For structs
<Dodo> well, I'd have to change the way how 'map()' works, which would be a breaking change
<Dodo> because then I'd require to take integer types etc also by &const, or '&', which is really weird
<Hejsil> Ye, for generic code, &const ptr is a nessesary evil. For now: https://github.com/zig-lang/zig/issues/733
SimonNa has quit [Quit: Leaving]
isd has quit [Quit: Leaving.]
<Dodo> is there a page where there is a releasedate for version 0.3?
<Dodo> while(self.iter.next()) |*val| {//do something} <--- val is a reference to the actual value , right?
davr0s has joined #zig
<Hejsil> Dodo, yes
<Hejsil> If next() returns ?T then @typeOf(val) is &T
<Dodo> exactly what I need
<andrewrk> Hejsil, I have 3 full uninterrupted days to work on zig starting now
<Hejsil> Well, now I just fix all my bottlenecks myself :)
<andrewrk> I'm thinking about tackling pointer reform
<Hejsil> Wuuh
<andrewrk> either that or make significant progress on self hosted compiler (with concurrency / job system)
<Hejsil> Oooh yes! Blocked again! https://pastebin.com/raw/X61WQsW8
<andrewrk> oh no
<Hejsil> I'm getting good at this compiler crashing business
<Hejsil> Or well
<Hejsil> It looks like invalid LLVM generation
<andrewrk> yes that is certainly what it is
<andrewrk> is that using coroutines?
<Hejsil> Nope
<andrewrk> good find
<andrewrk> I'll have a look in a few minutes after I finish writing this test for std.atomic.Stack
<Hejsil> Np
<andrewrk> I think I understand AtomicOrder enough to write good docs on them now
<Hejsil> It might have something todo with alignment cast
<Hejsil> Maybe
<Hejsil> Wait no, that's not what is happening
Dodo has quit [Quit: Page closed]
<Hejsil> Oooh, i see it
<Hejsil> Im accessing parameters of a function inside a "local function"
<andrewrk> ah. yeah we don't have good compile errors for that yet
<Hejsil> This is nothign new
<andrewrk> local functions are a minefield right now
<Hejsil> But they're sooo useful!
<andrewrk> yeah we gotta fix it
<Hejsil> I can't stop myself!
<andrewrk> even I used them in the thread implementation
<Hejsil> My wishlist for christmas is full of Zig features
<andrewrk> lol
<andrewrk> 3 days of zig for me! I'm excited
<Hejsil> Was const a = fn() void {} approved?
<andrewrk> making an anonymous function implementation? yeah I think so
<Hejsil> Aka, do to functions what was done to structs
<andrewrk> yeah that makes sense
<Hejsil> And I'm building again!
jfo has joined #zig
jfo has quit [Quit: WeeChat 2.1]
Ichorio has quit [Ping timeout: 260 seconds]
<GitHub151> [zig] andrewrk opened pull request #963: Atomic stack and queue (master...atomic-stack-and-queue) https://git.io/vp4S3
isd has joined #zig
steveno_ has quit [Quit: Leaving]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
xkern has joined #zig
xkern has quit [Read error: Connection reset by peer]
steveno_ has joined #zig
<Hejsil> andrewrk, I have done it again! https://pastebin.com/raw/Dhuwtgk3
<Hejsil> And it's not even related to local functions this time
davr0s has joined #zig
<andrewrk> argh, I can't keep up
<Hejsil> Lol
<Hejsil> I'm trying to figure out exactly how this happends
<Hejsil> How did I create a fn(&const u9) u16 and call it with a u16
<Hejsil> Idk