From: Robert A Duff on
"Dmitry A. Kazakov" <mailbox(a)dmitry-kazakov.de> writes:

> P.S. ":=" for initialization of limited objects might look misleading (and
> does look misleading to me), but that would be another discussion on Ada
> design, in which nobody would agree with me. So I prefer not to go into it.

Well, I would agree.

Ada uses the term "assignment" to refer to both "initial assignment /
initialization" and "assignment_statement / overwriting".
I'd prefer to use different symbols for the two.
We're not going to change Ada in that regard, for compatibility reasons,
but I'm thinking in my hobby language design to use the term "assignment"
for the initial one, and "reassignment" for the subsequent overwriting
one, and use different symbols for the two.

So, for a limited type, "assignment" is legal, "reassignment" is not.

What do you think?

- Bob
From: stefan-lucks on
On Sun, 22 Nov 2009, Robert A Duff wrote:

> Ada uses the term "assignment" to refer to both "initial assignment /
> initialization" and "assignment_statement / overwriting".
> I'd prefer to use different symbols for the two.
> We're not going to change Ada in that regard, for compatibility reasons,
> but I'm thinking in my hobby language design to use the term "assignment"
> for the initial one, and "reassignment" for the subsequent overwriting
> one, and use different symbols for the two.
>
> So, for a limited type, "assignment" is legal, "reassignment" is not.

Distinguishing the two different operations which are written as ":=" in
Ada by using different words and even different symbols would make a lot of
sense.

But it is quite a standard notion to write "assignment" for overwriting
the current value of a variable by a new value. This notion is widely
used, much beyond Ada. You would likely confuse people by calling that
operation a "reassignment" and using "assignment" for anther kind of
operation. Please don't do that!

Better use "assignment" for the overwriting operation, and another word
(such as "initial assignment", "constructive assignment", "inisignment",
.... a native English speaker might find better words) for the type of
assignment that does not overwrite an existing value, and which is allowed
for limited types.

So long

--
------ Stefan Lucks -- Bauhaus-University Weimar -- Germany ------
Stefan dot Lucks at uni minus weimar dot de
------ I love the taste of Cryptanalysis in the morning! ------

From: Georg Bauhaus on
On 11/22/09 7:03 PM, xorque wrote:
> On Nov 22, 5:41 pm, "Dmitry A. Kazakov"<mail...(a)dmitry-kazakov.de>
> wrote:
>> On Sun, 22 Nov 2009 08:52:05 -0800 (PST), xorque wrote:
>>
>>> I have to admit to not understanding that error.
>>
>> And I don't understand your design. If Archive is a Stream derive then it
>> from Root_Stream_Type. If it deals with a stream then pass
>> Root_Stream_Type'Class to the operations that need it.
>
> The design is both irrelevant and obsolete. I'm just trying to find
> out if
> the problem is *definitely* that code so that I can close a bug in the
> GCC tracker.

A seg fault is definitely not the answer I would expect
from an Ada program that was compiled by GNAT in Ada mode.
Even when a temporary is involved in dereferencing.

Also, there are some of the "usual suspects" in the code,
like others =>, return ... do ... end. No reason to
close the report, I think.


From: Georg Bauhaus on
On 11/23/09 8:48 AM, I wrote:

> Also, there are some of the "usual suspects" in the code,
> like others =>, return ... do ... end. No reason to
others => {box}
Thunderbird post-Shredder still early release makes
Character'Val(60) & Character'Val(62)
vanish, sorry.
> close the report, I think.
>
>

From: Dmitry A. Kazakov on
On Sun, 22 Nov 2009 16:47:21 -0500, Robert A Duff wrote:

> "Dmitry A. Kazakov" <mailbox(a)dmitry-kazakov.de> writes:
>
>> P.S. ":=" for initialization of limited objects might look misleading (and
>> does look misleading to me), but that would be another discussion on Ada
>> design, in which nobody would agree with me. So I prefer not to go into it.
>
> Well, I would agree.
>
> Ada uses the term "assignment" to refer to both "initial assignment /
> initialization" and "assignment_statement / overwriting".
> I'd prefer to use different symbols for the two.
> We're not going to change Ada in that regard, for compatibility reasons,
> but I'm thinking in my hobby language design to use the term "assignment"
> for the initial one, and "reassignment" for the subsequent overwriting
> one, and use different symbols for the two.
>
> So, for a limited type, "assignment" is legal, "reassignment" is not.
>
> What do you think?

I would prefer conventional:

allocation
construction (initialization)
assignment
destruction (finalization)
deallocation

Semantically a limited object is never assigned. Its state comes into
existence per construction and disappears per destruction.

The word assignment for most people is associated with state change,
assuming that there was some state before. So

X : T := F (Y);

looks equivalent to

X : T;
begin
X := F (Y);

But they are not. I would prefer proper constructors, e.g.

X : T (Y); -- Y is a constraint of T, parameter of the constructor

I don't like functions returning limited objects.

But there also are two other forms of standard assignments. Depending on
whether the left part is available:

procedure ":=" (Left : in out T; Right : T);

and

function ":=" (Right : T) return T;

Ada uses the second form, but obviously there are important cases where the
first form is preferable (and conversely).

And further, there are three variants per each concerning dispatch:

procedure ":=" (Left : in out T; Right : T); -- Full MD
procedure ":=" (Left : in out T; Right : T'Class); -- Target-controlled
procedure ":=" (Left : in out T'Class; Right : T); -- Source-controlled

It would be difficult to sort this out! (:-))

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de