* [Caml-list] Location in source code @ 2002-01-28 3:35 Mathieu Gagne 2002-01-28 4:23 ` Ian Zimmerman 0 siblings, 1 reply; 3+ messages in thread From: Mathieu Gagne @ 2002-01-28 3:35 UTC (permalink / raw) To: caml-list Hello, I would like to be able to define in OCaml analogues of the cpp macros __FILE__ and __LINE__, for debugging purposes. For instance, I would like to be able to write Printf.printf "I had an error in module %s at line %d" __MODULE__ __LINE__ or something similar. __MODULE__ would expand to the fully qualified module name. I expect something like this might be possible using camlp4, but I can't figure out how. Does anyone have any idea how to achieve this? Best, Mathieu Gagne. ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Location in source code 2002-01-28 3:35 [Caml-list] Location in source code Mathieu Gagne @ 2002-01-28 4:23 ` Ian Zimmerman 2002-01-28 7:57 ` Chris Hecker 0 siblings, 1 reply; 3+ messages in thread From: Ian Zimmerman @ 2002-01-28 4:23 UTC (permalink / raw) To: OCAML Mathieu> Hello, I would like to be able to define in OCaml analogues Mathieu> of the cpp macros __FILE__ and __LINE__, for debugging Mathieu> purposes. For instance, I would like to be able to write Mathieu> Printf.printf "I had an error in module %s at line %d" Mathieu> __MODULE__ __LINE__ Isn't this what assertions are for? -- Ian Zimmerman, Oakland, California, U.S.A. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 In his own soul a man bears the source from which he draws all his sorrows and his joys. Sophocles. ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Location in source code 2002-01-28 4:23 ` Ian Zimmerman @ 2002-01-28 7:57 ` Chris Hecker 0 siblings, 0 replies; 3+ messages in thread From: Chris Hecker @ 2002-01-28 7:57 UTC (permalink / raw) To: OCAML >Mathieu> Printf.printf "I had an error in module %s at line %d" >Mathieu> __MODULE__ __LINE__ >Isn't this what assertions are for? Except that assertions don't do this either. :) As has been mentioned a bunch of times on the list, assertions in caml only record the file position, and even then they don't seem to handle crlf issues properly on win32. Anyway, this is a FAQ, search the archive. Chris ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-01-28 7:57 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2002-01-28 3:35 [Caml-list] Location in source code Mathieu Gagne 2002-01-28 4:23 ` Ian Zimmerman 2002-01-28 7:57 ` Chris Hecker
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox