> Copying things by default isn’t a very good strategy for a language used to 
> do linear algebra on large arrays.

I didn't say I want do copy arrays by default. I don't want to change behavior 
of existing types or functions. All I wanted express that Julia lacks of clear 
semantics expressing what is value and what is a reference to value, implying 
what is copied and what is hold by GC and passed via reference to function.

I don't like imposing reference when declaring a (mutable) "type". But I don't 
want to change behavior of existing classes, so you want Array{T} to be still a 
reference, however it should be explicitly stated it is a reference, i.e. using 
a test is Array is some concrete type of Ref{T}.

But I can imagine I want to have some PlainArray{Float64,4} which is value type 
and matches exactly machine vector. In such case I don't want such type to be 
reference, but now I don't have a choice Array is a reference, period.

So when I want to have separation between value and reference I do:

        type Point
          x; y
        end
        typealias PointRef Ref{Point}

If I want to declare type that's already a reference to some anonymous 
(private) value type I do:

        @ref type Point
          x; y
        end

This make Point to be type alias for Ref{anonymous_Point_val_type}.

Finally const (immutable) should be completely detached from being or not being 
a reference, e.g.:

        @const @ref type SomeType
          ..
        end

But still I should be able to explicitly choose which fields are mutable and 
which are not.

        type OtherType
          const a::Int
          b::Int
        end

I know Julia's target is scientific computation, however it (she?) has great 
potential of being general purpose language, much better than Go, Rust or Swift.

--Adam

Reply via email to