Re:Ark – A modern systems programming language
by protomyth on Thursday June 25, 2015 @02:33PM
(#9779988)
Here the example on the site:
I'm really curious about 2 things: that for seems to really be a while. Why := in the declare and = in the assignment?
[ Parent
| on HN ]
Re:Ark – A modern systems programming language
by notduncansmith on Thursday June 25, 2015 @02:39PM
(#9780029)
Perhaps the author was inspired by the Go language, as those are both Go-isms: Go's only loop is a for loop, and := tells the compiler to infer the variable type when initializing.
In fact, this snippet is only a few deviations away from being valid Go code.
Re:Ark – A modern systems programming language
by AYBABTME on Thursday June 25, 2015 @03:18PM
(#9780289)
Their compiler is written in Go.
Re:Ark – A modern systems programming language
by warmwaffles on Thursday June 25, 2015 @05:16PM
(#9780970)
You also need to remember that at one point Go's compiler was written in C, as with rust. It's all apart of the language evolution.
Re:Ark – A modern systems programming language
by AYBABTME on Thursday June 25, 2015 @07:28PM
(#9781571)
I'm not blaming them, just saying there's evidence the authors are quite familiar with Go. =P
Re:Ark – A modern systems programming language
by michaelmior on Thursday June 25, 2015 @04:43PM
(#9780791)
:= isn't really stating to infer the type (although this happens) but a way to differentiate variable initialization with assignment. When using := the variable is created while = is just a regular assignment. Having these as separate operators prevents errors like this:
foo := 3
fooo = 4
The second line is invalid because fooo does not exist.
Re:Ark – A modern systems programming language
by fapjacks on Thursday June 25, 2015 @03:32PM
(#9780378)
Indeed it is written in Go, after all.
Re:Ark – A modern systems programming language
by felixangell on Thursday June 25, 2015 @05:15PM
(#9780967)
Hi, for is basically a while loop yes. We haven't implemented ranges yet, so this is the example we chose since it works, and it's fairly concise to fit on the website.
I chose `:=` and `=` mostly because of personal preference.