Stephen,

Thanks!  The "let" translation below makes it clear.

Is there an explanation of the semantics of Julia at that level of detail 
somewhere?  I wasn't able to find anything like this in the manual.

I like Julia a lot, but one of my concerns is a lack of precision in the 
documentation and apparent lack of a written language definition.  Or maybe 
I just haven't found the right sections/documents.


On Friday, May 6, 2016 at 6:40:41 PM UTC-7, Steven G. Johnson wrote:
>
>
>
> On Friday, May 6, 2016 at 2:18:42 PM UTC-4, David Dill wrote: 
>>
>> It's a bit surprising that, if d1 is mentioned for the first time in d1 = 
>> d2 = Dict() in f7 below, the inferred type of d1 is different from the 
>> inferred type of d2, especially since the inferred type is different in d8.
>>
>  
> The type of d2 isn't inferred -- you explicitly declared it as 
> Dict{Int,Int} in the line above.
>
> As for d1, the key thing to remember is that the value of an assignment 
> operation is equal to the *right-hand* side.   That is, in a=b=c, c is 
> assigned to both a and b.  More explicitly, in your example, d1 = d2 = 
> Dict() is equivalent to
>
>      let temp = Dict() # gives a Dict{Any,Any}
>          d2 = temp   # requires a conversion (hence a copy) since d2 was 
> declared as Dict{Int,Int}
>          d1 = temp   # since d1's type was not declared, it is inferred to 
> be that of temp, hence no copy is needed
>      end
>

Reply via email to