Der*_*unk 4 programming-languages parameter-passing pass-by-reference
我在想.是否存在仅使用传递引用作为其评估策略的语言?
我不知道"eval策略"是什么,但Perl子程序调用只是传递引用.
sub change {
$_[0] = 10;
}
$x = 5;
change($x);
print $x; # prints "10"
change(0); # raises "Modification of a read-only value attempted" error
Run Code Online (Sandbox Code Playgroud)