From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a59300e1cca1082c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-20 04:37:58 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!195.158.233.21!news1.ebone.net!news.ebone.net!news.net.uni-c.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Parametrically polymorphic operations (Was: Safe C++) Date: Thu, 20 Sep 2001 13:37:57 +0200 Organization: Centre for Chaos and Turbulence Studies, Niels Bohr Institute Message-ID: <3BA9D515.1E6C7A49@nbi.dk> References: <3BA7A45D.186EE27A@adaworks.com> <20010919072904.O10277-100000@shell5.ba.best.com> <20010919102107.L4954-100000@shell5.ba.best.com> <9ob2u6$2r4l$1@msunews.cl.msu.edu> NNTP-Posting-Host: alf.nbi.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.net.uni-c.dk 1000985877 13128 130.225.212.55 (20 Sep 2001 11:37:57 GMT) X-Complaints-To: usenet@news.net.uni-c.dk NNTP-Posting-Date: Thu, 20 Sep 2001 11:37:57 +0000 (UTC) X-Mailer: Mozilla 4.78 [en] (X11; U; OSF1 V4.0 alpha) X-Accept-Language: fo,da,no,sv,is,de,fr,en Xref: archiver1.google.com comp.lang.ada:13205 Date: 2001-09-20T13:37:57+02:00 List-Id: Chad: > "Brian Rogoff" wrote in message [...] > > Parametrically polymorphic functions > I'll have to trust you or these three since I have never encountered a > situation where I was ever wishing for such functionality. While working on libraries for matrix operations and unit safe types, I have certainly wanted something very similar to parametrically polymorphic functions. It would make it possible to have more extensive compile time checks, than what is possible with Ada as it is defined today. An example: type Matrix (Left, Right : Positive) is private; function "*" (Left : in Matrix; Right : in Matrix (Height => Left.Width)) return Matrix (Width => Right.Width, Height => Left.Height); (I hope the intention is clear although the syntax isn't defined) This would tell the compiler a few things, which would allow it to flag type mismatches already at compile time. The current Ada specification forces us to move these checks into the body of the functions and procedures. Jacob -- "an OS that is almost, but not quite, entirely unlike Windows"