Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] serious type confusion
@ 2004-03-27 17:31 briand
  2004-03-27 17:55 ` briand
  2004-03-27 18:16 ` Matt Gushee
  0 siblings, 2 replies; 4+ messages in thread
From: briand @ 2004-03-27 17:31 UTC (permalink / raw)
  To: caml-list


OK, this is what I get for coding too long in scheme :-)

observe the following:

# let a=ref [];;
val a : '_a list ref = {contents = []}
# a := {x=0.;y=0.;z=0.} :: [];;
- : unit = ()
# !a;;
- : point list = [{x = 0.; y = 0.; z = 0.}]
# a := {x=0.;y=0.;z=0.} :: !a;;
- : unit = ()
# !a
  ;;
- : point list = [{x = 0.; y = 0.; z = 0.}; {x = 0.; y = 0.; z = 0.}]
# 

Exactly as expected !  types aren't so bad after all..  until here :

              current_polyline := {x=wx; y=wy; z=wz} :: !current_polyline;

This expression has type point but is here used with type point list

Huh?  The first example worked.  Oh I see, it's operator precedence,
it's assigning the point before doing the concatenation.  Oh but wait,
it worked in the previous example.  I'll try and fix it anyway...

              current_polyline := ({x=wx; y=wy; z=wz} :: !current_polyline);

This expression has type point but is here used with type point list

Huh ???  Isn't that impossible ?  I've triple checked and
current_polyline is always consistently used as a list, and more
importantly a point list...

Any hints ?

Thank You

Brian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2004-03-27 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-27 17:31 [Caml-list] serious type confusion briand
2004-03-27 17:55 ` briand
2004-03-27 18:16 ` Matt Gushee
2004-03-27 18:34   ` briand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox