What is the point of renaming Types in Ada -


In Ada, I have usually seen something like this:
  Type number is a new integer;   

What does this mean? Can not you be happy with a integer ? I have also seen the code like:

  type Small_Number category 1..5;   

It makes sense to me; I can see why it will be useful, but why do you choose to use pre-instances in any case?

More commonly I have seen the code like this:

  Type pound Is a new integer; Type Euro is the new integer; Type dollar is a new integer;   

This means that you are not allocating your pounds for the dollar to the Euro for the accident.

If you want to convert between the two, then you have to either put a clear cast, or write a conversion routine, both will take the applicable exchange rate into account.

(Now I think about this, float would be better than integer for this example!)

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -