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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.58.100.135 with SMTP id ey7mr2534087veb.29.1401855141448; Tue, 03 Jun 2014 21:12:21 -0700 (PDT) X-Received: by 10.182.191.68 with SMTP id gw4mr122936obc.15.1401855141213; Tue, 03 Jun 2014 21:12:21 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!hw13no4048789qab.0!news-out.google.com!gi6ni19621igc.0!nntp.google.com!h18no220563igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 3 Jun 2014 21:12:20 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.252.147.203; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 71.252.147.203 References: <36324571423534039.464516laguest-archeia.com@nntp.aioe.org> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9a0e76b9-b7a0-4450-ac24-2a7d7f8f844d@googlegroups.com> Subject: Re: a new language, designed for safety ! From: "Dan'l Miller" Injection-Date: Wed, 04 Jun 2014 04:12:21 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3216 X-Received-Body-CRC: 3552086924 Xref: news.eternal-september.org comp.lang.ada:20129 Date: 2014-06-03T21:12:20-07:00 List-Id: On Tuesday, June 3, 2014 8:19:03 PM UTC-5, Dan'l Miller wrote: > On Tuesday, June 3, 2014 7:21:45 PM UTC-5, Luke A. Guest wrote: >=20 > > Quel surprise, it's YAC (yet another C) This YAC is not your father's Oldsmobile. As another example, Swift (along= with Seed7, Fortress, and a few other languages lately) allow declaration = of prefix, infix, & postfix operators that do not appear in the standardize= d language: "Custom Operators You can declare and implement your own custom operators in addition to the = standard operators provided by Swift. Custom operators can be defined only = with the characters / =3D - + * % < > ! & | ^ . ~. New operators are declared at a global level using the operator keyword, an= d can be declared as prefix, infix or postfix: operator prefix +++ {} The example above defines a new prefix operator called +++. This operator d= oes not have an existing meaning in Swift, and so it is given its own custo= m meaning below in the specific context of working with Vector2D instances.= For the purposes of this example, +++ is treated as a new "prefix doubling= incrementer" operator. It doubles the x and y values of a Vector2D instanc= e, by adding the vector to itself with the addition assignment operator def= ined earlier: @prefix @assignment func +++ (inout vector: Vector2D) -> Vector2D { vector +=3D vector return vector } This implementation of +++ is very similar to the implementation of ++ for = Vector2D, except that this operator function adds the vector to itself, rat= her than adding Vector2D(1.0, 1.0): var toBeDoubled =3D Vector2D(x: 1.0, y: 4.0) let afterDoubling =3D +++toBeDoubled // toBeDoubled now has values of (2.0, 8.0) // afterDoubling also has values of (2.0, 8.0) Precedence and Associativity for Custom Infix Operators[...]" Excerpt From: Apple Inc. "The Swift Programming Language." iBooks. https://= itun.es/us/jEUH0.l