comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Initialization and Finalization of limited object "returned" by a function
Date: Sun, 14 Feb 2010 11:59:44 +0100
Date: 2010-02-14T11:59:35+01:00	[thread overview]
Message-ID: <1js6r6txuzjqz$.uah5yuqtg8md$.dlg@40tude.net> (raw)
In-Reply-To: wcczl3drv31.fsf@shell01.TheWorld.com

On Sat, 13 Feb 2010 10:53:06 -0500, Robert A Duff wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> 
>> Nope, the mathematical notation for a tuple is as in Ada (a,b,c,...), so
>> should it be.
> 
> Well, none of the following Ada operators use the standard maths
> notation:
> 
>     -  *  /  **  <=  >=  /=  and  or  not

Hey, somebody pushed for Unicode in Ada2005. Isn't it time now to fix that?
(:-))

http://en.wikipedia.org/wiki/Unicode_mathematical_operators

> And named notation:
> 
>     Date'(Year => 2010, Month => February, Day => 1)
> 
> is not standard maths notation -- it's superior to maths
> notation.

I don't know if there is a math notation for date. But Date' prefix is
obviously offending.

BTW, ISO date notation is 2010-02-01. Here we go:

   type Month_Date is record
      Year  : Year_Number;
      Month : Month_Number;
   end record;

   function "-" (Year : Year_Number; Month : Month_Number)
      return Month_Date is
   begin
      return (Year, Month);
   end "-";

   function "-" (Left : Month_Date; Right : Day_Number) return Time is
   begin
      return Time_Of (Left.Year, Left.Month, Right);
   end "-";
   
   T : Time := 2010-02-01;

Isn't Ada great?

> In general, I find Ada programs much easier
> to read that math textbooks, so I'm reluctant to borrow
> too much from maths.

Agreed. But that depends on who writes the text/program. Mathematicians are
famous for being worst programmers ever. So I am not surprised that their
books are as unreadable as their programs. But it is the notation, which
allows to decipher at least something from that mess. It is 1000 years of
natural selection that brought this notation up. I remember reading some
ancient books on analysis and linear algebra when I was a student. They
were absolutely incomprehensive. They consistently avoided use of O() and
o(), wrote all limits in expanded, they do also all matrices (a11, a12, ...
a1N, a21, a22, ... ...) instead of just A etc. (:-))

>>... I see no problem in having it ambiguous (overloaded).
> 
> That's too much overloading, for my taste.

But keyed notation for a singleton is not only boring. It is
counterintuitive. There *nothing* to reorder there. It is just one element.
What does the index here? (Of course, we consider only the case where the
aggregate's length is known)

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2010-02-14 10:59 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11  4:37 Initialization and Finalization of limited object "returned" by a function Hibou57 (Yannick Duchêne)
2010-02-11  9:51 ` Hibou57 (Yannick Duchêne)
2010-02-11 11:00 ` Ludovic Brenta
2010-02-11 11:33   ` Jean-Pierre Rosen
2010-02-11 23:15   ` Hibou57 (Yannick Duchêne)
2010-02-11 23:24     ` Robert A Duff
2010-02-12  5:41       ` Hibou57 (Yannick Duchêne)
2010-02-12 15:15         ` Robert A Duff
2010-02-12 16:27           ` Jean-Pierre Rosen
2010-02-12 17:53             ` Jacob Sparre Andersen
2010-02-12 18:05               ` Adam Beneschan
2010-02-13  1:59             ` Randy Brukardt
2010-02-12 16:57           ` Adam Beneschan
2010-02-12 18:07             ` mockturtle
2010-02-12 18:29               ` Hibou57 (Yannick Duchêne)
2010-02-12 19:09             ` Robert A Duff
2010-02-13  2:00               ` Randy Brukardt
2010-02-13  2:51                 ` Hibou57 (Yannick Duchêne)
2010-02-13 15:59                   ` Robert A Duff
2010-02-13 19:34                     ` Hibou57 (Yannick Duchêne)
2010-02-13 19:45                       ` Robert A Duff
2010-02-12 19:10             ` (see below)
2010-02-13  9:54           ` Dmitry A. Kazakov
2010-02-13 15:52             ` (see below)
2010-02-14 10:23               ` Dmitry A. Kazakov
2010-02-13 15:53             ` Robert A Duff
2010-02-14 10:59               ` Dmitry A. Kazakov [this message]
2010-02-14 22:00                 ` Hibou57 (Yannick Duchêne)
2010-02-11 15:16 ` Robert A Duff
2010-02-11 17:40   ` Adam Beneschan
2010-02-11 19:10     ` Robert A Duff
2010-02-11 21:51       ` Adam Beneschan
2010-02-11 22:49         ` Hibou57 (Yannick Duchêne)
2010-02-11 22:53           ` Hibou57 (Yannick Duchêne)
2010-02-11 23:08             ` Robert A Duff
2010-02-11 23:18               ` Hibou57 (Yannick Duchêne)
2010-02-12  0:48               ` Randy Brukardt
2010-02-12  5:37               ` Hibou57 (Yannick Duchêne)
2010-02-13  1:54                 ` Randy Brukardt
2010-02-12  5:39               ` Hibou57 (Yannick Duchêne)
2010-02-12 15:10                 ` Robert A Duff
2010-02-12 17:15                   ` (Hibou57) Yannick Duchêne
2010-02-12 19:07                     ` Robert A Duff
2010-02-12  1:05           ` Adam Beneschan
2010-02-12  2:35             ` Hibou57 (Yannick Duchêne)
2010-02-12  2:36               ` Hibou57 (Yannick Duchêne)
2010-02-12  2:36               ` Hibou57 (Yannick Duchêne)
2010-02-12  2:36               ` Hibou57 (Yannick Duchêne)
2010-02-12  2:37               ` Hibou57 (Yannick Duchêne)
2010-02-12  2:37               ` Hibou57 (Yannick Duchêne)
2010-02-12  2:37               ` Hibou57 (Yannick Duchêne)
2010-02-12  4:27                 ` Hibou57 (Yannick Duchêne)
2010-02-12  4:28                   ` Hibou57 (Yannick Duchêne)
2010-02-11 22:53         ` Robert A Duff
2010-02-11 23:41           ` Adam Beneschan
2010-02-12  0:22             ` Robert A Duff
2010-02-12  5:25         ` Hibou57 (Yannick Duchêne)
2010-02-12  9:27         ` Alex R. Mosteo
2010-02-12 16:43           ` Adam Beneschan
2010-02-12 19:11             ` Robert A Duff
2010-02-12  0:44     ` Randy Brukardt
2010-02-12  4:47     ` Hibou57 (Yannick Duchêne)
2010-02-12 18:02       ` Adam Beneschan
2010-02-12  4:49     ` Hibou57 (Yannick Duchêne)
2010-02-12  4:40   ` Hibou57 (Yannick Duchêne)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox