函数名称后的感叹号是什么意思? [英] What does an exclamation mark mean after the name of a function?

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

问题描述

我看到了这样的功能

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 "bang" convention, it's not easy to know whether a function will change the content of input arguments or not.

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

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