简体   繁体   English

Ada中的= =和=之间有什么区别?

[英]What's the difference between := and => in Ada?

As far as I know, := seems to do an assignation by copy. 据我所知, :=似乎是通过副本进行分配。 The operator => seems to do a similar assignation, but is used when assigning a parameter to a member variable of an object. operator =>似乎执行类似的赋值,但在将参数赋给对象的成员变量时使用。

so... 所以...

receivesTheCopy := isBeingCopied

memberVariable => passedParameter

I'm working on someone else's old code and I have a variable reaching a value that I never see explicitly assigned to it with := . 我正在处理其他人的旧代码,并且我有一个变量达到一个我从未看到明确分配给它的值:= I was thinking that maybe when it is assigned to a memberVariable with => it was passed by reference, and thus the passedParameter variable stayed tied to the memberVariable state. 我在想, 也许当它被分配给一个带有=>memberVariable ,它通过引用传递,因此传递的passedParameter变量保持与memberVariable状态的memberVariable

:= is an assignment. :=是一项任务。

=> has multiple purposes: =>有多个目的:

  1. Parameter passing: Which formal parameter is passed which argument (if it isn't done by order). 参数传递:哪个形式参数传递哪个参数(如果不按顺序完成)。
  2. Record and array aggregates: Which field gets which value. 记录和数组聚合:哪个字段获取哪个值。
  3. Aspects: Separating aspect names from the expressions they are assigned. 方面:将方面名称与它们分配的表达式分开。

In neither case it has anything to do with pass-by-reference or pass-by-value. 在任何一种情况下,它都与传递引用或传值有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 &table[0][0] 和 &table 有什么区别? - What's the difference between &table[0][0] and &table? “var”和“out”参数有什么区别? - What's the difference between "var" and "out" parameters? 按引用传递与按值传递有什么区别? - What's the difference between passing by reference vs. passing by value? 这两种方法有什么区别 - What is the difference between these two methods 在Java中通过引用传递和在C中传递指针有什么区别? - What is the difference between passing by reference in Java and passing a pointer in C? 在PHP中分配变量值时,“&=”和“=&”之间有什么区别? - What is the difference between “&=” and “=&” when assigning a variable value in PHP? C ++中临时变量和常量有什么区别? - What is the difference between temporary variable and constant in C++? 在C和C ++中,“通过引用传递”到底有什么区别? - What exactly is the difference between “pass by reference” in C and in C++? 在C#中通过输出和参考传递参数之间的区别是什么 - What Is The Difference Between Passing Parameters By Output And By Reference In C# 通过争论之间的区别 - Difference between passing an arguement
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM