开发者

Ocaml and eclipse with ocalIDE get a syntaxe error on #use command

开发者 https://www.devze.com 2023-02-26 23:58 出处:网络
I use ocalIDE as ocaml plugin in ecli开发者_Go百科pse but on every #use foo line I got a syntax error: unexpected token \"#\".

I use ocalIDE as ocaml plugin in ecli开发者_Go百科pse but on every #use foo line I got a

syntax error: unexpected token "#". 

If I run this exact file in the toplevel windows it's working well, but I can't use the plugin tool (type info and auto-complete mainly) as it cannot compile my file.

Have you got any Idea why it cannot compile? I've got myFile.byte in the project parameter and without the #use line it's compile (well once I remove all what cannot work as the 'use' file isn't included...)


#use and other #-directives are not part of the Ocaml language, they are instructions specifically for the toplevel. Since you can't use them in Ocaml source code, it's not surprising that tools designed to work on Ocaml source code won't cope with them.

To use a function (or type, etc.) from a module, just write Modulename.function (e.g. List.hd [1; 2]). If you want to use functions from a module without having to repeat the module name, use the open keyword (e.g. open Unix).

0

精彩评论

暂无评论...
验证码 换一张
取 消