tonysparks / litac-lang

LitaC compiler in LitaC
7 stars 5 forks source link

Errors in code found in README.md example #45

Open Its-Kenta opened 11 months ago

Its-Kenta commented 11 months ago

Few issues I've found with the README.md example:

  1. main.lita:58:28 error: 'f64' can't be assigned to 'f32':
    var vel: Vec2 = Vec2{1.5, 2.5}
                              ^
    *** 'f64' can't be assigned to 'f32'

    By passing it as 1 and 2 or adding f at the end resolves this issue. However, it presents another:

  2. main.lita:38:5 error: symbol 'f' already defined in /Users/kenta/Programming/litac-t/src/main.lita:38 var f : f32 = 0.5_f32 // 32-bit float ^ *** symbol 'f' already defined in /Users/kenta/Programming/litac-t/src/main.lita:38: Commenting out f variable on line 38 and associated code with it fixes the issue.

It would probably be a good idea to fix the issue and present potential users with a working example? I've also found out that usage of semi-colons is optional in LitaC, but in code examples it's a mix bag of using it or not. Is there a code standard with LitaC that has a stance on it?

tonysparks commented 10 months ago

Should be fixed now.

I'm still uncertain if I like the optional semi-colons. It creates some problems (such as empty return statements or pointer dereferencing and also poses questions such as yours for coding standards).

As of right now, the "standard" I use is to omit them unless it breaks up an ambiguous parsing scenario.

Its-Kenta commented 10 months ago

If the standard is to omit, would it be better to make it standardised along all examples? Perhaps it's just me nitpicking, but it feels like users might get conflicted feelings about it.

Anyway thank you for looking into this!