Jai-Community/Jai-Community-Library

Mistakes in Wiki content

wolfschaf opened this issue · 3 comments

Getting Started->Functions->Default Arguments
f() should be funct()

Getting Started->Structures
'Vector2 is one of Jai's many built in vector types.'
Isn't Vector2 is just part of the Math library?

Getting Started->Enumerations->Using on structs, unions, and enums
By doing using Enum; you don't need the '.' before enum members. The examples in Enum Flags is doing it correctly.
Maybe there should be an example that explains when you can use .EnumMemberValue

Advanced->Polymorphism->Polymorphic type declarations
x : $T/Foo
'Here, we know that x has the fields of Foo and we can treat it as such. This does not mean x is a Foo! ...'
Is this not the description of x : $T/ interface Foo?

Isn't x : Foo($T) exactly the same as x : $T/Foo? Like later described in $T/Object syntax.

Another example:

Foo :: struct(T : Type) {}
bar1 :: (x : Foo($T)) {}
bar2 :: (x : $T/Foo)  {}

a : Foo(int);

bar1(a); // type_of(x) == Foo(int)    T == int
bar2(a); // type_of(x) == Foo(int)    T == Foo(int)

Hello. I fixed the first 3 mistakes in the Wiki. Not exactly sure what's the best way to correct the 4th mistake. I'll think more about it when I have some time to think about a better way to word the sentence.

Sorry, I think I wasn't fully pointing out the mistake in the Using on structs, unions, and enums example.

Here the example used in the wiki:

'Putting a using on an enum imports the enum into the scope.'

Enum :: enum {
  A; B; C; D;
}

using Enum;                 // We import the Enum members into the scope.
e := .A;                    // The '.' is therefore not necessary. Unfortunately I don't have the compiler to check, but would this even compile?
if e == {
case .A; print("e=A\n");    // '.' is not necessary.
case .B; print("e=B\n");    // --||--
case .C; print("e=C\n");    // --||--
case .D; print("e=D\n");    // --||--
}

But I'm glad I could help out 👍

You're right about the using Enum issue. It doesn't compile with the . With using, the names are imported directly so it works without the dot. I've fixed that