Hacker News new | past | comments | ask | show | jobs | submit login

I didn't claim that static typing depends on putting things inside of an explicit main function. Only that the function "boilerplate" serves to hint to the user that the things in the function body happen at runtime to distinguish from the other things which tend to happen at compile time. Static types are an example of things that happen statically (for example, declaring types). Or course this is just a hint--it's not necessary and as previously mentioned, there are many languages that don't make this syntactic distinction.



> the function "boilerplate" serves to hint to the user that the things in the function body happen at runtime to distinguish from the other things which tend to happen at compile time

'hinting' seems vague. Programmers who know what they're doing know that calling functions happens at run time. Obviously you can call a function without needing a wrapper function or a wrapper class + method.


To be clear, we’re debating the merits of a special syntax that allows the syntactic intermingling of executable code and static declarations. While experienced programmers can probably sift through this and identify which things are static and which are dynamic, not all programmers are experienced (note that the original claim was that the intermingled syntax is better for beginners) and further even experienced programmers may appreciate the explicit syntactic distinction between static and dynamic. Lastly, it also makes it easier to write static analysis tooling (linters, type checkers, compilers, etc) since the intermingled syntax is more complex to implement.

It’s fine if you don’t agree with the value judgments—for example, if you would rather save a handful of characters in “hello world” at the expense of some clarity or technical simplicity. I’m just giving the rationale.


> not all programmers are experienced

You are arguing against `print('hello world')` working.


Right, I’m not worried about optimizing the language for “hello world” at the expense of real code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: