From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA15001 for caml-redistribution; Thu, 2 Sep 1999 20:46:22 +0200 (MET DST) 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 OAA08985 for ; Thu, 2 Sep 1999 14:32:07 +0200 (MET DST) Received: from post.tepkom.ru (post.tepkom.ru [195.9.10.12]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id OAA09141 for ; Thu, 2 Sep 1999 14:32:04 +0200 (MET DST) Received: (from msk@localhost) by post.tepkom.ru (8.9.3/8.9.3) id QAA17310 for caml-list@pauillac.inria.fr.ANTIVIRUS; Thu, 2 Sep 1999 16:38:33 +0400 Received: from localhost (msk@localhost) by post.tepkom.ru (8.9.3/8.9.3) with ESMTP id QAA17290 for ; Thu, 2 Sep 1999 16:38:21 +0400 X-Authentication-Warning: post.tepkom.ru: msk owned process doing -bs Date: Thu, 2 Sep 1999 16:38:21 +0400 (MSD) From: Anton Moscal To: Caml list Subject: Re: convincing management to switch to Ocaml (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis On Fri, 27 Aug 1999, Andreas Rossberg wrote: > > >For example, type safety, > > > > Wrong. C++ is type safe, provided you don't use casts. > > Wrong, due to pointer arithmetics. This can happen silently: e.g. the > combination of arrays and subtyping as present in C++ is unsound, you > can produce segmentation faults without using any casts or explicit > pointer arithmetics or other features deemed unsafe. I think the basic > example is even in one of Stroustrups books. Another examples of C++ type unsafety: union types (...) function prototypes !! hangling references (for example - to local variables) scalar delete instead of array deletion (and inverse) And about templates & polymorphism: one month ago I try to translate into C++ the following very useful FP idiom (opeartor for postfix application): let (+>) x f = f x printf "%g" (1.0 +> sin +> cos);; I wrote: template C operator >> (B x, C (*f) (B)) { return (*f) (x); } ... printf ("%g", 1.0 >> sin >> cos); It doesn't compiles (due to C++ restriction: one of the parameters of the user-defined operator must be a class). This is good illustration of the problems with usage advanced C++ features. Actually I can't find any reasonable application in C++ for this template. Regards, Anton Moscal