From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA17726 for caml-red; Sat, 10 Feb 2001 22:46:44 +0100 (MET) 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 OAA27730 for ; Sat, 10 Feb 2001 14:00:20 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f1AD0JD05173 for ; Sat, 10 Feb 2001 14:00:19 +0100 (MET) Received: from tet.kurims.kyoto-u.ac.jp (isdnppp2.kurims.kyoto-u.ac.jp [130.54.16.103]) by kurims.kurims.kyoto-u.ac.jp (8.9.3/3.7W) with ESMTP id WAA13066; Sat, 10 Feb 2001 22:00:16 +0900 (JST) Received: from localhost (localhost [127.0.0.1]) by tet.kurims.kyoto-u.ac.jp (8.11.1/8.11.1) with ESMTP id f1AD1cf29531; Sat, 10 Feb 2001 22:01:38 +0900 (JST) (envelope-from garrigue@kurims.kyoto-u.ac.jp) To: bpr@best.com Cc: caml-list@inria.fr Subject: Re: OCaml's long range graphical direction? In-Reply-To: References: <20010209102801K.garrigue@kurims.kyoto-u.ac.jp> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20010210220138R.garrigue@kurims.kyoto-u.ac.jp> Date: Sat, 10 Feb 2001 22:01:38 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: weis@pauillac.inria.fr Hi Brian, From: Brian Rogoff > On Fri, 9 Feb 2001, Jacques Garrigue wrote: > > Seriously, most Obj.magic in lablgtk amount to a cast of an external > > after checking its validity, and I see no way to avoid that. > > Sure, but it seems to me that even if such things are implemented > with Obj.magic under the hood we ought to come up with new names and > eventually move "approved and safe usages" to the Sys module. I am > probably under the influence of Modula-3 and Ada here... I checked again the cases, and they really amount to changing types according to the dynamic type of some C value. Since C has no dynamic typing, we cannot go very far... But you're right, this number could be considerably reduced by making specialized versions of Obj.magic specifying a bit more about the input and output type. I just avoided that, in case people would start using this function as a safe one. > > The last problem is how to stay type safe when you load a text file. > > Basically this means that you will be more verbose, and that will > > compare badly with guile-gtk or python-gtk based applications. > > I think for this problem we need some dynamic typing in the language. It > seems the Clean and Mercury languages have or will adopt such a solution; > I don't know about Haskell. This is the same issue as with safe > marshalling right, so we are told that there is some help on the way. Dynamic typing will still have a syntactic overhead. My point is that a typed language should have its own better ways to do things easy to do in scripting languages, and they can be different. > > So, there might be something to do, but I'm not so much convinced it > > will help with a language like ocaml. > > Then ocaml will have to become like something else. It won't be the > first time. I'm not sure of what you mean by that, but if you want to do things like add downcast to ocaml, then this is a discussion we had several years ago. Even if dynamic typing is introduced, it will probably have a more type dispatching flavor, forcing (or helping) the programmer to write exhaustive code. The credo of type safety can be hard to follow at times. But abandoning it just to be like other languages will not make us progress. We already know that at least for pure ML programming (including interfacing to many external libraries), one can find strongly typed ways to work. If using some external tool creates problem with that, I personally will prefer rethinking the external tool (or the way to use it), rather than forget that credo. It may seem like fanatism for the type religion, but for me ocaml is really that: a _typed_ language. Jacques