Struct Julia中的不可变vs结构和类型vs可变结构
让我们定义4类不同的点:Struct Julia中的不可变vs结构和类型vs可变结构,struct,types,julia,Struct,Types,Julia,让我们定义4类不同的点: type PointType x y end mutable struct PointMut x y end immutable PointImmut x y end struct PointStruct x y end PointType和PointMut之间有什么区别?为什么有人会选择一个而不是另一个 还有PointImmut和PointStruct之间的区别是什么 我倾向于认为它们只是同义词,
type PointType
x
y
end
mutable struct PointMut
x
y
end
immutable PointImmut
x
y
end
struct PointStruct
x
y
end
PointType
和PointMut
之间有什么区别?为什么有人会选择一个而不是另一个
还有PointImmut
和PointStruct
之间的区别是什么
我倾向于认为它们只是同义词,但我并没有发现有明确的表述,所以我想知道是否有一个微妙的差异隐藏在某个地方
type
和immutable
在julia 0.6之前有效,mutable struct
和struct
是julia 0.6和forward中相同对象的名称<在mutable struct
中,code>mutable意味着字段可以更改-这实际上很少使用,因此默认设置为不可变<代码>可变结构比结构慢。这是因为它被弃用了。类型
和不可变
曾经存在,这一事实很快就会成为历史教科书的一部分。