logoalt Hacker News

heavensteeth • today at 10:17 AM • 2 replies • view on HN

This seems very interesting. It almost looks/feels like Pythonic Go.

There's already another syntax example in the thread, but I want to point out the weirdest syntax I've seen yet: positional arguments look like posix command arguments:

   greet name/string="World" --greeting/string="Hello" -> string:
     return "$greeting $name"

   main:
     print (greet)                         // Prints Hello World.
     print (greet "Ada" --greeting="Hi")    // Prints Hi Ada.

Replies

kasperl • today at 10:31 AM

Arguments like --greeting are the named arguments:

https://docs.toit.io/language/beginner/lists-and-functions/#...

The name argument is positional here.

➕ show 1 reply
skybrian • today at 2:45 PM

It’s probably fine once you’re used to it, but I’m not sure that embedded development is the place to innovate on function call syntax.

Then again, nowadays, it’s not like you have to write code yourself.