8 ms·
Jai is an amazing language to work with, I highly recommend checking it out once it becomes publicly released. It's elegant, simple, performant, takes all the b
by konsuko 3y ago
Jai is an amazing language to work with, I highly recommend checking it out once it becomes publicly released. It's elegant, simple, performant, takes all the best parts of Zig minus the annoying parts (like errors on unused local variables) and adds a bunch of super useful game development libraries as well as a built-in string type (which I really missed in Zig).
Oh, and the compile times are just a joy, almost no other language even comes close to the speed of iteration that's possible with Jai, which is another great reason to use it for games and prototyping in general.
- flohofwoe 3y agoIf Jai can only be judged once it's public, Zig should only be judged once it hits 1.0 though. Personally I put a lot more trust into Zig than Jai.
- deleted 3y ago[deleted]
- ReleaseCandidat 3y agoI'd have preferred a `fun` (or `fn, if you insist on 2 characters) instead of the Haskell-esque double colon `::` in function definitions to make parsing them easier. And the semicolon after `case` is irritating for me too. But `foo := bar` for a type-less `foo: TYPE = bar` is too much parser-friendly syntax and inconsistent with using a double colon `::` for function types and struct definitions. And inconsistent with using just the colon in `foo: TYPE`. How do nested for-loops work, if `it` names the current iterator? for particles { // Inside for loops the "it" object is the iterator for the current object. particle_left := view_left \* it.particle_size; }
- ohgodplsno 3y agoJust like every language that implicitly names the current value of the iterator: - It's the innermost iterator that takes priority - You are encouraged to name your iterators if you do so (for particles { part -> part.velocity } ) - Compiler throws warnings if you shadowed names.
- ReleaseCandidat 3y ago> Just like every language that implicitly names the current value of the iterator Oh, i didn't know that there are any. It would be a good idea to add the naming explicitly to the Wiki entry of loops: https://jai.community/t/loops/147 https://jai.community/t/loops/147, I've just found it buried in the `remove` section. Btw. in for-loops the colon `:` is used inconsistently again, this time for naming the iterator (`foo` in this example:) `for foo: VALUES { ... }`.
- ohgodplsno 3y ago>Oh, i didn't know that there are any. Plenty! Although, it's not limited to iterators: most languages that have first class lambdas/closures behave this way. Kotlin has `it` as the default parameter of any lambda (but only accepts it for single parameter lambdas, two parameters and you need to name them: `fun <T, U> Collection<T>.map(block: (T) -> U): Collection<U>` is called like so: `listOf(1, 2, 3).map { it * it }` Swift has $0, $1 >Btw. in for-loops the colon `:` is used inconsistently again, this time for naming the iterator (`foo` in this example:) `for foo: VALUES { ... }`. Sorry, Jonathan Blow doesn't believe in such silly things as "compiler research" nor "programming language research". Jai gets built by piling up crap on top of crap.
- ReleaseCandidat 3y agoThanks, and yes, I didn't think about closures. Talking about closures, I also don't know why Jai needs explicit capture lists. In C++ and Rust I understand the need for them, because you have various ways to pass them into the lambda, but Jai doesn't seem to care, at least in the examples at https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md#code-refactoring https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md.... To be honest, I also don't see how this is different from just writing the function definition by hand, just in more than one step and you have to throw away the intermediate versions? Btw. I just replied to say that I really like your username, I have noticed it just now :)
- iml7 3y ago+1,fun, fn, have obvious visual effects
- ngrilly 3y agoWhat is annoying with errors in Zig?
- metaltyphoon 3y agoI don't think they can carry information.
- alwaysbeconsing 3y agoThey seem to be specifically referring to the compiler error (as in, prevents compilation) for unused local variables. See discussion here: https://github.com/ziglang/zig/issues/335#issuecomment-1001115727 https://github.com/ziglang/zig/issues/335#issuecomment-10011...
- Modified3019 3y agoYeesh, that's good to know. With the dev response basically doubling down on ideology and ignoring reasonable protest, that's definitely an ecosystem to not sink time into.
- Gibbon1 3y agoMy thought about unused variable is the compiler should assume someones trying to debug something and not optimize them out.
- ngrilly 3y agoYou're right. I read too fast. Coming from Go, I'm used to errors on unused local variables, and like that Zig does the same.