Lazy-Zig icon indicating copy to clipboard operation
Lazy-Zig copied to clipboard

0.11.0 Fixes

Open JonBoyleCoding opened this issue 1 year ago • 1 comments

I'm submitting this as a draft PR as it's not fully working yet and could use some more eyes.

  1. toList requires try for the allocations
  2. struct/iterator code not compiling

However, I am unable to get the struct/iterator working for a hashmap at the moment as it just says on the lazy.init that it is unable to resolve comptime value.

		var test_map = std.StringHashMap(u8).init(allocator);
		var lazy_t_itr = lazy.init(test_map);

I find this weird because as far as I can see this type should be available at comptime.

If you have any further thoughts as to how to get this working I'd appreciate it.

JonBoyleCoding avatar Dec 08 '23 17:12 JonBoyleCoding

@JonBoyleCoding

Hey! Thanks for raising this PR.

Sadly, I'm not that up to date with Zig these days (mostly moved onto other projects) so my reference for these sorts of things is limited.

Happy with ToList throwing error, looks like Zig is making all memory allocations throw errors. No real way around this outside of forcing the list to be pre-reserved so that errors can be dropped (which would be an awful API).

I don't actually have a local build of zig but I'll try to find some time tomorrow to install it so I can have a look. In saying that, is there a specific error it's giving? It does sound potentially like a Zig compiler bug if it's something really vague like "can't resolve comptime value"

BraedonWooding avatar Dec 09 '23 04:12 BraedonWooding