comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.de>
Subject: Re: Rational for not making cursor tagged in Containers
Date: Sun, 22 Apr 2007 11:54:34 +0200
Date: 2007-04-22T11:54:35+02:00	[thread overview]
Message-ID: <1177235674.13243.48.camel@localhost.localdomain> (raw)
In-Reply-To: <f0b5o3$12a$1@jacob-sparre.dk>

On Fri, 2007-04-20 at 14:55 -0500, Randy Brukardt wrote: 
> "Georg Bauhaus" <bauhaus@futureapps.de> wrote in message
> news:1177097829.26685.36.camel@localhost.localdomain...
> ...
> > By analogy, and consistent with the desired record interfaces,
> > I will be asking for task type interfaces (no, not really).
> 
> Ada already has task interfaces, so you don't need to ask. ;-)

I meant something different (i.e. not synchronized interfaces),
based on my initial understanding that the concept of record
was to be changed, not that there be some publicly visible
syntactic sugar for read/write access to private components.

If the suggested "record interface" allows programmers to write
a subprogram that defines what R.A means, then the analog
*change* for task types will be "type T is interface task ...".
It will allow programmers to specify what "accessing"
The_T.A means, i.e. they not only write an acceptor A, but they
will also be writing what "accept" means. Only be default
will "accept" fall back to the LRM thing. :-)

Now the argument was that in a sense I can write "callable
components" of packages, of protected objects, of tasks, but
not of simple composite types. If this distinction seems
unwarranted, it is perhaps interesting to compare with
Eiffel counterparts. ECMA Eiffel defines Dmitry's suggestion
AFAICS. (I'll leave out the complication introduced by expanded
objects.) Access to a record component in Eiffel is either a
function or looks like a function, depending on how it is
defined. A client writing a record component in Eiffel will
always call a procedure of the record class, even when it
is written like assignment (":="), because the only way to modify
an object from the outside is to call a procedure. The function
will have an assigner command associated with it,

class FOO inherit FLOAT
feature
   get: INTEGER assign put is ...
   put (Value: INTEGER) is ...

Suppose Ada was to give up simple record component read/write
in favor of programmer defined subprograms implementing record
interfaces. There are cases when the translated code will have
to move memory words from here to their (as per LRM and reps.)
When this is to be done for an Eiffel record, then reportedly,
it always is tricky. Either the Eiffel literature 
suggest that the compiler has built in magic, or you revert
to the programmer's knowledge of how the Eiffel code is
translated to C and have him use this C knowledge to achieve the
desired effect (assignment) at the C level.



> Shouldn't it be possible
> to create a complete abstraction that works like the built-in ones?

Yes and No. I had (mis)understood that the built-in "abstractions"
like "record" should only default to built-in mechanics. The more basic
new "record interface" mechanism would in fact be less basic, because
programmers can write a subprogram for what .Integer_Component := 5;
will mean. If this were the only mechanism, wouldn't we soon be
entering an infinite loop of a missing basic assignment? For what
is the reason that I cannot make Integer assignment be an interface
;-) ;-)


> After all, it's not about the syntax:
> 
>    X := Y;
> 
> looks simple, but I've had to debug as much as 1K of machine code that
> actually implements it. There can be a lot of complexity hidden behind the
> two characters ":=". There is no reason to think that it would be a problem
> if '.' or '(' or '"' had similar complexity. (Indeed, there are cases where
> they do, you just can't write such cases yourself.)

Exactly, and I was trying to suggest that it might or might not
be a good idea to have the programmers write such cases, as they
will have to manage the complexity of assignment in a way that
is likely more complex than understanding ":=".
  But then, I think Dmitry is basically suggesting different
syntax, not a new record mechanism; after all, with tagged
records and Controlled components, the call side syntax is almost
part of Ada.





  reply	other threads:[~2007-04-22  9:54 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-19 16:05 Rational for not making cursor tagged in Containers Anh Vo
2007-04-19 18:25 ` Robert A Duff
2007-04-19 19:28   ` Anh Vo
2007-04-19 20:45     ` Robert A Duff
2007-04-19 21:43       ` Dmitry A. Kazakov
2007-04-19 23:59         ` Ray Blaak
2007-04-20  7:54           ` Dmitry A. Kazakov
2007-04-20 10:56             ` Georg Bauhaus
2007-04-20 10:39               ` Dmitry A. Kazakov
2007-04-20 14:42                 ` Georg Bauhaus
2007-04-20 14:45                   ` Georg Bauhaus
2007-04-20 15:13                   ` Dmitry A. Kazakov
2007-04-20 19:37                     ` Georg Bauhaus
2007-04-20 19:32                       ` Dmitry A. Kazakov
2007-04-20 20:59                         ` Robert A Duff
2007-04-20 22:14                           ` Dmitry A. Kazakov
2007-04-23 17:38                             ` Adam Beneschan
2007-04-23 19:18                               ` Dmitry A. Kazakov
2007-04-24  0:15                                 ` Adam Beneschan
2007-04-24 10:43                                   ` Dmitry A. Kazakov
2007-04-24 16:27                                     ` Adam Beneschan
2007-04-24 20:19                                       ` Dmitry A. Kazakov
2007-04-26  0:58                                         ` Adam Beneschan
2007-04-26  7:50                                           ` Dmitry A. Kazakov
2007-04-26  8:09                                             ` Markus E Leypold
2007-04-27  8:46                                               ` Dmitry A. Kazakov
2007-04-27 11:37                                                 ` Markus E Leypold
2007-04-28 17:35                                                   ` Dmitry A. Kazakov
2007-04-29  2:31                                                     ` Randy Brukardt
2007-04-29  8:45                                                       ` Dmitry A. Kazakov
2007-04-27 20:44                                               ` Robert A Duff
2007-04-26  8:33                                             ` Markus E Leypold
2007-04-26 11:09                                               ` Markus E Leypold
2007-04-20 19:55                       ` Randy Brukardt
2007-04-22  9:54                         ` Georg Bauhaus [this message]
2007-04-22 11:19                           ` Dmitry A. Kazakov
2007-04-20 20:44                       ` Robert A Duff
2007-04-21  5:38                         ` Randy Brukardt
2007-04-22  1:14                           ` Robert A Duff
2007-04-22  4:08                             ` Randy Brukardt
2007-04-20 20:11                     ` Randy Brukardt
2007-04-20 21:28                       ` Dmitry A. Kazakov
2007-04-21  5:33                         ` Randy Brukardt
2007-04-21  9:39                           ` Dmitry A. Kazakov
2007-04-22  4:28                             ` Randy Brukardt
2007-04-22  8:38                               ` Dmitry A. Kazakov
2007-04-23 23:26                                 ` Randy Brukardt
2007-04-24 10:43                                   ` Dmitry A. Kazakov
2007-04-24  8:58                                 ` Georg Bauhaus
2007-04-24 12:21                                   ` Dmitry A. Kazakov
2007-04-21  4:48                       ` unifying arrays and records (was Re: Rational for not making cursor tagged in Containers) Ray Blaak
2007-04-20 17:05             ` Rational for not making cursor tagged in Containers Ray Blaak
2007-04-20 18:46               ` Dmitry A. Kazakov
2007-04-20 18:52                 ` Ray Blaak
2007-04-20 19:54                   ` Robert A Duff
2007-04-20  1:18         ` Anh Vo
2007-04-20  7:53           ` Dmitry A. Kazakov
2007-04-20  9:26             ` Maciej Sobczak
2007-04-20 10:15               ` Dmitry A. Kazakov
2007-04-20 11:59           ` Jean-Pierre Rosen
2007-04-20 13:23             ` Anh Vo
2007-04-20 16:02               ` Jean-Pierre Rosen
2007-04-21  2:53                 ` Anh Vo
2007-04-20  3:03   ` Randy Brukardt
2007-04-20  2:53 ` Randy Brukardt
2007-04-20 16:08   ` Anh Vo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox