网站首页  英汉词典

请输入您要查询的英文单词:

 

单词 Immutable object
释义

Immutable object

中文百科

不可变对象

在面向对象及函数编程语言中,不可变对象英语:Immutable object)是一种对象,在被创造之后,它的状态(成员变量、属性等的值)就不可以被改变。至于状态可以被改变的对象,则被称为可变对象(mutable object)。

不可变意味着只读不写,因此不可变对象天然地具备线程安全的特性,即是说如无其它特殊限制的话可以在任何线程上自由调用。此外,相较于可变对象,不可变对象在一些场合下也较合理,易于了解,而且提供较高的安全性。

小型的不可变对象可以被有效率的复制,但是较大的不可变对象,如果想要有效率的被复制,就需要更复杂的一致性数据结构(persistent data structure)算法。因为性能的缘故,有时候会以可变对象来加以取代不可变对象。

英语百科

Immutable object 不可变物件

In object-oriented and functional programming, an immutable object (unchangeable object) is an object whose state cannot be modified after it is created. This is in contrast to a mutable object (changeable object) , which can be modified after it is created. In some cases, an object is considered immutable even if some internally used attributes change but the object's state appears to be unchanging from an external point of view. For example, an object that uses memoization to cache the results of expensive computations could still be considered an immutable object.

随便看

 

英汉网英语在线翻译词典收录了3779314条英语词汇在线翻译词条,基本涵盖了全部常用英语词汇的中英文双语翻译及用法,是英语学习的有利工具。

 

Copyright © 2004-2024 encnc.com All Rights Reserved
更新时间:2025/6/17 6:27:19