Re: Clean way to set Lexing.pos_fname field ?

"[email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Thanks for your explanation. A natural thing to do, then, would be to define

let lexing_from_file file_name=
  let in_channel=open_in file_name in
  let lexbuf=Lexing.from_channel in_channel in
  close_in in_channel; 
  lexbuf.Lexing.lex_curr_p <- {
      Lexing.pos_fname = file_name;
      pos_lnum = 1;
      pos_bol = 0;
      pos_cnum = 0;
    };
   lexbuf

Is there a special reason why this very function has not been
included as, say, a Lexing.from_file function in the Lexing module ?
That's what I would have done if I had written that module.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.