* [Caml-list] undefined global Re_posix - ?
@ 2015-07-20 20:00 Mr. Herr
2015-07-20 20:09 ` Ivan Gotovchits
2015-07-20 20:13 ` Jeremy Yallop
0 siblings, 2 replies; 5+ messages in thread
From: Mr. Herr @ 2015-07-20 20:00 UTC (permalink / raw)
To: Caml List
[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]
Hi,
unexplainable behavior: module Re_posix causes an error "undefined global Re_posix",
but the module is known.
Even stranger: when misspelling Re_posix the toplevel proposes Re_posix.
What is wrong?
/Str.
----------------------------------------------------------------------------------
/opt/opam/4.02.2/lib/ocaml/unix.cma: loaded
# #require "re";;
/opt/opam/4.02.2/lib/bytes: added to search path
/opt/opam/4.02.2/lib/re: added to search path
/opt/opam/4.02.2/lib/re/re.cma: loaded
# let re_whitespace = Re_posix.compile_pat "[\t ]+" ;;
Error: Reference to undefined global `Re_posix'
# #show_module Re_posix;;
module Re_posix :
sig
exception Parse_error
exception Not_supported
type opt = [ `ICase | `Newline | `NoSub ]
val re : ?opts:opt list -> string -> Re.t
val compile : Re.t -> Re.re
val compile_pat : ?opts:opt list -> string -> Re.re
end
# let re_whitespace = Re_posixx.compile_pat "[\t ]+" ;;
Error: Unbound module Re_posixx
Hint: Did you mean Re_posix?
[-- Attachment #2: Type: text/html, Size: 1797 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] undefined global Re_posix - ?
2015-07-20 20:00 [Caml-list] undefined global Re_posix - ? Mr. Herr
@ 2015-07-20 20:09 ` Ivan Gotovchits
2015-07-20 22:37 ` Mr. Herr
2015-07-20 20:13 ` Jeremy Yallop
1 sibling, 1 reply; 5+ messages in thread
From: Ivan Gotovchits @ 2015-07-20 20:09 UTC (permalink / raw)
To: Mr. Herr; +Cc: Caml List
[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]
You need to load posix sublibrary:
#require "re.posix";;
On Mon, Jul 20, 2015 at 4:00 PM, Mr. Herr <misterherr@freenet.de> wrote:
> Hi,
>
> unexplainable behavior: module Re_posix causes an error "undefined global
> Re_posix",
> but the module is known.
>
> Even stranger: when misspelling Re_posix the toplevel proposes Re_posix.
>
> What is wrong?
>
> /Str.
>
>
> ----------------------------------------------------------------------------------
> /opt/opam/4.02.2/lib/ocaml/unix.cma: loaded
> # #require "re";;
> /opt/opam/4.02.2/lib/bytes: added to search path
> /opt/opam/4.02.2/lib/re: added to search path
> /opt/opam/4.02.2/lib/re/re.cma: loaded
> # let re_whitespace = Re_posix.compile_pat "[\t ]+" ;;
> Error: Reference to undefined global `Re_posix'
> # #show_module Re_posix;;
> module Re_posix :
> sig
> exception Parse_error
> exception Not_supported
> type opt = [ `ICase | `Newline | `NoSub ]
> val re : ?opts:opt list -> string -> Re.t
> val compile : Re.t -> Re.re
> val compile_pat : ?opts:opt list -> string -> Re.re
> end
> # let re_whitespace = Re_posixx.compile_pat "[\t ]+" ;;
> Error: Unbound module Re_posixx
> Hint: Did you mean Re_posix?
>
>
[-- Attachment #2: Type: text/html, Size: 2332 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] undefined global Re_posix - ?
2015-07-20 20:00 [Caml-list] undefined global Re_posix - ? Mr. Herr
2015-07-20 20:09 ` Ivan Gotovchits
@ 2015-07-20 20:13 ` Jeremy Yallop
1 sibling, 0 replies; 5+ messages in thread
From: Jeremy Yallop @ 2015-07-20 20:13 UTC (permalink / raw)
To: Mr. Herr; +Cc: Caml List
On 20 July 2015 at 21:00, Mr. Herr <misterherr@freenet.de> wrote:
> unexplainable behavior: module Re_posix causes an error "undefined global
> Re_posix",
> but the module is known.
>
> Even stranger: when misspelling Re_posix the toplevel proposes Re_posix.
>
> What is wrong?
You need to add
#require "re.posix"
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] undefined global Re_posix - ?
2015-07-20 20:09 ` Ivan Gotovchits
@ 2015-07-20 22:37 ` Mr. Herr
2015-07-20 23:09 ` Daniel Bünzli
0 siblings, 1 reply; 5+ messages in thread
From: Mr. Herr @ 2015-07-20 22:37 UTC (permalink / raw)
Cc: Caml List
[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]
On 20.07.2015 22:09, Ivan Gotovchits wrote:
> You need to load posix sublibrary:
>
> #require "re.posix";;
>
> On Mon, Jul 20, 2015 at 4:00 PM, Mr. Herr <misterherr@freenet.de
> <mailto:misterherr@freenet.de>> wrote:
>
> Hi,
>
> unexplainable behavior: module Re_posix causes an error "undefined global
> Re_posix",
> but the module is known.
>
> Even stranger: when misspelling Re_posix the toplevel proposes Re_posix.
>
> What is wrong?
>
> /Str.
>
> ----------------------------------------------------------------------------------
> /opt/opam/4.02.2/lib/ocaml/unix.cma: loaded
> # #require "re";;
> /opt/opam/4.02.2/lib/bytes: added to search path
> /opt/opam/4.02.2/lib/re: added to search path
> /opt/opam/4.02.2/lib/re/re.cma: loaded
> # let re_whitespace = Re_posix.compile_pat "[\t ]+" ;;
> Error: Reference to undefined global `Re_posix'
> # #show_module Re_posix;;
> module Re_posix :
> sig
> exception Parse_error
> exception Not_supported
> type opt = [ `ICase | `Newline | `NoSub ]
> val re : ?opts:opt list -> string -> Re.t
> val compile : Re.t -> Re.re
> val compile_pat : ?opts:opt list -> string -> Re.re
> end
> # let re_whitespace = Re_posixx.compile_pat "[\t ]+" ;;
> Error: Unbound module Re_posixx
> Hint: Did you mean Re_posix?
>
>
Okay, thank you all - five answers in the mailbox.
So there is not much to "/opt/opam/4.02.2/lib/re: added to search path"
/Str.
[-- Attachment #2: Type: text/html, Size: 3572 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] undefined global Re_posix - ?
2015-07-20 22:37 ` Mr. Herr
@ 2015-07-20 23:09 ` Daniel Bünzli
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Bünzli @ 2015-07-20 23:09 UTC (permalink / raw)
To: Mr. Herr; +Cc: Caml List
Le lundi, 20 juillet 2015 à 23:37, Mr. Herr a écrit :
> So there is not much to "/opt/opam/4.02.2/lib/re: added to search path"
This only tells you that it will lookup for .cmi files and .cm{o,a} files in this directory. It doesn't mean that it *loads* them.
As you can see in your transcript only re.cma is loaded when you #require re and that archive doesn't have the re_posix.cmo file.
The reason why #show_module Re_posix gives you an answer is because in that re directory there is the re_posix.cmi file which the toplevel sees and loads to provide you the directive result and mispelling advice. Interface files are automatically looked up but not implementations.
From a usability perspective one could argue that ocamlfind subpackages should install in their own subdirectory so that the kind of "strange" behaviour you witnessed does not occur.
Best,
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-20 23:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 20:00 [Caml-list] undefined global Re_posix - ? Mr. Herr
2015-07-20 20:09 ` Ivan Gotovchits
2015-07-20 22:37 ` Mr. Herr
2015-07-20 23:09 ` Daniel Bünzli
2015-07-20 20:13 ` Jeremy Yallop
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox