4 ms·
In dynamic languages tests also tend to fill the role of the compiler is I think the parent's point. Dynamic/interpreted language code might have syntax errors
by YZF 2y ago
In dynamic languages tests also tend to fill the role of the compiler is I think the parent's point. Dynamic/interpreted language code might have syntax errors or be otherwise incorrect (including type errors) and you often don't find those until they code is run.
- dgb23 2y agoThat’s a fair point. However dynamic languages tend to have very good linting that catch many basic type errors. They can also run way more often during development, down to the function/expression level.
- igouy 2y agoWhen this buggy method is compiled (not run) with Smalltalk, errors and warnings are shown. The code cannot be run because it failed to compile. hnQuestion | list max | list := #(1 8 4 5 3). ! Syntax Error: Nothing more expected 1 to: list size do: [:i | max < (list at: i) ? Uses ifTrue:/ifFalse: instead of min: or max: ifTrue: [max := (list at: i)]. ifFalse: [max := max]. ].
- Izkata 2y agoFor future reference, indent with 2 spaces to get code formatting. https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc
- igouy 2y agoFor future reference, does "code formatting" provide a way to distinguish list := #(1 8 4 5 3). from ! Syntax Error: Nothing more expected as-well-as from comment text ?