Re: += in ada

From: Vinzent 'Gadget' Hoefler (ada.rocks_at_jlfencey.com)
Date: 10/15/03


Date: Wed, 15 Oct 2003 20:06:39 +0200

Hyman Rosen wrote:

>Vinzent 'Gadget' Hoefler wrote:
>> So, what's your point? ;-) That it is not "built-in"?
>
>My point is that "augmented assignment" is a very old
>feature of programming languages.

And my point is that Ada already has it.

It just calls it "procedure". :)

>In fact, it's a basic
>feature of computers, since most of them have machine
>instructions which add one thing to another.

You heard about "abstraction"? Ada is a high level *language*, not a
high level assembler.

The idea was to let the programmer say what it wants and let the
compiler figure out how to map that onto the target hardware, not the
C-way: figuring out how to express what we want in such a way that
most machines might understand it. Ada is even better: It still left
the option open to get down to the bare metal of the machine if this
is needed. Target hardware (do you remember the PDP-7? - I don't.)
becomes obsolete some times. :)

<flame target="interested audience" level="explicit">

Why doesn't know C *** about interrupts? Or port I/O? Or ring buffer
data structures? So basic features of some CPUs... oh well, perhaps
not at the time they designed C, I know. Bad luck if you want to do
that. But hey, it must be fucking cool, you still have
<voice mode="pissed off">'augmented assignment'</voice>.

Oh well, that's surely a pretty nifty feature you really need, just
because you can save so much time when typing it (and IMVHO: *that* is
the only true and valid argument).

</flame>

And BTW, it's a funny thing that the compiler might compile

|a += 2;

to

| movl a,%eax
| addl $2,%eax
| movl %eax,a

instead of

| addl $2,a

, isn't it? ;-P

Vinzent.

-- 
Parents strongly cautioned  --  this  posting  is  intended for mature
audiences  over  18.  It  may  contain some material that many parents
would not find suitable for children and may include intense violence,
sexual situations, coarse language and suggestive dialogue.

Quantcast