Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The attribute mechanism is something a lot of languages would benefit from. Need to know the maximum value of an integer? Just ask the integer type to tell you. No going to a library to look up inscrutable constants.


In Haskell, you have typeclass values. In other words, generic values.

    class Bounded a where
        minValue, maxValue :: a
So it is always the same constant, and it just changes value by what its type context is.


C++:

  numeric_limits<type>::max ()


Ada attribute provide a lot more meta information about types and objects than just integer limits.

http://en.wikibooks.org/wiki/Ada_Programming/Attributes

Some of these would be methods in modern OO languages but many are unique to Ada.


So does C++; both C++ and Ada have traits the other doesn't. Good ideas go around.


In C# you have Int32.MaxValue. I always assumed it was pretty standard everywhere.

Btw, Ada is on my list of languages to learn since 2011. I guess I will put it first on the 2015 good resolutions list :-)


When you get started, here are the two books that seem to get recommended the most frequently:

Ada as A Second Language: http://amzn.com/0070116075

Programming in Ada 2005: http://amzn.com/0321340787


Thanks, I didn't know the first book but the second one has a more recent version covering Ada 2012.


Interesting, I didn't realize there is a new edition:

Programming in Ada 2012 by John Barnes: http://amzn.com/110742481X

I wonder if ADA wouldn't be better if they were subtracting features rather than adding them.


I have an old copy of 'Ada as A Second Language'.

It's like a million pages. A second language handbook shouldn't be thicker than K&R. Do you know any short books that really assume I already know how to program?


I don't know of any short books on Ada. Given the language, and the fact it's still growing, I doubt there are any.


There is a Wikibook on Ada, although I cannot say anything about its quality.

Also, the Ada language standard and the rationale document are available for free. The standard is really more useful as a reference document, but it is surprisingly readable for a standards document.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: