caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: briand@aracnet.com
To: caml-list@inria.fr
Subject: [Caml-list] serious type confusion
Date: Sat, 27 Mar 2004 09:31:00 -0800	[thread overview]
Message-ID: <16485.47700.498923.656556@soggy.deldotd.com> (raw)


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


             reply	other threads:[~2004-03-27 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-27 17:31 briand [this message]
2004-03-27 17:55 ` briand
2004-03-27 18:16 ` Matt Gushee
2004-03-27 18:34   ` briand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16485.47700.498923.656556@soggy.deldotd.com \
    --to=briand@aracnet.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).