功能名称后的感叹号是什么意思? [英] What does exclamation mark means after the name of functions?

查看:190
本文介绍了功能名称后的感叹号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了这样的功能

function operator!(c::Matrix, out::Matrix)
    ......
end

!在这里是什么意思?

推荐答案

在Julia中,通过共享传递,没有这个约定,就不容易知道函数是否会更改输入参数的内容.

In Julia, it's a convention to append ! to names of functions that modify their arguments. The reason is Julia function arguments are passed-by-sharing, without this convention, it's not easy to know whether a function will change the content of input arguments or not.

这篇关于功能名称后的感叹号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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