I want to clarify that I'm sympathetic to the idea. I've had this discussion where I was for it and Jeff was telling me all the reasons why not. So if there's a simple way to do it, we will. We don't need to reserve the syntax because it's currently an error:
julia> foo(in x, out y) ERROR: syntax: missing comma or ) in argument list On Thu, Jun 12, 2014 at 5:41 PM, Stefan Karpinski <[email protected]> wrote: > Very true, Tobias. I can't justify the complication to the language it > would entail. There's no obvious simple way to do this – in/out-ness is a > property partly of a binding and partly of a value. It's just kind of > messy. Sure, it prevents some errors, but so does static type checking and > we're giving that up for the sake of simplicity and productivity. > > > On Thu, Jun 12, 2014 at 5:33 PM, Tobias Knopp <[email protected] > > wrote: > >> 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! >>>> >>> >
