comp.lang.ada
 help / color / mirror / Atom feed
* prefixed view
@ 2007-12-06 16:06 Maxim Reznik
  2007-12-06 18:00 ` Georg Bauhaus
  2007-12-06 23:36 ` Randy Brukardt
  0 siblings, 2 replies; 4+ messages in thread
From: Maxim Reznik @ 2007-12-06 16:06 UTC (permalink / raw)


Hi, all

I'm trying to understand how prefixed calls work in Ada 2005. Here is
an example:

package pref_view is
  type Tg is tagged null record;
  procedure X (Item : Tg; Count : Integer);

  Object : Tg;

  procedure Y (Count : Integer) renames Object.X;

  generic
     with procedure Y (Count : Integer);
  package Gen is
  end;

  package Inst is new Gen (Object.X);
end;

ARM 4.1.3 (9.2/2): The selected_component denotes a view of this
subprogram that omits the first formal parameter. This view is called
a prefixed view of the subprogram...

Can I rename this view as new subprogram or use it as an actual
parameter in instantiation?
If NOT, why?

Thanks
--
Maxim Reznik




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: prefixed view
  2007-12-06 16:06 prefixed view Maxim Reznik
@ 2007-12-06 18:00 ` Georg Bauhaus
  2007-12-06 18:32   ` Maxim Reznik
  2007-12-06 23:36 ` Randy Brukardt
  1 sibling, 1 reply; 4+ messages in thread
From: Georg Bauhaus @ 2007-12-06 18:00 UTC (permalink / raw)


Maxim Reznik schrieb:
> Hi, all
> 
> I'm trying to understand how prefixed calls work in Ada 2005. Here is
> an example:
> 
> package pref_view is
>   type Tg is tagged null record;
>   procedure X (Item : Tg; Count : Integer);
> 
>   Object : Tg;
> 
>   procedure Y (Count : Integer) renames Object.X;

Should the result be a procedure that is always invoked with
Object, and only with Object? This will be currying, right?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: prefixed view
  2007-12-06 18:00 ` Georg Bauhaus
@ 2007-12-06 18:32   ` Maxim Reznik
  0 siblings, 0 replies; 4+ messages in thread
From: Maxim Reznik @ 2007-12-06 18:32 UTC (permalink / raw)


On 6 дек, 20:00, Georg Bauhaus <rm.tsoh+bauh...@maps.futureapps.de>
wrote:
> >   procedure Y (Count : Integer) renames Object.X;
>
> Should the result be a procedure that is always invoked with
> Object, and only with Object? This will be currying, right?

I think it could be like

procedure Y (Count : Integer) is
begin
   X (Object, Count);
end;

But the question is ARM intend such usage of prefixed view or deny it?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: prefixed view
  2007-12-06 16:06 prefixed view Maxim Reznik
  2007-12-06 18:00 ` Georg Bauhaus
@ 2007-12-06 23:36 ` Randy Brukardt
  1 sibling, 0 replies; 4+ messages in thread
From: Randy Brukardt @ 2007-12-06 23:36 UTC (permalink / raw)


"Maxim Reznik" <reznikmm@gmail.com> wrote in message
news:8727544b-2f4f-4817-bb2e-20d4d104ae5d@w34g2000hsg.googlegroups.com...
...
> ARM 4.1.3 (9.2/2): The selected_component denotes a view of this
> subprogram that omits the first formal parameter. This view is called
> a prefixed view of the subprogram...
>
> Can I rename this view as new subprogram or use it as an actual
> parameter in instantiation?
> If NOT, why?

Yes, you can rename a prefixed view and use it as an actual. Indeed, I
recently wrote an ACATS test to check this (it will be part of the upcoming
ACATS 3.0). You can't use a prefixed view in places where the calling
convention has to match (such as the prefix of 'Access) because it is
considered intrinsic.

Existing compilers didn't do very well with the ACATS test, so I wouldn't
expect this to work with the compiler you have. But it probably will in the
future releases, because *everyone* runs the ACATS, so no one will fail to
be aware of the requirement.

                              Randy.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-06 23:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-06 16:06 prefixed view Maxim Reznik
2007-12-06 18:00 ` Georg Bauhaus
2007-12-06 18:32   ` Maxim Reznik
2007-12-06 23:36 ` Randy Brukardt

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