Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ocaml {<;}是什么意思?_Ocaml - Fatal编程技术网

Ocaml {<;}是什么意思?

Ocaml {<;}是什么意思?,ocaml,Ocaml,ocaml对象教程包含这段代码,但没有对其进行解释 # class c0 = object method m = {< >} method n = 0 end;; class c0 : object ('a) method m : 'a method n : int end #类c0=对象方法m={}方法n=0结束;; 类c0:object('a)方法m:'a方法n:int结束 {}是什么意思?它记录在哪里?中对这个结构有一个非正式的定义。它说: 重写构造{}返回“self”(即

ocaml对象教程包含这段代码,但没有对其进行解释

# class c0 = object method m = {< >} method n = 0 end;;
class c0 : object ('a) method m : 'a method n : int end
#类c0=对象方法m={<>}方法n=0结束;;
类c0:object('a)方法m:'a方法n:int结束

{<>}是什么意思?它记录在哪里?

中对这个结构有一个非正式的定义。它说:

重写构造{<…>}返回“self”(即当前对象)的副本,可能会更改某些实例变量的值

中给出了更正式的定义

表达式
{<>}
不包含对实例变量的更改,因此它只返回当前对象“self”的副本。

在答案的最后一段有您的答案。在这个网站上有你对每个功能的答案。。