> Thanks Tristan - I noticed this behaviour but forgot to comment on > it. For other interested parties, the relevant bit of the LRM is: [...] > Now, I can see the reasoning - without an explicit type-conversion > (using 'mod), it's more in the VHDL-like "fail as early as possible" > mindset. But perhaps without an explicit type-conversion you > shouldn't be allowed to assign an integer to a modular type, so it > should fail at compile-time? Ada is strongly typed as VHDL, so you cannot assign a signed integer to a modular integer without an explicit type-conversion. So indeed, such direct assignment is rejected at compile time. > I imagine you've written rather more Ada code than I have, so could > you elucidate a bit more on the problems the current Ada Behaviour > causes please? You mention it is "error-prone". What would your > preferred behaviour be - to fail at compile-time, or treat all > assignments as asking for a "wraparound", or something else > entirely? The issue is the behaviour of the type-conversion. When you use modular type (in Ada), you think that all operations wraps-around. That's true except for type conversion. If M is a modular type, M (Integer'(-1)) raise an error instead of returning M'Modulus - 1. I think this was a mistake (and I am not alone, see AI-00340 for opinions). Regards, Tristan. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Jun 26 10:06:22 2014
This archive was generated by hypermail 2.1.8 : Thu Jun 26 2014 - 10:06:55 PDT