在编程方面,语义是什么意思? [英] In terms of programming, what do semantics mean?
问题描述
这是 Eric Lippert的博客:
鉴于不幸的情况,它
有意义存储
机制,然后是
语义秒。
容易获得语义意味着什么的字典定义,但它在计算机术语方面意味着什么
It's easy to get a dictionary definition of what "semantic" means but what does it mean in terms of computer jargon?
推荐答案
但是在计算机术语方面是什么意思? $ b
but what does it mean in terms of computer jargon?
本质上是一样的。示例:
Essentially the same thing. Example:
x = 5;
上面是语法该术语的意义(即语义)是将值5分配给名为 x
的符号(变量,无论什么)。不同的语言提供不同的语法来提供相同的语义。例如,上面的任务将写为
The above is the syntax (representation). The meaning (i.e. the semantics) of this term is to assign the value 5 to a symbol (variable, whatever) called x
. Different languages offer different syntaxes to provide the same semantics. For example, the above assignment would be written as
x := 5;
,以及
x <- 5
在所有情况下,意义本质上是相同的。但有时,相同的语法也可以具有不同的含义,取决于语言和/或上下文。 VB例如重新定义equals运算符意味着两个不同的东西。
in several other languages. In all cases, the meaning is essentially the same. But sometimes, the same syntaxes can also have different meanings, depending on the language and/or context. VB for example redefines the equals operator to mean two different things. First, an assignment, just as above.
其次,在下面的代码段中,不是赋值,而是赋值比较值:
Secondly, in the following code sippet, rather than assigning, it takes the meaning of comparing two values:
If x = 5 Then Console.WriteLine("x is 5")
这篇关于在编程方面,语义是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!