> A compiler is not a cuddly teddy bear
Why, shouldn't it? I always found gcc so cold and all. Friendly compilers surely aren't so bad. I could do a -hardass flag if you wanted.
> Previous function example speicifes a return type, why doesn't this one?
Wohow, my bad. Fixed in the doc.
> The strange little dots
Actually they are strange, because they're unexpected. It's a bit of the syntax that would probably most appeal to perl hackers, and is totally optional.
EDIT: Realized the return type was missing in add: func definition. :/ sorry.
No, they aren't bad. Cryptic error messages are just annoying.
Would "inferred" be a better word than "guessed" in that context? It sounds more deterministic, conveys more of a meaning of "worked it out for itself from the context" rather than "rolled the dice and took a stab at what you might mean".
> Because the function doesn't return anything (e.g. is void), I guess.
Have another look at it. Does "add" look to you in this context at all like a function that returns void?
printf("1 + 2 = %d\n", add(1, 2))
You were right :/ It's all fixed now, thanks a lot for reporting.
(At first I thought that you thought that return type specification was non-optional, e.g. that it lacked "-> Void")
About the other issues: are you really bothered by them? (e.g. the familiarity of the writing, etc.) I thought it'd be less boring, but I didn't mean it to annoying.
EDIT: fixed the "strange little dots" and "compiler is your friend" parts.
E.g. "Foreaches. Foreaches is like.. a regular For that gave up alcohol, decided to shave daily, and bought a new suit. It's prettier, and more effective. "
I've been programming in C# for years, I know foreach. It's a workhorse feature that I use daily. There are similar constructs in Ruby and PHP and others.
"But remember, the compiler is your friend. He guessed that's what you wanted to return."
Yuk, a compiler is not a cuddly teddy bear, and I really don't want a compiler to "guess", I want it to be very predictable in its behaviour.
add: func(a, b : Int)
Previous function example specifies a return type, why doesn't this one?
The strange little dots
Oh please.
No explanation of why some things seem to be prefix, e.g. "Hi, softer world =)" println() and some are infix, e.g. add(1, 2)