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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,65cf1c5c90ed694 X-Google-Attributes: gid103376,public From: hymie@panix.com (Hyman Rosen) Subject: Re: Ada vs. C++ (Readability) Date: 1997/09/11 Message-ID: <5v9n4o$6k6@panix.com>#1/1 X-Deja-AN: 271685887 References: <341566c7.0@news.uni-ulm.de> <5v4kie$jp1@panix.com> <3416458e.0@news.uni-ulm.de> Organization: Panix Newsgroups: comp.lang.ada X-Newsposter: trn 4.0-test55 (26 Feb 97) Date: 1997-09-11T00:00:00+00:00 List-Id: In article <3416458e.0@news.uni-ulm.de>, Joerg Rodemann wrote: >Nevertheless, I can't help to think overloading here is not a good idea if >you want someone else to read this. The only hint that the first two >numbers are not omitted is that x is of type ray. I would expect that anyone maintaining this code is going to first acquire some knowledge of the libraries involved, or else they are not going to succeed very well. The documentation for Blitz++ and the exmaples provided describe and explain this usage for creating Arrays. >Another comment, or question, about the expression templates: what about >type safety? I understand that C++ templates are not in any way type safe >wrt the instantion parameters. Expression templates are completely typesafe, as are C++ templates in general. It's easiest if you think of templates as a fancy macro facility. The code which results from instantiating a template with specific types and values is typesafe in the same way that writing the equivalent code by hand would be. It's true that C++ templates give you no way of formally stating the operations that the generic parameters must support. Instead, C++ relies on "legality by usage". If the result of an instantiation is legal code given the specific types, then everything is fine. If the type does not support some operation that the template requires, and that part of the template is actually used, then the compiler will give you an appropriate error message.