3 ms·
I love Julia for its expressiveness but I am somewhat confused about its dynamic typing and its powerful type system. Are we to write mostly Python-like functio
by east2west 11y ago
I love Julia for its expressiveness but I am somewhat confused about its dynamic typing and its powerful type system. Are we to write mostly Python-like function and rely on multiple dispatch and JIT code generation for speed? Duck typing is one reason I stopped using Python for technical computing. I tried Julia out a few months ago and found that type inference has some holes that make type annotation brittle for function parameters. I finally gave up when I found out functions have no return type in Julia.
Hopefully Julia can work out all the language features and mature into a good technical language. It would also help if there is a guide about the canonical programming style. I prefer static typing but thought using type annotation I could come close to static typing while still retain the freedom of quick-and-dirty code. I believe for the current Julia I was wrong.
- johnmyleswhite 11y agoIf you'd like to know canonical programming style, you should read the code in Julia Base. Learning how to write good Julia is somewhat difficult because the language occupies an unfamiliar position between traditional static languages and traditional dynamic languages. Can you provide some concrete examples of the functionality you're looking for? What exactly does "quick-and-dirty" code look like to you?
- east2west 11y agoI don't use "quick-and-dirty" as a derogatory term, so mostly I mean no error checking for rare occurrences or not ensuring correct values are being passed through. An example would be in Python if I just write MatrixA * MatrixB without any checking. I should check that they are both matrices if that is what I want, and that is what I did for reusable code. For one-off data analysis or computation, no-checking is certainly quick.
- StefanKarpinski 11y agoThis StackOverflow answer may help clarify things: http://stackoverflow.com/a/28096079/659248 http://stackoverflow.com/a/28096079/659248. Making return types work well with multiple dispatch is not so simple; we feel that it's better to wait to add that feature and get it right than to rush things and have to fix it later. Some background, context and tentative plans for return type annotations: https://github.com/JuliaLang/julia/issues/1090 https://github.com/JuliaLang/julia/issues/1090.