Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.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
F#注释错误_F# - Fatal编程技术网

F#注释错误

F#注释错误,f#,F#,我在自学F#我通常是一名C#程序员 我试图使用(**)在我阅读章节时为自己做笔记,但我从注释本身中得到了一个错误 module Characters let vowels = ['a', 'e', 'i', 'o', 'u'] printfn "Hex u0061 = '%c'" '\u0061' (* <------------Error is here, is 'End of file in string embedded in comment begun at or befo

我在自学F#我通常是一名C#程序员

我试图使用
(**)
在我阅读章节时为自己做笔记,但我从注释本身中得到了一个错误

module Characters

let vowels = ['a', 'e', 'i', 'o', 'u']

printfn "Hex u0061 = '%c'" '\u0061'

(*  <------------Error is here, is 'End of file in string embedded in comment begun at or before here'
    Character Escape Sequences

    Character       Meaning
    -------------------------------
    \'              Single Quote
    \"              Double Quote
    \\              Backslash
    \b              Backspace
    \n              Newline
    \r              Carriage Return
    \t              Horisontal Tab
*)
模块字符
让元音=['a','e','i','o','u']
printfn“十六进制u0061='%c'\u0061'
(*似乎“双引号”行是问题所在。如果删除该行,错误就会消失。这看起来像是解析器中的错误,因为如果我在每行前面加上
/
而不是执行块注释,则不会出现问题。我建议您将此发送到fsbugs@microsoft.com-如果Visual Studio 2013尚未修复,可能还不算太晚

完全不相关:您的
元音
列表包含一个5部分元组的元素。如果您希望它是一个字符列表,而不是一个包含一个5部分元组的列表,请使用分号而不是逗号。

F#琐事时间!这是经过设计的。。在本例中,有效的字符文字将计为“字符串”

因此,这些是有效的块注释:

(* "embedded string, this --> *) doesn't close the comment" *)
(*  (* nested *) comment *)
(* quote considered to be in char literal '"' is ok *)
但事实并非如此

(* "this string is not closed *)
(* " this quote --> \" is escaped inside a string *)
似乎这还不够疯狂,因为
(*)
等通常会被视为块注释的开始或结束

(* I can talk about the operator (*) without ending my comment *)
好的,这些都是从ML继承的(嵌套注释肯定是,不确定字符串)

因此,出于您的目的,您可能希望执行以下操作:

(*  Character       Meaning
    -------------------------------
    " \' "          Single Quote
    " \" "          Double Quote

    or

    '\''            Single Quote
    '"'             Double Quote
*)

但是
(*“”*)
没有。它似乎希望在块注释中使用平衡的双引号。也感谢您对元音的注释,但这只是一本书中的一个示例。现在就按照流程进行。