There's no doubt that the restriction to only capturing immutable state from the lexical context is quite irritating to programmers.
毫无疑问,仅从词法上下文捕获不变的状态这一限制,令程序员非常不满意。
This pattern requires that the value being published be effectively immutable — that its state not change after publication.
这个模式要求被发布的值是有效不可变的——即值的状态在发布后不会更改。
If you have an immutable object, you must set whatever state it will contain in the constructor.
如果您有一个不可变对象,则必须要在构造函数中设置该对象将包含的任何状态。
An immutable object's state cannot change after construction. In other words, the constructor is the only way you can mutate the object's state.
一个不可变对象的状态在其构造完成之后就不可改变,换句话说,构造函数是唯一一个您可以改变对象的状态的地方。
In FP, functions have no side effects and variables are immutable, while in OOP, mutable state and side effects are common, even encouraged.
在fp里,函数没有副作用,变量都是不易变的。而在OOP中,可变状态和副作用都十分常见,甚至是被鼓励的。
URI versioning […] is a design choice when resources are immutable across time and we create new resources for state changes (similar to how we manage time-series data in a database).
URI版本控制 […]是一种设计决定,用于当资源不随时间的变迁而变化时,我们为状态的改变创建新资源(类似于管理数据库中的时间序列数据)。
A state object is immutable, that is, once it is created it cannot be changed without being destroyed and recreated.
状态对象是不变的,这就是说,一旦它被创建就不能被消出或者重建。
If the internal state cannot change, there is no chance for different threads to see inconsistent views of the data. Immutable types can be exported from your objects safely.
如果内部状态不能被改变,那么对于不同的线程来说,就没有机会看到这个数据的不同值。
To create an immutable type, you need to ensure that there are no holes that would allow clients to change your internal state.
为了创建一个不可变的类型,你需要保障没有任何漏洞允许客户修改你的内部状态。
To create an immutable type, you need to ensure that there are no holes that would allow clients to change your internal state.
为了创建一个不可变的类型,你需要保障没有任何漏洞允许客户修改你的内部状态。
应用推荐