3 ms·
Julia is interesting in this regard (and Go I think - I used it's ancestor: Limbo). You can start with function foo(bar) pass end function and
by SixSigma 10y ago
Julia is interesting in this regard (and Go I think - I used it's ancestor: Limbo). You can start with
function foo(bar)
pass
end function
and then add types later when you've found out what was inferred
function foo(bar::Int64)
pass
end function
I enjoy this style, it means I can create the story as I go along without re-writing types every time
- sdegutis 10y agoWait, does Julia really use the syntax `end function` to end a function? I haven't seen that kind of redundancy since I first learned how to program inside QBasic 3 for MS-DOS!
- catnaroek 10y agoThe benefit of inference is that you get the best of both worlds: you don't manually type-annotate anything, yet types are still statically checked. Does Julia do this?
- zeveb 10y agoCommon Lisp does this too: (defun foo (bar)) vice (defun foo (bar) (declare (fixnum bar) (ignorable bar))) And of course then the compiler can gripe if you try to call (foo "123").