From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id HAA26270; Thu, 26 Aug 2004 07:05:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA26223 for ; Thu, 26 Aug 2004 07:05:52 +0200 (MET DST) From: briand@aracnet.com Received: from jade.spiritone.com (jade.spiritone.com [216.99.193.136]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i7Q55oU3018280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 26 Aug 2004 07:05:52 +0200 Received: from soggy.deldotd.com (216-99-206-32.cust.aracnet.com [216.99.206.32]) by jade.spiritone.com (8.12.8/8.12.8) with ESMTP id i7Q55noR004760; Wed, 25 Aug 2004 22:05:49 -0700 Received: from briand by soggy.deldotd.com with local (Exim 3.36 #1 (Debian)) id 1C0CSL-0000OZ-00; Wed, 25 Aug 2004 22:05:49 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16685.28589.807412.69960@soggy.deldotd.com> Date: Wed, 25 Aug 2004 22:05:49 -0700 To: "Alex Valdez" Cc: Subject: RE: [Caml-list] baffled by semicolon In-Reply-To: <000401c48b23$cc26d630$0200a8c0@Vigo> References: <16685.22393.76718.150882@soggy.deldotd.com> <000401c48b23$cc26d630$0200a8c0@Vigo> X-Mailer: VM 6.92 under Emacs 21.2.1 X-Miltered: at concorde with ID 412D6FAE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 baffled:01 semicolon:01 woke:99 side-effect:01 2004:99 caml-list:01 baffled:01 semicolon:01 lablgtk:01 gwindow:01 gmisc:01 bug:01 faq:01 faq:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >>>>> "Alex" == Alex Valdez writes: Alex> The following code snippet Alex> let w = area#misc#realize () ; Alex> area#misc#window;; Alex> is the same as Alex> let w = area#misc#realize ( () ; area#misc#window );; interesting. Somehow I managed to edit it poorly, in the file I copied it from, the original statement is actuallly : let w = area#misc#realize () ; area#misc#window and the next statement is a let, so the ;; is not really needed, I just like to put them in for clarity. Alex> which is the same as Alex> let w = area#misc#realize area#misc#window;; Neither of the above works properly : This expression has type Gdk.window = [ `drawable | `gdkwindow ] Gobject.obj but is here used with type unit However your response woke up some neurons - why wouldn't it be : let w = (area#misc#realize ()); area#misc#window ;; Which also makes sense, the first statement being called for a side-effect, and the second is the value for w. ding-ding-ding we have a winner. The above _does_ work. Brian Alex> -----Original Message----- From: Alex> owner-caml-list@pauillac.inria.fr Alex> [mailto:owner-caml-list@pauillac.inria.fr]On Behalf Of Alex> briand@aracnet.com Sent: Wednesday, August 25, 2004 10:23 PM Alex> To: caml-list@pauillac.inria.fr Subject: [Caml-list] baffled Alex> by semicolon Alex> This might really by a lablgtk2 question, but I thought it's Alex> probably more of a ocaml syntax question : Alex> The following works : Alex> let window = GWindow.window ~width:400 ~height:400() ;; Alex> let area = GMisc.drawing_area ~packing:window#add () ;; Alex> let w = area#misc#realize () ; Alex> area#misc#window;; Alex> let drawing = new GDraw.drawable w ;; Alex> However making the simple change Alex> let w = area#misc#realize () ;; Alex> ^^ notice the double semicolon gives an error: This expression Alex> has type unit but is here used with type [> `drawable ] Alex> Gobject.obj Alex> For the simple reason that w has somehow, mysteriously, become Alex> = () instead of Gdk.window which is the value it would acquire Alex> if it was only a single semi-colon. Alex> I went back through the manual and really couldn't find Alex> anything which explained the difference between ; and ;; - so Alex> it's not at all obvious to me what's going on here. I would Alex> think that w would take on the value of evaluating Alex> area#misc#realize () Alex> in either case. Alex> ??? Alex> Brian Alex> ------------------- To unsubscribe, mail Alex> caml-list-request@inria.fr Archives: http://caml.inria.fr Bug Alex> reports: http://caml.inria.fr/bin/caml-bugs FAQ: Alex> http://caml.inria.fr/FAQ/ Beginner's list: Alex> http://groups.yahoo.com/group/ocaml_beginners Alex> ------------------- To unsubscribe, mail Alex> caml-list-request@inria.fr Archives: http://caml.inria.fr Bug Alex> reports: http://caml.inria.fr/bin/caml-bugs FAQ: Alex> http://caml.inria.fr/FAQ/ Beginner's list: Alex> http://groups.yahoo.com/group/ocaml_beginners ------------------- 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