Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:49:28+00:00 2026-06-17T20:49:28+00:00

I’m wondering why there are no operators like += , -= , ++ ,

  • 0

I’m wondering why there are no operators like +=, -=, ++, -=, <<= or x ? y : z (not an augmented assignment …) in Ada? Many other languages (C, C++, C#, Java, Perl) have them.

— Example (C/C++/…):

int a = 3;

a += 4; /* A */
// long: a = a + 4

a++; /* B */
// long: a = a + 1

a = ( a > 3 ? 10 : 5 ); /* C */
// long: ' if a > 3 then a = 10 else a = 5'

— Example (Ada):

a : integer := 3;

a := a + 4;   -- A --
a := a + 1;   -- B --

if a > 3 then -- C --
    a := 10;
else
    a := 5;
end if;

( Example doesn’t make sense – only for demonstration )

Is it because …

  • Operator-overloading (but C++ has such a mechanism too)?
  • Readability?
  • Technical reasons / limitations?
  • It’s only a trick for making those expressions shorter and not really required for programming?
  • The assignment operator in Ada is := and not = (so += -> +=:)?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:49:29+00:00Added an answer on June 17, 2026 at 8:49 pm

    Because the design of Ada was taken much more closely from mathematics than some other languages… And so…

    Assignment is not an operator

    Operators have specific properties – they operate on quantities returning a result – while leaving the quantities themselves unchanged.

    This is important – stick rigorously to this understanding of an “operator” and you make a lot of optimisations possible because the semantics are much more predictable. Essentially, operators don’t have side effects. You can repeat them or factor out repeated ones, and you have a lot more freedom to reorder expressions without changing their results.

    If you mistake assignment for an operator, … well, basically you’re screwed.
    Just ONE “operator” with side effects means you lose valuable properties for ALL operators … for what? some notational convenience, a hugely fertile breeding ground for bugs, and no extra performance or efficiency.

    Incidentally when I had to poke around inside GCC recently I found a function in its expression analyser that explicitly broke (intermediate representation for) a++ and transformed it internally into (intermediate representation for) a = a + 1; So the shorter form really doesn’t appear to be any more efficient!

    The same rationale applies (less strictly in Ada than VHDL) to functions – they are just operators in another guise, and pure functions (in VHDL that’s every function without the word “impure” in its declaration!) don’t have side effects.

    Which is also why Ada has both functions and procedures : functions, operators and expressions are essentially similar (and ideally, stateless and side-effect free); procedures, assignments and statements are a separate category (procedure calls and assignments are forms of statement).

    Separating the concepts and using the appropriate one for each task goes a long way to making clear programs that you can understand and probably do what you intended…

    Oh and Ada-2012 has finally caught up with VHDL-2008 and Algol-W (1963) with if- and case-expressions…

    a := (if a > 3 then 10 else 5);
    -- to my eyes MUCH more readable than ?: especially in multiple if-exprs!
    
    b := (case a is 
          when 3 => 5;
          when 6|7 => 10;
          when others => 0);
    

    It is obvious that the assignments here are still statements…

    Just to make sure:

    Assignment is not an operator

    Ada’s designers had an impressive and usually VERY clear grasp of what was possible without compromising integrity and what would just lead to a mess. While newer language features have been added, as compiler techniques developed enough to make them reliable, it has always been a cautious process and the Ada-83 subset is still there virtually intact.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have been unable to fix a problem with Java Unicode and encoding. The
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.