Fortran and C++ also don't support higher order programming. Let's say you have
f(g,v) = g(v) What happens if you do f(sort!,v) where v is some vector? We also currently don't do any of this kind of compile-time checking, unlike Fortran and C++. In the future we could, but the current mode of development is all about making more things possible rather than making more things impossible. On Thu, Jun 12, 2014 at 4:26 PM, <[email protected]> wrote: > Thanks for taking the time to reply to me, and I'm glad to get a quick > response that return-type annotations are coming. That makes a lot of > sense. > > However, I'd like to also continue to argue in favor of const annotations > for input arguments. Julia aims to become the language of choice for > large-scale scientific computing, and so it would be wise to learn the > lessons of the Fortran-90 community and C++-community that such annotations > are valuable. > > The exclamation-point convention is fine for simple functions like 'sort', > but functions in large-scale scientific programs typically have a long list > of arguments (look at LAPACK for example), and in this case the exclamation > point is obviously limited since it conveys no information about which > arguments are modified. > > I realize that part of the beauty of Julia is that the more advanced type > system will presumably cut down on the number of arguments for many > scientific functions, but I would still argue that the exclamation point is > an inadequate substitute for const argument annotation. > > -- Steve Vavasis > > > > On Thursday, June 12, 2014 8:28:18 PM UTC+3, [email protected] wrote: >> >> Both C++ and Fortran 90 allow the programmer to annotate >> call-by-reference arguments to a function as to whether the function is >> allowed to change them (this is denoted const & in C++). The compiler >> then enforces the const-ness of the argument. I don't see how to do this >> in Julia. Is it available? If not, is there a reason why it was not >> included? This is a fairly basic tool for self-documenting code and for >> ensuring program correctness. >> >> And a related question: the documentation makes a big deal about "stable >> types" for function return arguments. An obvious question is why the >> language doesn't allow the programmer to declare in the function heading >> what will be the return types of the function, and then have the compiler >> enforce this stability. Is this possible in Julia? If not, is there a >> technical reason for omitting it? >> >> Thanks, >> Steve Vavasis >> >> P.S. I have a few more questions but I'll pause now to wait for answers >> to these questions. I hope they are easy to answer! >> >
