buzz-language / buzz

👨‍🚀 buzz, A small/lightweight statically typed scripting language
https://buzz-lang.dev
MIT License
1.22k stars 34 forks source link

Unavoidable syntax warning from main signature? #184

Closed Costava closed 1 year ago

Costava commented 1 year ago

I ran the SDL example given in the repo:

$ ./zig-out/bin/buzz examples/sdl.buzz 

examples/sdl.buzz:5:16: [W89] Syntax warning: Unused local of type `[str]`
     3 ╭─ 
     4 │  | buzz -L/path/to/SDL2.dylib/so/dll examples/sdl.buzz
     5 │  fun main([str] args) > int !> SDLError {
       ┆                 ╭───
       ┆                 ╰─ Unused local of type `[str]`
     6 │      SDL sdl = SDL.init([Subsystem.Video]);
     7 ╰─ 

And got a warning that the args argument to main is unused. Removing the parameter causes a fatal syntax error, which matches what the Guide says is permitted as the signature of main.

Is there a canonical way to avoid the 'unused' syntax warning?

(Tested with buzz at commit eb4e8ad220efbc7fa778e3bbf3e85d4fd942ed52)

giann commented 1 year ago

Yes you can name the argument _:

fun main([str] _) > void {
}

This is not yet documented