caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] crazy ocaml compiler implementation question
@ 2012-03-06 16:38 Matej Košík
  2012-03-06 17:33 ` Alain Frisch
  0 siblings, 1 reply; 2+ messages in thread
From: Matej Košík @ 2012-03-06 16:38 UTC (permalink / raw)
  To: caml-list

Hello,

In the file:

	typing/path.mli

contains the following definition:

        type t =
            Pident of Ident.t
          | Pdot of t * string * int
          | Papply of t * t

What is the semantics of third parameter?

In the implementation I see it either ignored or passed verbatime around
but I have failed to spot a place where it is actually used for
something so I failed to figure out its meaning.

(ocaml{c,opt,opt.opt} can perhaps even implement a warning option for
detecting defined variant parameters that are either ignored or only
uselessly passed around in this way. :-) )

More precisely, when constructing Pdot variant value, when should one
use anything other than Path.nopos?

Thanks in advance for any help.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] crazy ocaml compiler implementation question
  2012-03-06 16:38 [Caml-list] crazy ocaml compiler implementation question Matej Košík
@ 2012-03-06 17:33 ` Alain Frisch
  0 siblings, 0 replies; 2+ messages in thread
From: Alain Frisch @ 2012-03-06 17:33 UTC (permalink / raw)
  To: Matej Košík; +Cc: caml-list

On 03/06/2012 05:38 PM, Matej Košík wrote:
> Hello,
>
> In the file:
>
> 	typing/path.mli
>
> contains the following definition:
>
>          type t =
>              Pident of Ident.t
>            | Pdot of t * string * int
>            | Papply of t * t
>
> What is the semantics of third parameter?
>
> In the implementation I see it either ignored or passed verbatime around
> but I have failed to spot a place where it is actually used for
> something so I failed to figure out its meaning.

See Lambda.transl_path. The third parameters give the position of the 
component in its containing structure, at runtime (a structure is 
represented as a block, like a record).  It should be nopos for 
components that have no runtime representations (like types and module 
types declarations).

-- Alain

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-06 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-06 16:38 [Caml-list] crazy ocaml compiler implementation question Matej Košík
2012-03-06 17:33 ` Alain Frisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).