Raul Leal
Raul Leal
I quite like the idea of a separate syntax for method calls since it isn't just "accessing a child of a container", it's also sending an implicit first parameter. Lua...
Does this also affect the capture syntax? `for (values) |_ , i| print(i);` -> `for (values) |unused , i| print(i);` `if (maybe) |_| "Not null" else "Null";` -> `if (maybe)...
Would we have a `[Enum]null T` too? What would you expect to get in a for? Would we expose the tag? the index? both? ``` const Axis = enum {...
@Hejsil both examples would work, even without the memberIndex function. You'd have to specify the tag type though. The following examples include memberIndex and memberTag builtins only for illustrative purposes....
While we're at it, we should consider switch statements too. See also: #359 ``` const E = enum(u8) { First = 1, Second = 2, Third = 3, Last =...
@Hejsil Since the index of the member can be different to the value in the enum, I'd expect that to compile to: ``` const E = enum(u8) { A =...
I had only really considered compile-time use, but that's a really good point. Yeah, in this situation it's not really a zero-cost abstraction, but if you were using this kind...
In terms of ordering, that's not really an issue - I'm not sure that indexing [A]u8 is any different to indexing [B]u8. I'm still not sure we're on the same...
I'm actually quite fond of this idea. Would there be any issues if we took it further and allowed functions to be declared inside? ``` // Pass a block like...
Another use case: `const Vec2 = [2]f32;`