We are planning on implementing return type annotations, however.

On Thu, Jun 12, 2014 at 1:45 PM, Jameson Nash <[email protected]> wrote:

> In both c and fortran, the programmer is free to ignore the const modifier
> and mutate its inputs -- although the compiler will try to emit a warning.
> Instead, Julia opts to suggest that programmers avoid modifying arguments,
> and use a bang (!) to notate a function that will modify an input.
>
> Return type annotation simply has not been implemented. Typically, Julia
> encourages leaving off type annotations since the compiler can infer them,
> so it simply hasn't been a priority.
>
> On Thursday, June 12, 2014, <[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!
>>
>

Reply via email to