名称的方法只有副作用 [英] Name for a method that has only side effects

查看:125
本文介绍了名称的方法只有副作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,改变其对象的方法是 mutator 。一个不改变其对象但返回值(或引用到值)的方法是一个 getter 。有没有广泛使用的名称,一个方法不会改变它的对象,不返回一个值,但可能会改变作为参数传递给它的对象。也就是说,一种方法只会在对参数的各种影响中被调用。



如果您热衷于策略设计模式

解决方案


对于不改变其对象的方法,广泛使用的名称,不返回值,但是可能会将传递给它作为参数。


缺少回复表明,不,没有广泛使用的名称这样一种方法。


So, a method that alters its object is a mutator. A method that does not alter its object but returns a value (or reference to a value) is a getter. Is there a widely used name for a method that does not alter its object, does not return a value, but potentially alters objects passed to it as arguments. That is, a method that would only every be called for its side-effects on the arguments.

These methods are quite common if you are keen on the Strategy design pattern.

解决方案

Is there an widely used name for a method that does not alter its object, does not return a value, but potentially alters objects passed to it as arguments.

The lack of replies suggests that, no, there is no widely used name for such a method.

这篇关于名称的方法只有副作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆