Julia is a quite simple language and I really appreciate that it does not have every feature out there in other languages. Const parameters from C++ are certainly an interesting thing but in my experience they also slow down my (personal) development time as I have to reason about yet another thing. One also has to be very concentrated when reading const aware C++ code as the human brain can only recognize a certain amount of chunks at a time.
Am Donnerstag, 12. Juni 2014 22:58:47 UTC+2 schrieb [email protected]: > > 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! >> >
