The point about higher-order functions hasn't been addressed – by anyone to my knowledge: mainstream languages that support higher-order programming either don't support these kinds of restrictions or are purely functional. If that's not the case, I'd love to see how languages that have higher-order programming and support in/out annotations handle it.
On Thu, Jun 12, 2014 at 4:58 PM, <[email protected]> wrote: > With respect to S. Karpinski's comment, I can understand completely that > this kind of inarg/outarg housekeeping stuff that I propose is not a high > priority for the developers of Julia at this early point of Julia's > development. So in that case, let me suggest that the language allow these > declarations right now purely as source-code documentation (i.e., they have > no effect on the compilation/execution), but the Julia documentation can > warn users that in future releases they may be enforced by the compiler. > > > -- 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! >> >
