Skip to content

Commit a72d304

Browse files
committed
document __LOC__ in pervasives.mli
Also removes __FILE_OF__ and __MODULE_OF__, since they are not more precise than __FILE__ and __MODULE__ git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14715 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1 parent b791d66 commit a72d304

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

otherlibs/threads/pervasives.ml

-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ external __MODULE__ : string = "%loc_MODULE"
5050
external __POS__ : string * int * int * int = "%loc_POS"
5151

5252
external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC"
53-
external __FILE_OF__ : 'a -> string * 'a = "%loc_FILE"
5453
external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE"
55-
external __MODULE_OF__ : 'a -> string * 'a = "%loc_MODULE"
5654
external __POS_OF__ : 'a -> (string * int * int * int) * 'a = "%loc_POS"
5755

5856
(* Comparisons *)

stdlib/pervasives.ml

-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ external __MODULE__ : string = "%loc_MODULE"
4646
external __POS__ : string * int * int * int = "%loc_POS"
4747

4848
external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC"
49-
external __FILE_OF__ : 'a -> string * 'a = "%loc_FILE"
5049
external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE"
51-
external __MODULE_OF__ : 'a -> string * 'a = "%loc_MODULE"
5250
external __POS_OF__ : 'a -> (string * int * int * int) * 'a = "%loc_POS"
5351

5452
(* Comparisons *)

stdlib/pervasives.mli

+27-2
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,41 @@ external ( or ) : bool -> bool -> bool = "%sequor"
143143
(** {6 Debugging} *)
144144

145145
external __LOC__ : string = "%loc_LOC"
146+
(** [__LOC__] returns the location at which this expression appears in
147+
the file currently being parsed by the compiler, with the standard
148+
error format of OCaml: "File %S, line %d, characters %d-%d" *)
146149
external __FILE__ : string = "%loc_FILE"
150+
(** [__FILE__] returns the name of the file currently being
151+
parsed by the compiler. *)
147152
external __LINE__ : int = "%loc_LINE"
153+
(** [__LINE__] returns the line number at which this expression
154+
appears in the file currently being parsed by the compiler. *)
148155
external __MODULE__ : string = "%loc_MODULE"
156+
(** [__MODULE__] returns the module name of the file being
157+
parsed by the compiler. *)
149158
external __POS__ : string * int * int * int = "%loc_POS"
159+
(** [__POS__] returns a tuple [(file,lnum,cnum,enum)], corresponding
160+
to the location at which this expression appears in the file
161+
currently being parsed by the compiler. [file] is the current
162+
filename, [lnum] the line number, [cnum] the character position in
163+
the line and [enum] the last character position in the line. *)
150164

151165
external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC"
152-
external __FILE_OF__ : 'a -> string * 'a = "%loc_FILE"
166+
(** [__LOC_OF__ expr] returns a pair [(loc, expr)] where [loc] is the
167+
location of [expr] in the file currently being parsed by the
168+
compiler, with the standard error format of OCaml: "File %S, line
169+
%d, characters %d-%d" *)
153170
external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE"
154-
external __MODULE_OF__ : 'a -> string * 'a = "%loc_MODULE"
171+
(** [__LINE__ expr] returns a pair [(line, expr)], where [line] is the
172+
line number at which the expression [expr] appears in the file
173+
currently being parsed by the compiler. *)
155174
external __POS_OF__ : 'a -> (string * int * int * int) * 'a = "%loc_POS"
175+
(** [__POS_OF__ expr] returns a pair [(expr,loc)], where [loc] is a
176+
tuple [(file,lnum,cnum,enum)] corresponding to the location at
177+
which the expression [expr] appears in the file currently being
178+
parsed by the compiler. [file] is the current filename, [lnum] the
179+
line number, [cnum] the character position in the line and [enum]
180+
the last character position in the line. *)
156181

157182
(** {6 Composition operators} *)
158183

0 commit comments

Comments
 (0)