comp.lang.ada
 help / color / mirror / Atom feed
* Introductory Ada Programming Book
@ 2016-12-31 13:18 Andrew Shvets
  2016-12-31 14:26 ` Lucretia
                   ` (6 more replies)
  0 siblings, 7 replies; 38+ messages in thread
From: Andrew Shvets @ 2016-12-31 13:18 UTC (permalink / raw)


Hello,

My name is Andrew Shvets.  I've been learning how to program in Ada over the past few years.  As someone that came from C/C++, Java and Python many of the concepts that were in Ada were not easy to digest at first.  After spending a fair amount of time looking for a guide that would help me out (something that would guide me through much of the ideas in Ada in a gentle manner was strongly preferred and be focused on Ada 2012), I couldn't find something like this (there is, on the other hand plenty of material that would explain more advanced concepts.)  Having mastered many of the basic concepts in this wonderful language, I figured that having a guide for this would be very helpful and wrote one.  Hence the book "Introductory Ada Programming Book: A Book for Beginner Programmers and Beginners to Ada".  The goal was to create a roadmap for those new to Ada learn more quickly and gain a certain level of mastery.

https://www.amazon.com/Introductory-Ada-Programming-Book-Programmers-ebook/dp/B01N6D5TPE/ref=sr_1_1?ie=UTF8&qid=1483189391&sr=8-1&keywords=introductory+ada

I'm open to sending PDFs as review copies, please send your requests to:
introductory dot ada at gmail dot com

Thank you for taking the time to read through this!  Also, thank you for those -- on this mailing list -- who have helped me better understand Ada!

Looking forward to hearing from everyone!

--Andrew


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
@ 2016-12-31 14:26 ` Lucretia
  2016-12-31 15:10   ` Dmitry A. Kazakov
  2016-12-31 14:28 ` Lucretia
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 38+ messages in thread
From: Lucretia @ 2016-12-31 14:26 UTC (permalink / raw)


Hi,

Ada basically forces you to think about your data, the way other languages should, but don't. Data has ranges of allowable values and the compiler will enforce their use.

Take a look at John English's AdaCraft http://www.adaic.org/resources/add_content/docs/craft/html/contents.htm - wasn't he supposed to be updating this to Ada 2012?

Then use the various standards (don't bother with the annotated ones yet), http://www.adaic.org/ada-resources/standards to learn Ada 2005 and 2012 extensions to Ada95.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
  2016-12-31 14:26 ` Lucretia
@ 2016-12-31 14:28 ` Lucretia
  2016-12-31 14:34 ` Lucretia
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 38+ messages in thread
From: Lucretia @ 2016-12-31 14:28 UTC (permalink / raw)


BTW, what projects do you have in mind? Always interesting to know what people are doing with the language and why they're looking into it. :)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
  2016-12-31 14:26 ` Lucretia
  2016-12-31 14:28 ` Lucretia
@ 2016-12-31 14:34 ` Lucretia
  2016-12-31 17:22   ` Andrew Shvets
  2016-12-31 17:59 ` Gour
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 38+ messages in thread
From: Lucretia @ 2016-12-31 14:34 UTC (permalink / raw)


On Saturday, 31 December 2016 13:18:08 UTC, Andrew Shvets  wrote:
> Hello,
> 
> My name is Andrew Shvets.  I've been learning how to program in Ada over the past few years.  As someone that came from C/C++, Java and Python many of the concepts that were in Ada were not easy to digest at first.  After spending a  fair amount of time looking for a guide that would help me out (something that would guide me through much of the ideas in Ada in a gentle manner was strongly preferred and be focused on Ada 2012), I couldn't find something like this (there is, on the other hand plenty of material that would explain more advanced concepts.)  Having mastered many of the basic concepts in this wonderful language, I figured that having a guide for this would be very helpful and wrote one.  Hence the book "Introductory Ada Programming Book: A Book for Beginner Programmers and Beginners to Ada".  The goal was to create a roadmap for those new to Ada learn more quickly and gain a certain level of mastery.


Hi,

Ada basically allows you to think about your data, the way other languages should, but don't. You can still program in a C like way although that's not advised. Basically, data has ranges of allowable values and the compiler will enforce their use, the programmer doesn't have to remember to shove in ASSERT macros everywhere.

Take a look at John English's AdaCraft http://www.adaic.org/resources/add_content/docs/craft/html/contents.htm - wasn't he supposed to be updating this to Ada 2012?

IMO, Ada 2012 is the best revision we have so far, if you don't want to use certain features don't use them, or if there is one, use "pragma Restriction (x);" to make the compiler enforce it.

Then use the various standards (don't bother with the annotated ones yet), http://www.adaic.org/ada-resources/standards to learn Ada 2005 and 2012 extensions to Ada95. 

BTW, what projects do you have in mind? Always interesting to know what people are doing with the language and why they're looking into it. :)


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 14:26 ` Lucretia
@ 2016-12-31 15:10   ` Dmitry A. Kazakov
  2016-12-31 17:14     ` Andrew Shvets
  0 siblings, 1 reply; 38+ messages in thread
From: Dmitry A. Kazakov @ 2016-12-31 15:10 UTC (permalink / raw)


On 2016-12-31 15:26, Lucretia wrote:

> Ada basically forces you to think about your data, the way other
> languages should, but don't. Data has ranges of allowable values and the
> compiler will enforce their use.

It is called type or datatype. Data is a value of some type associated 
with some problem space meaning, like employee's age is 38.

Ada does not force you, it rather offers richer than other languages 
means to define types more suitable to annotate and handle data. You 
still can be a real C programmer in Ada by using Integer or 
Integer_Address for just everything.

Happy New Year!

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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 15:10   ` Dmitry A. Kazakov
@ 2016-12-31 17:14     ` Andrew Shvets
  0 siblings, 0 replies; 38+ messages in thread
From: Andrew Shvets @ 2016-12-31 17:14 UTC (permalink / raw)


On Saturday, December 31, 2016 at 10:10:25 AM UTC-5, Dmitry A. Kazakov wrote:
> On 2016-12-31 15:26, Lucretia wrote:
> 
> > Ada basically forces you to think about your data, the way other
> > languages should, but don't. Data has ranges of allowable values and the
> > compiler will enforce their use.
> 
> It is called type or datatype. Data is a value of some type associated 
> with some problem space meaning, like employee's age is 38.
> 
> Ada does not force you, it rather offers richer than other languages 
> means to define types more suitable to annotate and handle data. You 
> still can be a real C programmer in Ada by using Integer or 
> Integer_Address for just everything.
> 
> Happy New Year!
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Exactly!  This is what I love so much about this language!  It has so many benefits, from security to software reliability to correctness of execution.  This is such a powerful portion of the language that nothing else quite compares.

I covered this topic in two chapters.  One dealt with the primitives that are already baked in the language and the second one dealt with the custom types that you mention.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 14:34 ` Lucretia
@ 2016-12-31 17:22   ` Andrew Shvets
  0 siblings, 0 replies; 38+ messages in thread
From: Andrew Shvets @ 2016-12-31 17:22 UTC (permalink / raw)


On Saturday, December 31, 2016 at 9:34:12 AM UTC-5, Lucretia wrote:
> On Saturday, 31 December 2016 13:18:08 UTC, Andrew Shvets  wrote:
> > Hello,
> > 
> > My name is Andrew Shvets.  I've been learning how to program in Ada over the past few years.  As someone that came from C/C++, Java and Python many of the concepts that were in Ada were not easy to digest at first.  After spending a  fair amount of time looking for a guide that would help me out (something that would guide me through much of the ideas in Ada in a gentle manner was strongly preferred and be focused on Ada 2012), I couldn't find something like this (there is, on the other hand plenty of material that would explain more advanced concepts.)  Having mastered many of the basic concepts in this wonderful language, I figured that having a guide for this would be very helpful and wrote one.  Hence the book "Introductory Ada Programming Book: A Book for Beginner Programmers and Beginners to Ada".  The goal was to create a roadmap for those new to Ada learn more quickly and gain a certain level of mastery.
> 
> 
> Hi,
> 
> Ada basically allows you to think about your data, the way other languages should, but don't. You can still program in a C like way although that's not advised. Basically, data has ranges of allowable values and the compiler will enforce their use, the programmer doesn't have to remember to shove in ASSERT macros everywhere.
> 
> Take a look at John English's AdaCraft http://www.adaic.org/resources/add_content/docs/craft/html/contents.htm - wasn't he supposed to be updating this to Ada 2012?
> 
> IMO, Ada 2012 is the best revision we have so far, if you don't want to use certain features don't use them, or if there is one, use "pragma Restriction (x);" to make the compiler enforce it.
> 
> Then use the various standards (don't bother with the annotated ones yet), http://www.adaic.org/ada-resources/standards to learn Ada 2005 and 2012 extensions to Ada95. 
> 
> BTW, what projects do you have in mind? Always interesting to know what people are doing with the language and why they're looking into it. :)

Sure.  However, Ada has its own way of doing things (from the syntax to procedures/functions to tasks) and going from one to another does require a realignment of how you think about the process of developing applications in this wonderful language.  Having a gentle and hand-held introduction would definitely help for newcomers.

As for projects, I'm thinking of doing an optparse package that you see in Python (which I'm a fan of.)  Honestly, I'm pretty stretched thin due to other obligations/commitments, so that's not something that I can jump on doing right now.

I would like to release a second edition, but again, not sure based on what time I have.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
                   ` (2 preceding siblings ...)
  2016-12-31 14:34 ` Lucretia
@ 2016-12-31 17:59 ` Gour
  2017-01-02 15:56   ` Andrew Shvets
  2017-01-03 15:31 ` Patrick Noffke
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 38+ messages in thread
From: Gour @ 2016-12-31 17:59 UTC (permalink / raw)


On Sat, 31 Dec 2016 05:18:07 -0800 (PST)
Andrew Shvets <andrew.shvets@gmail.com> wrote:

Hiya Andrew,

I was (am) interested in using Ada to write desktop gui app (as
open.source hobby project), but after
prolonged time of investigating about adequate language - not faling in
the {C, C++, Java} set, I decided to put it in the MAYBE category and
focus on other areas in my life...

On my shelf there is copy of Barnes' Ada 95 book (Ada 2012 is expensive
if not being sure to learn Ada), so it's interesting to see your book!

> I'm open to sending PDFs as review copies, please send your requests
> to: introductory dot ada at gmail dot com

I do not dare to ask for 'review copy' since my old blog does not have
'technical' section category and the new one is still not reviewed, but
I'm interested for a copy to have in case my project gets re-labelled
from MAYBE --> TODO.

So, I'm curious if you plan tp produce e.g. *.epub version?

I own only *.pub capable readers (althoug preferring
paperback/harcdcover books) and, based on the intro chapter avaialble
at Amazon, the book really looks interesting.


Sincerely,
Gour

-- 
Even if you are considered to be the most sinful of all sinners,
when you are situated in the boat of transcendental knowledge
you will be able to cross over the ocean of miseries.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 17:59 ` Gour
@ 2017-01-02 15:56   ` Andrew Shvets
  2017-01-02 16:32     ` Gour
  0 siblings, 1 reply; 38+ messages in thread
From: Andrew Shvets @ 2017-01-02 15:56 UTC (permalink / raw)


On Saturday, December 31, 2016 at 1:04:02 PM UTC-5, Gour wrote:
> On Sat, 31 Dec 2016 05:18:07 -0800 (PST)
> Andrew Shvets <and...@gmail.com> wrote:
> 
> Hiya Andrew,
> 
> I was (am) interested in using Ada to write desktop gui app (as
> open.source hobby project), but after
> prolonged time of investigating about adequate language - not faling in
> the {C, C++, Java} set, I decided to put it in the MAYBE category and
> focus on other areas in my life...
> 
> On my shelf there is copy of Barnes' Ada 95 book (Ada 2012 is expensive
> if not being sure to learn Ada), so it's interesting to see your book!
> 
> > I'm open to sending PDFs as review copies, please send your requests
> > to: introductory dot ada at gmail dot com
> 
> I do not dare to ask for 'review copy' since my old blog does not have
> 'technical' section category and the new one is still not reviewed, but
> I'm interested for a copy to have in case my project gets re-labelled
> from MAYBE --> TODO.
> 
> So, I'm curious if you plan tp produce e.g. *.epub version?
> 
> I own only *.pub capable readers (althoug preferring
> paperback/harcdcover books) and, based on the intro chapter avaialble
> at Amazon, the book really looks interesting.
> 
> 
> Sincerely,
> Gour
> 
> -- 
> Even if you are considered to be the most sinful of all sinners,
> when you are situated in the boat of transcendental knowledge
> you will be able to cross over the ocean of miseries.

Hi Gour,

I'm thinking more about posting a review on Amazon.  Having the review on your blog sounds fantastic, but for now an Amazon review would be very welcome.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-02 15:56   ` Andrew Shvets
@ 2017-01-02 16:32     ` Gour
  0 siblings, 0 replies; 38+ messages in thread
From: Gour @ 2017-01-02 16:32 UTC (permalink / raw)


On Mon, 2 Jan 2017 07:56:11 -0800 (PST)
Andrew Shvets <andrew.shvets@gmail.com> wrote:

> I'm thinking more about posting a review on Amazon.  Having the
> review on your blog sounds fantastic, but for now an Amazon review
> would be very welcome.

Well, I can't do it considering that I do not own Kindle reader, only
readers which do e.g. *.epub format.


Sincerely,
Gour

-- 
One who is not disturbed in mind even amidst the threefold
miseries or elated when there is happiness, and who is free
from attachment, fear and anger, is called a sage of steady mind.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
                   ` (3 preceding siblings ...)
  2016-12-31 17:59 ` Gour
@ 2017-01-03 15:31 ` Patrick Noffke
  2017-01-03 22:18   ` Andrew Shvets
  2017-01-04  1:14 ` Paul Rubin
  2017-01-04 23:42 ` Andrew Shvets
  6 siblings, 1 reply; 38+ messages in thread
From: Patrick Noffke @ 2017-01-03 15:31 UTC (permalink / raw)


On Saturday, December 31, 2016 at 7:18:08 AM UTC-6, Andrew Shvets wrote:
> Hello,
> 
> My name is Andrew Shvets.  I've been learning how to program in Ada over the past few years.  As someone that came from C/C++, Java and Python many of the concepts that were in Ada were not easy to digest at first.  After spending a fair amount of time looking for a guide that would help me out (something that would guide me through much of the ideas in Ada in a gentle manner was strongly preferred and be focused on Ada 2012), I couldn't find something like this (there is, on the other hand plenty of material that would explain more advanced concepts.)  Having mastered many of the basic concepts in this wonderful language, I figured that having a guide for this would be very helpful and wrote one.  Hence the book "Introductory Ada Programming Book: A Book for Beginner Programmers and Beginners to Ada".  The goal was to create a roadmap for those new to Ada learn more quickly and gain a certain level of mastery.
> 
> https://www.amazon.com/Introductory-Ada-Programming-Book-Programmers-ebook/dp/B01N6D5TPE/ref=sr_1_1?ie=UTF8&qid=1483189391&sr=8-1&keywords=introductory+ada
> 
> I'm open to sending PDFs as review copies, please send your requests to:
> introductory dot ada at gmail dot com
> 
> Thank you for taking the time to read through this!  Also, thank you for those -- on this mailing list -- who have helped me better understand Ada!
> 
> Looking forward to hearing from everyone!
> 
> --Andrew

Hi Andrew,

Thank you for creating your book.  I think it's great that you have done so.

I read the introduction and noticed several grammatical errors.  I suggest you have a copy editor edit your book.  It shouldn't cost you too much, and it will provide a much better first impression to your readers.

Good luck and best regards,
Patrick


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-03 15:31 ` Patrick Noffke
@ 2017-01-03 22:18   ` Andrew Shvets
  0 siblings, 0 replies; 38+ messages in thread
From: Andrew Shvets @ 2017-01-03 22:18 UTC (permalink / raw)


On Tuesday, January 3, 2017 at 10:31:18 AM UTC-5, Patrick Noffke wrote:
> On Saturday, December 31, 2016 at 7:18:08 AM UTC-6, Andrew Shvets wrote:
> > Hello,
> > 
> > My name is Andrew Shvets.  I've been learning how to program in Ada over the past few years.  As someone that came from C/C++, Java and Python many of the concepts that were in Ada were not easy to digest at first.  After spending a fair amount of time looking for a guide that would help me out (something that would guide me through much of the ideas in Ada in a gentle manner was strongly preferred and be focused on Ada 2012), I couldn't find something like this (there is, on the other hand plenty of material that would explain more advanced concepts.)  Having mastered many of the basic concepts in this wonderful language, I figured that having a guide for this would be very helpful and wrote one.  Hence the book "Introductory Ada Programming Book: A Book for Beginner Programmers and Beginners to Ada".  The goal was to create a roadmap for those new to Ada learn more quickly and gain a certain level of mastery.
> > 
> > https://www.amazon.com/Introductory-Ada-Programming-Book-Programmers-ebook/dp/B01N6D5TPE/ref=sr_1_1?ie=UTF8&qid=1483189391&sr=8-1&keywords=introductory+ada
> > 
> > I'm open to sending PDFs as review copies, please send your requests to:
> > introductory dot ada at gmail dot com
> > 
> > Thank you for taking the time to read through this!  Also, thank you for those -- on this mailing list -- who have helped me better understand Ada!
> > 
> > Looking forward to hearing from everyone!
> > 
> > --Andrew
> 
> Hi Andrew,
> 
> Thank you for creating your book.  I think it's great that you have done so.
> 
> I read the introduction and noticed several grammatical errors.  I suggest you have a copy editor edit your book.  It shouldn't cost you too much, and it will provide a much better first impression to your readers.
> 
> Good luck and best regards,
> Patrick

Hello Patrick,

I agree that there are some flaws with the editing.  I haven't had a professional look at it.  With this work, my goal is to gauge how well it's received and try for a 2nd edition this year (but I can't promise this, so no guarantees) that will have a once-over by a professional editor.  This project was run on-purpose on a shoe-string budget since I wasn't sure how well it would be received.

If the response is large enough, then I'd love to make a more polished product in the future.

--Andrew


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
                   ` (4 preceding siblings ...)
  2017-01-03 15:31 ` Patrick Noffke
@ 2017-01-04  1:14 ` Paul Rubin
  2017-01-04  3:07   ` Andrew Shvets
  2017-01-04 23:42 ` Andrew Shvets
  6 siblings, 1 reply; 38+ messages in thread
From: Paul Rubin @ 2017-01-04  1:14 UTC (permalink / raw)


Andrew Shvets <andrew.shvets@gmail.com> writes:
> As someone that came from C/C++, Java and Python many of the concepts
> that were in Ada were not easy to digest at first.  After spending a
> fair amount of time looking for a guide that would help me out

I thought the following were good, though not complete:

* http://cowlark.com/2014-04-27-ada/index.html


This is about Ada 2005:

* http://www.adaic.org/wp-content/uploads/2010/05/Ada-Distilled-24-January-2011-Ada-2005-Version.pdf

The Ada 2012 changes generally seemed straightforward and sensible to me.

> https://www.amazon.com/Introductory-Ada-Programming-Book-Programmers-ebook/dp/B01N6D5TPE/ref=sr_1_1?ie=UTF8&qid=1483189391&sr=8-1&keywords=introductory+ada

https://www.amazon.com/dp/B01N6D5TPE/ is a shorter url that should reach
the same page.  I can't access it right now because of issues at my end
though.

> The goal was to create a roadmap for those new to Ada learn more
> quickly and gain a certain level of mastery.

There's a Wikibook about Ada that I've been wanting to read:

  https://en.wikibooks.org/wiki/Subject:Ada_programming_language

> I'm open to sending PDFs as review copies, please send your requests to:
> introductory dot ada at gmail dot com

I might send in a request.  I won't be able to review it on Amazon but
could post a review here, if that works for you.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04  1:14 ` Paul Rubin
@ 2017-01-04  3:07   ` Andrew Shvets
  2017-01-04  6:46     ` J-P. Rosen
  0 siblings, 1 reply; 38+ messages in thread
From: Andrew Shvets @ 2017-01-04  3:07 UTC (permalink / raw)


On Tuesday, January 3, 2017 at 8:14:28 PM UTC-5, Paul Rubin wrote:
> Andrew Shvets <and...@gmail.com> writes:
> > As someone that came from C/C++, Java and Python many of the concepts
> > that were in Ada were not easy to digest at first.  After spending a
> > fair amount of time looking for a guide that would help me out
> 
> I thought the following were good, though not complete:
> 
> * http://cowlark.com/2014-04-27-ada/index.html
> 

I have to admit, this is the first time seeing this page.  It looks good.  I still think that when it comes to best teaching Ada to newcomers, the more advanced typing information should be reserved for later on (if you know nothing about it, this is very confusing and unclear.)

Thanks for bringing it to my attention.

> 
> This is about Ada 2005:
> 
> * http://www.adaic.org/wp-content/uploads/2010/05/Ada-Distilled-24-January-2011-Ada-2005-Version.pdf
> 
> The Ada 2012 changes generally seemed straightforward and sensible to me.
> 
> > https://www.amazon.com/Introductory-Ada-Programming-Book-Programmers-ebook/dp/B01N6D5TPE/ref=sr_1_1?ie=UTF8&qid=1483189391&sr=8-1&keywords=introductory+ada
> 
> https://www.amazon.com/dp/B01N6D5TPE/ is a shorter url that should reach
> the same page.  I can't access it right now because of issues at my end
> though.

Thanks for the heads up.

> 
> > The goal was to create a roadmap for those new to Ada learn more
> > quickly and gain a certain level of mastery.
> 
> There's a Wikibook about Ada that I've been wanting to read:
> 
>   https://en.wikibooks.org/wiki/Subject:Ada_programming_language

I've seen that.  It's not bad.  I still think that many of the explanations can be better and having something that walks you through how to install the compiler as well as how to debug would be a major plus.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04  3:07   ` Andrew Shvets
@ 2017-01-04  6:46     ` J-P. Rosen
  2017-01-04  9:25       ` raph.amiard
  0 siblings, 1 reply; 38+ messages in thread
From: J-P. Rosen @ 2017-01-04  6:46 UTC (permalink / raw)


Le 04/01/2017 à 04:07, Andrew Shvets a écrit :
>> I thought the following were good, though not complete:
>> 
>> * http://cowlark.com/2014-04-27-ada/index.html
>> 
> I have to admit, this is the first time seeing this page.  It looks
> good.  I still think that when it comes to best teaching Ada to
> newcomers, the more advanced typing information should be reserved
> for later on (if you know nothing about it, this is very confusing
> and unclear.)

Nice in its presentation and intent, but unfortunately carries a lot of
inexact stuff. Maybe the community could help (politely) the guy...


-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04  6:46     ` J-P. Rosen
@ 2017-01-04  9:25       ` raph.amiard
  2017-01-04 12:40         ` J-P. Rosen
  0 siblings, 1 reply; 38+ messages in thread
From: raph.amiard @ 2017-01-04  9:25 UTC (permalink / raw)



> Nice in its presentation and intent, but unfortunately carries a lot of
> inexact stuff. Maybe the community could help (politely) the guy...

I read it some time ago, but I didn't find a lot of inexact stuff. Would you mind giving more details ?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04  9:25       ` raph.amiard
@ 2017-01-04 12:40         ` J-P. Rosen
  2017-01-04 12:49           ` Dmitry A. Kazakov
  2017-01-04 13:44           ` raph.amiard
  0 siblings, 2 replies; 38+ messages in thread
From: J-P. Rosen @ 2017-01-04 12:40 UTC (permalink / raw)


Le 04/01/2017 à 10:25, raph.amiard@gmail.com a écrit :
> 
>> Nice in its presentation and intent, but unfortunately carries a
>> lot of inexact stuff. Maybe the community could help (politely) the
>> guy...
> 
> I read it some time ago, but I didn't find a lot of inexact stuff.
> Would you mind giving more details ?
> 
Some excerpts:

  exit when (a == 0)

Switch statements must cover all possible input values --- for unbounded
types like integers, a when others is mandatory.

Oddly, variables are not initialised by default
(Personal opinion: default initialization is a huge mistake)

Ada is, alas, a one-pass language, so things need to be prototyped if
you're going to refer to them before they're defined.

Plus you can omit the parentheses when calling zero-argument functions
and procedures;
(You must!)

type Vector is array(integer range<>) of float;
These are a little bit deceptive. They don't represent an array which
can change in size; they represent an array whose size is not known by
the type system. They're implemented via a combination of fat pointers
and fixed-size arrays, depending on context. They can be used as a
shortcut in declaring variables, but they're mostly useful as parameters.

----------
etc...
Often not really wrong, but imprecise or incorrect

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 12:40         ` J-P. Rosen
@ 2017-01-04 12:49           ` Dmitry A. Kazakov
  2017-01-04 13:45             ` raph.amiard
  2017-01-04 13:44           ` raph.amiard
  1 sibling, 1 reply; 38+ messages in thread
From: Dmitry A. Kazakov @ 2017-01-04 12:49 UTC (permalink / raw)


On 2017-01-04 13:40, J-P. Rosen wrote:

> Oddly, variables are not initialised by default
> (Personal opinion: default initialization is a huge mistake)

Right, but Ada is still wrong there. IMO it should have been:

declare
    I : Integer := 1; -- OK
    J : Integer; -- Error: not initialized
    K : Integer := <>; -- OK: uninitialized, I know what I am doing

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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 12:40         ` J-P. Rosen
  2017-01-04 12:49           ` Dmitry A. Kazakov
@ 2017-01-04 13:44           ` raph.amiard
  2017-01-04 22:08             ` Jeffrey R. Carter
                               ` (3 more replies)
  1 sibling, 4 replies; 38+ messages in thread
From: raph.amiard @ 2017-01-04 13:44 UTC (permalink / raw)


I'm in contact with the author so I'll pass any fixes up to him if you don't mind

>   exit when (a == 0)

> Switch statements must cover all possible input values --- for unbounded
> types like integers, a when others is mandatory.

I imagine you refer to the use of "unbounded" when refering to the integer type ?

> Oddly, variables are not initialised by default
> (Personal opinion: default initialization is a huge mistake)

Ok but, besides the "oddly" qualifier, his statement is correct, right ?

> 
> Ada is, alas, a one-pass language, so things need to be prototyped if
> you're going to refer to them before they're defined.

This is generally true, and the areas of the language where it's not (aspects) are full of gotchas. While it's not always true, my feeling is that there *was* a strong push to keep Ada compilable by a one pass compiler (which GNAT is, in broad strokes).

> 
> Plus you can omit the parentheses when calling zero-argument functions
> and procedures;
> (You must!)

Ok

> 
> type Vector is array(integer range<>) of float;
> These are a little bit deceptive. They don't represent an array which
> can change in size; they represent an array whose size is not known by
> the type system. They're implemented via a combination of fat pointers
> and fixed-size arrays, depending on context. They can be used as a
> shortcut in declaring variables, but they're mostly useful as parameters.

I'm not sure what is incorrect here.

> Often not really wrong, but imprecise or incorrect

Imprecise strikes me as completely OK for such a post. Incorrect is another matter, hence my original question :)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 12:49           ` Dmitry A. Kazakov
@ 2017-01-04 13:45             ` raph.amiard
  2017-01-04 14:14               ` Dmitry A. Kazakov
  2017-01-04 15:18               ` Shark8
  0 siblings, 2 replies; 38+ messages in thread
From: raph.amiard @ 2017-01-04 13:45 UTC (permalink / raw)


Le mercredi 4 janvier 2017 13:49:18 UTC+1, Dmitry A. Kazakov a écrit :
> On 2017-01-04 13:40, J-P. Rosen wrote:
> 
> > Oddly, variables are not initialised by default
> > (Personal opinion: default initialization is a huge mistake)
> 
> Right, but Ada is still wrong there. IMO it should have been:
> 
> declare
>     I : Integer := 1; -- OK
>     J : Integer; -- Error: not initialized
>     K : Integer := <>; -- OK: uninitialized, I know what I am doing
> 

Or do it Swift's way and use flow analysis to make use of an uninitialized variable a compile time error. Meh. I guess it's complicated enough as it is to implement an Ada compiler :)


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 13:45             ` raph.amiard
@ 2017-01-04 14:14               ` Dmitry A. Kazakov
  2017-01-04 15:15                 ` Simon Wright
  2017-01-10 10:02                 ` raph.amiard
  2017-01-04 15:18               ` Shark8
  1 sibling, 2 replies; 38+ messages in thread
From: Dmitry A. Kazakov @ 2017-01-04 14:14 UTC (permalink / raw)


On 2017-01-04 14:45, raph.amiard@gmail.com wrote:

> Or do it Swift's way and use flow analysis to make use of an
> uninitialized variable a compile time error.

That is a bad idea. If uninitialized variable is an error then that must 
make the program illegal. If the program is still legal, then it is not 
an error.

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

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 14:14               ` Dmitry A. Kazakov
@ 2017-01-04 15:15                 ` Simon Wright
  2017-01-10 10:02                 ` raph.amiard
  1 sibling, 0 replies; 38+ messages in thread
From: Simon Wright @ 2017-01-04 15:15 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On 2017-01-04 14:45, raph.amiard@gmail.com wrote:
>
>> Or do it Swift's way and use flow analysis to make use of an
>> uninitialized variable a compile time error.
>
> That is a bad idea. If uninitialized variable is an error then that
> must make the program illegal. If the program is still legal, then it
> is not an error.

Swift's way appears to be that *using* an uninitialized variable is an
error (provided that the compiler can detect it, of course).

GNAT has warnings about possible UBI, I think. And SPARK makes it an
error.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 13:45             ` raph.amiard
  2017-01-04 14:14               ` Dmitry A. Kazakov
@ 2017-01-04 15:18               ` Shark8
  2017-01-04 21:47                 ` Randy Brukardt
  1 sibling, 1 reply; 38+ messages in thread
From: Shark8 @ 2017-01-04 15:18 UTC (permalink / raw)


On Wednesday, January 4, 2017 at 6:45:29 AM UTC-7, raph....@gmail.com wrote:
> Le mercredi 4 janvier 2017 13:49:18 UTC+1, Dmitry A. Kazakov a écrit :
> > On 2017-01-04 13:40, J-P. Rosen wrote:
> > 
> > > Oddly, variables are not initialised by default
> > > (Personal opinion: default initialization is a huge mistake)
> > 
> > Right, but Ada is still wrong there. IMO it should have been:
> > 
> > declare
> >     I : Integer := 1; -- OK
> >     J : Integer; -- Error: not initialized
> >     K : Integer := <>; -- OK: uninitialized, I know what I am doing
> > 
> 
> Or do it Swift's way and use flow analysis to make use of an uninitialized variable a compile time error. Meh. I guess it's complicated enough as it is to implement an Ada compiler :)

Well, there are certain times where you *want*/*need* non-initialized variables; it's usually at [operating] system-level, but it does exist. (A good example would me memory-mapped I/O ports, where your 'initialization' would automatically send something down the I/O port when you might need to send nothing.)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 15:18               ` Shark8
@ 2017-01-04 21:47                 ` Randy Brukardt
  2017-01-05  3:04                   ` Shark8
  0 siblings, 1 reply; 38+ messages in thread
From: Randy Brukardt @ 2017-01-04 21:47 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2286 bytes --]

"Shark8" <onewingedshark@gmail.com> wrote in message 
news:4c5dfbe4-7987-48d4-8afc-817a8c134095@googlegroups.com...
On Wednesday, January 4, 2017 at 6:45:29 AM UTC-7, raph....@gmail.com wrote:
> Le mercredi 4 janvier 2017 13:49:18 UTC+1, Dmitry A. Kazakov a écrit :
>> >
>> > declare
>> >     I : Integer := 1; -- OK
>> >     J : Integer; -- Error: not initialized
>> >     K : Integer := <>; -- OK: uninitialized, I know what I am doing
>> >
>>
>> Or do it Swift's way and use flow analysis to make use of an 
>> uninitialized variable
>> a compile time error. Meh. I guess it's complicated enough as it is to 
>> implement
>> an Ada compiler :)
>
>Well, there are certain times where you *want*/*need* non-initialized 
>variables;
> it's usually at [operating] system-level, but it does exist. (A good 
> example would
> me memory-mapped I/O ports, where your 'initialization' would 
> automatically
> send something down the I/O port when you might need to send nothing.)

Right. It also might happen if the initialization is very complex and 
interrelated with initializing other variables. Forcing an initialization 
just to make the compiler happy would be confusing and potentially expensive 
(if the item is large).

I agree with Dmitry. Indeed, I tried hard in Ada 2005 to get (<>) to be an 
aggregate usable to default initialize for any type, with the intent to 
combine that with a restriction to essentially allow projects to change Ada 
to the rule Dmitry suggested. Unfortunately, various technical issues with 
private types made that much harder than originally thought, and the idea 
was dropped late in the Ada 2005 work.

The problem with requiring flow analysis in a language rule is that it 
requires lengthy specifications of exactly what flow analysis is required 
for this check, assuming that portability between implementations is 
important (and that surely is for Ada). Every compiler does some flow 
analysis, but each it likely to do it differently, in different compiler 
phases, and having program legality be implementation-defined in that way is 
a guaranteed way to have code that cannot be moved to a different 
implementation. (Exception contracts have a similar problem.)

                                         Randy.

The problem with using 


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 13:44           ` raph.amiard
@ 2017-01-04 22:08             ` Jeffrey R. Carter
  2017-01-04 22:39             ` Niklas Holsti
                               ` (2 subsequent siblings)
  3 siblings, 0 replies; 38+ messages in thread
From: Jeffrey R. Carter @ 2017-01-04 22:08 UTC (permalink / raw)


On 01/04/2017 02:44 PM, raph.amiard@gmail.com wrote:
>>
>> type Vector is array(integer range<>) of float;
>> These are a little bit deceptive. They don't represent an array which
>> can change in size; they represent an array whose size is not known by
>> the type system. They're implemented via a combination of fat pointers
>> and fixed-size arrays, depending on context. They can be used as a
>> shortcut in declaring variables, but they're mostly useful as parameters.
>
> I'm not sure what is incorrect here.

"They're implemented via a combination of fat pointers and fixed-size arrays" is 
wrong. It's not clear what "They" refers to; it seems to refer to the type, but 
types aren't implemented, so it probably refers to objects of the type. But such 
objects are not "implemented via a combination of fat pointers [which don't 
exist in Ada] and fixed-size arrays".

Also, "they're mostly useful as parameters" would seem to imply that type String 
is not very useful except as parameters, which is certainly not my experience.

-- 
Jeff Carter
"Why, the Mayflower was full of Fireflies, and a few
horseflies, too. The Fireflies were on the upper deck,
and the horseflies were on the Fireflies."
Duck Soup
95

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 13:44           ` raph.amiard
  2017-01-04 22:08             ` Jeffrey R. Carter
@ 2017-01-04 22:39             ` Niklas Holsti
  2017-01-05  0:38               ` G.B.
  2017-01-05 23:52               ` Randy Brukardt
  2017-01-05  6:36             ` J-P. Rosen
  2017-01-09 22:01             ` Robert Eachus
  3 siblings, 2 replies; 38+ messages in thread
From: Niklas Holsti @ 2017-01-04 22:39 UTC (permalink / raw)


On 17-01-04 15:44 , raph.amiard@gmail.com wrote:
> I'm in contact with the author so I'll pass any fixes up to him if you don't mind
>
>>   exit when (a == 0)
>
>> Switch statements must cover all possible input values --- for unbounded
>> types like integers, a when others is mandatory.
>
> I imagine you refer to the use of "unbounded" when refering to the integer type ?

That term is one nit that could be picked, but more specifically, it is 
quite possible to write "case" statements using an integer type without 
an "others" clause. Very recently, I had occasion to write code like this:

    X : Int_Type := ...
    ...
    case X is
    when Int_Type_T'First .. -1 => ...;
    when 0                      => ...;
    when 1 .. Int_Type'Last     => ...;
    end case;

>> Oddly, variables are not initialised by default
>> (Personal opinion: default initialization is a huge mistake)
>
> Ok but, besides the "oddly" qualifier, his statement is correct, right ?

Except for variables of an access type, or (but perhaps this is not "by 
default" in his view) of a record type where the components are given 
initial default values.

Requiring default initialisation of all variables, even unused ones, 
would have a large cost in execution time of any subprogram that uses a 
local array variable as a buffer for some data. In a 
resource-constrained real-time application that could be nasty. (For 
such code, I have once or twice argued with PA/QA people who see a 
coding rule that says "all variables must be initilised before use" and 
who think that "X := value" is a "use" of X :-) ).

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
                   ` (5 preceding siblings ...)
  2017-01-04  1:14 ` Paul Rubin
@ 2017-01-04 23:42 ` Andrew Shvets
  2017-01-05  0:47   ` G.B.
  2017-01-05 19:01   ` Jacob Sparre Andersen
  6 siblings, 2 replies; 38+ messages in thread
From: Andrew Shvets @ 2017-01-04 23:42 UTC (permalink / raw)


I do have one question.  In the book, I mentioned contracts only very briefly.  I figured that this is a more complex and only gave it a more passing mention.

How often do you use contracts with Ada?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 22:39             ` Niklas Holsti
@ 2017-01-05  0:38               ` G.B.
  2017-01-05 23:52               ` Randy Brukardt
  1 sibling, 0 replies; 38+ messages in thread
From: G.B. @ 2017-01-05  0:38 UTC (permalink / raw)


On 04.01.17 23:39, Niklas Holsti wrote:
>
> That term is one nit that could be picked, but more specifically, it is quite possible to write "case" statements using an integer type without an "others" clause. Very recently, I had occasion to write code like this:
>
>    X : Int_Type := ...
>    ...
>    case X is
>    when Int_Type_T'First .. -1 => ...;
>    when 0                      => ...;
>    when 1 .. Int_Type'Last     => ...;
>    end case;


Interestingly, not so recent versions of Swift will
allow writing range
   0...Int.max
but will not make this range work. Ranges are "rewritten"
from a...b to a..<(b+1). Consequently, the upper bound Int.max
would have to be (Int.max+1), a value exceeding all of type Int.

So, while it was possible to write case distinctions
Ada style in Swift, the equivalent of Ada's Int_Type'Last
has then caused issues.


-- 
"HOTDOGS ARE NOT BOOKMARKS"
Springfield Elementary teaching staff

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 23:42 ` Andrew Shvets
@ 2017-01-05  0:47   ` G.B.
  2017-01-05 19:01   ` Jacob Sparre Andersen
  1 sibling, 0 replies; 38+ messages in thread
From: G.B. @ 2017-01-05  0:47 UTC (permalink / raw)


On 05.01.17 00:42, Andrew Shvets wrote:
> I do have one question.  In the book, I mentioned contracts only very briefly.  I figured that this is a more complex and only gave it a more passing mention.
>
> How often do you use contracts with Ada?

There may be a number of misunderstandings of contract
based design, so given it is still early for adopting contracts,
there is guidance: Meyer writes about meanings and uses
of "contracts", in OOSC2. SPARK is hard to imagine without
assertions, but these are meant to be statements of truth
to be demonstrated before anything is released, and in
particular before run-time. Whereas Ada's assert-like aspects
are illustrated in the latest edition of the Ada Rationale,
including how they are related to development, to debugging,
and to run-time.

-- 
"HOTDOGS ARE NOT BOOKMARKS"
Springfield Elementary teaching staff

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 21:47                 ` Randy Brukardt
@ 2017-01-05  3:04                   ` Shark8
  2017-01-05  7:51                     ` G.B.
  0 siblings, 1 reply; 38+ messages in thread
From: Shark8 @ 2017-01-05  3:04 UTC (permalink / raw)


On Wednesday, January 4, 2017 at 2:47:05 PM UTC-7, Randy Brukardt wrote:
> "Shark8" wrote in message 
>
> On Wednesday, January 4, 2017 at 6:45:29 AM UTC-7, raph....@gmail.com wrote:
> > Le mercredi 4 janvier 2017 13:49:18 UTC+1, Dmitry A. Kazakov a écrit :
> >> >
> >> > declare
> >> >     I : Integer := 1; -- OK
> >> >     J : Integer; -- Error: not initialized
> >> >     K : Integer := <>; -- OK: uninitialized, I know what I am doing
> >> >
> >>
> >> Or do it Swift's way and use flow analysis to make use of an 
> >> uninitialized variable
> >> a compile time error. Meh. I guess it's complicated enough as it is to 
> >> implement
> >> an Ada compiler :)
> >
> >Well, there are certain times where you *want*/*need* non-initialized 
> >variables;
> > it's usually at [operating] system-level, but it does exist. (A good 
> > example would
> > me memory-mapped I/O ports, where your 'initialization' would 
> > automatically
> > send something down the I/O port when you might need to send nothing.)
> 
> Right. It also might happen if the initialization is very complex and 
> interrelated with initializing other variables. Forcing an initialization 
> just to make the compiler happy would be confusing and potentially expensive 
> (if the item is large).
> 
> I agree with Dmitry. Indeed, I tried hard in Ada 2005 to get (<>) to be an 
> aggregate usable to default initialize for any type, with the intent to 
> combine that with a restriction to essentially allow projects to change Ada 
> to the rule Dmitry suggested. Unfortunately, various technical issues with 
> private types made that much harder than originally thought, and the idea 
> was dropped late in the Ada 2005 work.
> 
> The problem with requiring flow analysis in a language rule is that it 
> requires lengthy specifications of exactly what flow analysis is required 
> for this check, assuming that portability between implementations is 
> important (and that surely is for Ada). Every compiler does some flow 
> analysis, but each it likely to do it differently, in different compiler 
> phases, and having program legality be implementation-defined in that way is 
> a guaranteed way to have code that cannot be moved to a different 
> implementation. (Exception contracts have a similar problem.)
> 
>                                          Randy.

Thank you for the explanation/info -- it's really good.
(I hope we *can* get exception contracts.)


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 13:44           ` raph.amiard
  2017-01-04 22:08             ` Jeffrey R. Carter
  2017-01-04 22:39             ` Niklas Holsti
@ 2017-01-05  6:36             ` J-P. Rosen
  2017-01-05  8:38               ` Simon Wright
  2017-01-10 10:13               ` raph.amiard
  2017-01-09 22:01             ` Robert Eachus
  3 siblings, 2 replies; 38+ messages in thread
From: J-P. Rosen @ 2017-01-05  6:36 UTC (permalink / raw)


Le 04/01/2017 à 14:44, raph.amiard@gmail.com a écrit :
> I'm in contact with the author so I'll pass any fixes up to him if you don't mind
Well, I suggested help from the community at large because currently I
don't have the time to make an extensive review. Otherwise, I'd write to
him myself...

Some have already responded; my $0.02

>> Oddly, variables are not initialised by default
>> (Personal opinion: default initialization is a huge mistake)
> 
> Ok but, besides the "oddly" qualifier, his statement is correct, right ?
> 
Asking for automatic initialization comes generally from people using
the C like languages, who automatically think of 0 as the initial value.
A truely magical value, meaning number 0, false, string termination,
etc. It makes no sense for Ada, where types may not include 0 as an
allowed value. You can even have types with no value at all; what would
the initial value be?

But the issue is worth than that. A program that does not initialize a
variable before using it has a bug. If the program works because the
compiler provided a default value that happened to have an appropriate
value, it's a buggy program that works by chance. In the safety critical
world, we don't want programs that work by chance; we want programs
without bugs. That's why the only acceptable initial value is an invalid
value (as provided by Initialize_Scalars), because it maximizes the
probability of catching the bug early.

>> Ada is, alas, a one-pass language, so things need to be prototyped if
>> you're going to refer to them before they're defined.
> 
> This is generally true, and the areas of the language where it's not
(aspects) are full of gotchas. While it's not always true, my feeling is
that there *was* a strong push to keep Ada compilable by a one pass
compiler (which GNAT is, in broad strokes).
> 
I don't think that one pass was ever a requirement for Ada. Claiming
that some things are "unfortunately" the way they are to make compilers
naively simpler sends a wrong message, and is unfair to the huge work
performed by compilers.


-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-05  3:04                   ` Shark8
@ 2017-01-05  7:51                     ` G.B.
  0 siblings, 0 replies; 38+ messages in thread
From: G.B. @ 2017-01-05  7:51 UTC (permalink / raw)


On 05.01.17 04:04, Shark8 wrote:
> (I hope we *can* get exception contracts.)

(Just not tied to aspects of contracts, please, since the falsity
of an aspect and the more general feature of a callable
entity raising an exception are related only accidentally.)

-- 
"HOTDOGS ARE NOT BOOKMARKS"
Springfield Elementary teaching staff

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-05  6:36             ` J-P. Rosen
@ 2017-01-05  8:38               ` Simon Wright
  2017-01-10 10:13               ` raph.amiard
  1 sibling, 0 replies; 38+ messages in thread
From: Simon Wright @ 2017-01-05  8:38 UTC (permalink / raw)


"J-P. Rosen" <rosen@adalog.fr> writes:

> A program that does not initialize a variable before using it has a
> bug. If the program works because the compiler provided a default
> value that happened to have an appropriate value, it's a buggy program
> that works by chance.

We had a program that was developed under Windows; when we transterred
it to the VxWorks target, it fell in a tangled heap.

This was because, on Windows, 'new' using the default storage pool
returned zero-filled memory, while under VxWorks (5.3) the memory was
uninitialized. We changed to a storage pool that filled allocated memory
with 16#deadbeef#.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 23:42 ` Andrew Shvets
  2017-01-05  0:47   ` G.B.
@ 2017-01-05 19:01   ` Jacob Sparre Andersen
  1 sibling, 0 replies; 38+ messages in thread
From: Jacob Sparre Andersen @ 2017-01-05 19:01 UTC (permalink / raw)


Andrew Shvets <andrew.shvets@gmail.com> writes:

> How often do you use contracts with Ada?

Practically every time I declare a new (sub)type or subprogram in an Ada
2012 project.

Greetings,

Jacob
-- 
Those who can't laugh at themselves leave the job to others.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 22:39             ` Niklas Holsti
  2017-01-05  0:38               ` G.B.
@ 2017-01-05 23:52               ` Randy Brukardt
  1 sibling, 0 replies; 38+ messages in thread
From: Randy Brukardt @ 2017-01-05 23:52 UTC (permalink / raw)


"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
news:ed5bslF2432U1@mid.individual.net...
> On 17-01-04 15:44 , raph.amiard@gmail.com wrote:
...
>>> Oddly, variables are not initialised by default
>>> (Personal opinion: default initialization is a huge mistake)
>>
>> Ok but, besides the "oddly" qualifier, his statement is correct, right ?
>
> Except for variables of an access type, or (but perhaps this is not "by 
> default" in his view) of a record type where the components are given 
> initial default values.

And any type has that aspect Default_Value or Default_Component_Value 
specified (in Ada 2012). Effectively, you can program with all objects 
default initialized if you want that bad enough (although it isn't possible 
with some predefined types, like String).

                                 Randy.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 13:44           ` raph.amiard
                               ` (2 preceding siblings ...)
  2017-01-05  6:36             ` J-P. Rosen
@ 2017-01-09 22:01             ` Robert Eachus
  3 siblings, 0 replies; 38+ messages in thread
From: Robert Eachus @ 2017-01-09 22:01 UTC (permalink / raw)


On Wednesday, January 4, 2017 at 8:44:14 AM UTC-5, raph....@gmail.com wrote:
> I'm in contact with the author so I'll pass any fixes up to him if you don't mind
> 
> >   exit when (a == 0)

In Ada this should be:

      exit when a = 0;

The parentheses are allowed but not necessary, == is C not Ada, and exit is a statement that should be terminated by a semicolon.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-04 14:14               ` Dmitry A. Kazakov
  2017-01-04 15:15                 ` Simon Wright
@ 2017-01-10 10:02                 ` raph.amiard
  1 sibling, 0 replies; 38+ messages in thread
From: raph.amiard @ 2017-01-10 10:02 UTC (permalink / raw)


Le mercredi 4 janvier 2017 15:14:32 UTC+1, Dmitry A. Kazakov a écrit :
> That is a bad idea. If uninitialized variable is an error then that must 
> make the program illegal. If the program is still legal, then it is not 
> an error.

Yes. In swift a program with an uninitialized variable is a compile time error, *and* illegal.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: Introductory Ada Programming Book
  2017-01-05  6:36             ` J-P. Rosen
  2017-01-05  8:38               ` Simon Wright
@ 2017-01-10 10:13               ` raph.amiard
  1 sibling, 0 replies; 38+ messages in thread
From: raph.amiard @ 2017-01-10 10:13 UTC (permalink / raw)


Le jeudi 5 janvier 2017 07:36:53 UTC+1, J-P. Rosen a écrit :
> >> Ada is, alas, a one-pass language, so things need to be prototyped if
> >> you're going to refer to them before they're defined.
> > 
> > This is generally true, and the areas of the language where it's not
> (aspects) are full of gotchas. While it's not always true, my feeling is
> that there *was* a strong push to keep Ada compilable by a one pass
> compiler (which GNAT is, in broad strokes).
> > 
> I don't think that one pass was ever a requirement for Ada.

Ok, the fact remains that Ada today is compilable by a one pass compiler (proof: GNAT), which would not be possible if you added some features common in other languages. Just to be clear: I don't think it's a defect.

> Claiming
> that some things are "unfortunately" the way they are to make compilers
> naively simpler sends a wrong message, and is unfair to the huge work
> performed by compilers.

You're inferring 80% of the meaning from the author's original statement here. He did not write most of what you have written, except for "unfortunately", which is a user perspective. Users have the write to disagree with language design choices, luckily !

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2017-01-10 10:13 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-31 13:18 Introductory Ada Programming Book Andrew Shvets
2016-12-31 14:26 ` Lucretia
2016-12-31 15:10   ` Dmitry A. Kazakov
2016-12-31 17:14     ` Andrew Shvets
2016-12-31 14:28 ` Lucretia
2016-12-31 14:34 ` Lucretia
2016-12-31 17:22   ` Andrew Shvets
2016-12-31 17:59 ` Gour
2017-01-02 15:56   ` Andrew Shvets
2017-01-02 16:32     ` Gour
2017-01-03 15:31 ` Patrick Noffke
2017-01-03 22:18   ` Andrew Shvets
2017-01-04  1:14 ` Paul Rubin
2017-01-04  3:07   ` Andrew Shvets
2017-01-04  6:46     ` J-P. Rosen
2017-01-04  9:25       ` raph.amiard
2017-01-04 12:40         ` J-P. Rosen
2017-01-04 12:49           ` Dmitry A. Kazakov
2017-01-04 13:45             ` raph.amiard
2017-01-04 14:14               ` Dmitry A. Kazakov
2017-01-04 15:15                 ` Simon Wright
2017-01-10 10:02                 ` raph.amiard
2017-01-04 15:18               ` Shark8
2017-01-04 21:47                 ` Randy Brukardt
2017-01-05  3:04                   ` Shark8
2017-01-05  7:51                     ` G.B.
2017-01-04 13:44           ` raph.amiard
2017-01-04 22:08             ` Jeffrey R. Carter
2017-01-04 22:39             ` Niklas Holsti
2017-01-05  0:38               ` G.B.
2017-01-05 23:52               ` Randy Brukardt
2017-01-05  6:36             ` J-P. Rosen
2017-01-05  8:38               ` Simon Wright
2017-01-10 10:13               ` raph.amiard
2017-01-09 22:01             ` Robert Eachus
2017-01-04 23:42 ` Andrew Shvets
2017-01-05  0:47   ` G.B.
2017-01-05 19:01   ` Jacob Sparre Andersen

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