comp.lang.ada
 help / color / mirror / Atom feed
* Entry family
@ 2002-11-21 11:18 Evangelista Sami
  2002-11-21 11:21 ` Preben Randhol
  0 siblings, 1 reply; 11+ messages in thread
From: Evangelista Sami @ 2002-11-21 11:18 UTC (permalink / raw)


hello all

what is the meaning of this code which compile well with gnat3.14
under linux:
---------------------------------------------
procedure Test_Index is
   type Id is mod 10;
   protected type Prot is
      entry E (Boolean);
   end Prot;
   protected body Prot is
       entry E (for I in Id) when True is
       begin
          null;
       end;
   end Prot;
   P : Prot;
begin
   P.E(True);
end;
---------------------------------------------why can i declare the
index entry of E as Boolean in the spec and as Id in the body?
Perhaps i didnt understand something about entry index

Thanks for any response



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

* Re: Entry family
  2002-11-21 11:18 Evangelista Sami
@ 2002-11-21 11:21 ` Preben Randhol
  2002-11-21 12:39   ` evangeli
  0 siblings, 1 reply; 11+ messages in thread
From: Preben Randhol @ 2002-11-21 11:21 UTC (permalink / raw)


Evangelista Sami wrote:
> hello all
> 
> what is the meaning of this code which compile well with gnat3.14
> under linux:
> ---------------------------------------------
> procedure Test_Index is
>    type Id is mod 10;
>    protected type Prot is
>       entry E (Boolean);
>    end Prot;
>    protected body Prot is
>        entry E (for I in Id) when True is
                  ^^^^^^^^^^^
                  Won't this return Boolean?

-- 
Preben Randhol ------------------------ http://www.pvv.org/~randhol/ --
                          �1984 is soon coming to a computer near you.�



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

* Re: Entry family
  2002-11-21 12:39   ` evangeli
@ 2002-11-21 12:10     ` Preben Randhol
  0 siblings, 0 replies; 11+ messages in thread
From: Preben Randhol @ 2002-11-21 12:10 UTC (permalink / raw)


evangeli wrote:
> and what about this?
> ---------------------------------------------
> procedure test_index is
>     type Id is mod 10;
>     protected type Prot is
>        entry E (Id);
>     end Prot;
>     protected body Prot is
>         entry E (for B in Boolean) when True is
>         begin
>            null;
>         end;
>     end Prot;
>     P : Prot;
> begin
>     P.E(8);
> end;
> ---------------------------------------------
> 
> does "for b in boolean" return id?

I'm not very familiar with entry families, but as I understand Barnes
text book it gives this example:

entry E (for P in Id) when Barrier_Condition(P) is
   begin
      --  do your thing
   end E;

so when you write "when True" it will always do the code block. But I'm
not sure, you better look up in your text book or wait for the gurus to
clear it up :-)

-- 
Preben Randhol ------------------------ http://www.pvv.org/~randhol/ --
                          �1984 is soon coming to a computer near you.�



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

* Re: Entry family
@ 2002-11-21 12:14 Grein, Christoph
  2002-11-21 14:18 ` evangeli
  2002-11-22  1:30 ` Randy Brukardt
  0 siblings, 2 replies; 11+ messages in thread
From: Grein, Christoph @ 2002-11-21 12:14 UTC (permalink / raw)


> ---------------------------------------------
> procedure Test_Index is
>    type Id is mod 10;
>    protected type Prot is
>       entry E (Boolean);
>    end Prot;
>    protected body Prot is
>        entry E (for I in Id) when True is
>        begin
>           null;
>        end;
>    end Prot;
>    P : Prot;
> begin
>    P.E(True);
> end;

To me, this looks like a fat compiler bug. The entry body shouod be

  entry E (for I in Boolean) when True is

Report it to ACT (report@gnat.com).



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

* Re: Entry family
  2002-11-21 11:21 ` Preben Randhol
@ 2002-11-21 12:39   ` evangeli
  2002-11-21 12:10     ` Preben Randhol
  0 siblings, 1 reply; 11+ messages in thread
From: evangeli @ 2002-11-21 12:39 UTC (permalink / raw)


Preben Randhol wrote:

> Evangelista Sami wrote:
> 
>>hello all
>>
>>what is the meaning of this code which compile well with gnat3.14
>>under linux:
>>---------------------------------------------
>>procedure Test_Index is
>>   type Id is mod 10;
>>   protected type Prot is
>>      entry E (Boolean);
>>   end Prot;
>>   protected body Prot is
>>       entry E (for I in Id) when True is
>>
>                   ^^^^^^^^^^^
>                   Won't this return Boolean?
> 
> 

and what about this?
---------------------------------------------
procedure test_index is
    type Id is mod 10;
    protected type Prot is
       entry E (Id);
    end Prot;
    protected body Prot is
        entry E (for B in Boolean) when True is
        begin
           null;
        end;
    end Prot;
    P : Prot;
begin
    P.E(8);
end;
---------------------------------------------

does "for b in boolean" return id?




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

* Re: Entry family
  2002-11-21 12:14 Grein, Christoph
@ 2002-11-21 14:18 ` evangeli
  2002-11-22  1:30 ` Randy Brukardt
  1 sibling, 0 replies; 11+ messages in thread
From: evangeli @ 2002-11-21 14:18 UTC (permalink / raw)


Grein, Christoph wrote:

>>---------------------------------------------
>>procedure Test_Index is
>>   type Id is mod 10;
>>   protected type Prot is
>>      entry E (Boolean);
>>   end Prot;
>>   protected body Prot is
>>       entry E (for I in Id) when True is
>>       begin
>>          null;
>>       end;
>>   end Prot;
>>   P : Prot;
>>begin
>>   P.E(True);
>>end;
>>
> 
> To me, this looks like a fat compiler bug. The entry body shouod be
> 
>   entry E (for I in Boolean) when True is
> 
> Report it to ACT (report@gnat.com).
> 


it seems that conversion is made at the run time:

example :
--------------------------------------------------
procedure test_index is
    type Id is mod 5;
    protected type Prot is
       entry E(Id);
    end Prot;
    protected body Prot is
       entry E(for B in boolean) when true is
       begin
          null;
       end;
    end Prot;
    P : Prot;
begin
    -- OK : 0 -> FALSE
    P.E(0);
    -- OK : 1 -> TRUE
    P.E(1);
    -- CRASHES
    P.E(2);
end;
--------------------------------------------------




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

* Re: Entry family
  2002-11-21 12:14 Grein, Christoph
  2002-11-21 14:18 ` evangeli
@ 2002-11-22  1:30 ` Randy Brukardt
  2002-11-22 10:39   ` Preben Randhol
  1 sibling, 1 reply; 11+ messages in thread
From: Randy Brukardt @ 2002-11-22  1:30 UTC (permalink / raw)


Grein, Christoph wrote in message ...
>To me, this looks like a fat compiler bug. The entry body shouod be
>
>  entry E (for I in Boolean) when True is
>
>Report it to ACT (report@gnat.com).

I agree. This code violates 9.5.2(17), which says that the subtype name
has to fully conform between the specification and the body of the
entry. The compiler should not accept it.

What the code actually does isn't particularly relevant, since it's
illegal.

    Randy.






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

* Re: Entry family
@ 2002-11-22  5:29 Grein, Christoph
  0 siblings, 0 replies; 11+ messages in thread
From: Grein, Christoph @ 2002-11-22  5:29 UTC (permalink / raw)


> >>---------------------------------------------
> >>procedure Test_Index is
> >>   type Id is mod 10;
> >>   protected type Prot is
> >>      entry E (Boolean);
> >>   end Prot;
> >>   protected body Prot is
> >>       entry E (for I in Id) when True is
> >>       begin
> >>          null;
> >>       end;
> >>   end Prot;
> >>   P : Prot;
> >>begin
> >>   P.E(True);
> >>end;
> >>
> --------------------------------------------------
> procedure test_index is
>     type Id is mod 5;
>     protected type Prot is
>        entry E(Id);
>     end Prot;
>     protected body Prot is
>        entry E(for B in boolean) when true is
>        begin
>           null;
>        end;
>     end Prot;
>     P : Prot;
> begin
>     -- OK : 0 -> FALSE
>     P.E(0);
>     -- OK : 1 -> TRUE
>     P.E(1);
>     -- CRASHES
>     P.E(2);
> end;
> --------------------------------------------------

Both programs show the same fat bug. There is no such implicit conversion in 
Ada.

The entry spec and body do not match. Full stop.



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

* Re: Entry family
  2002-11-22  1:30 ` Randy Brukardt
@ 2002-11-22 10:39   ` Preben Randhol
  2002-11-23 17:21     ` Simon Wright
  0 siblings, 1 reply; 11+ messages in thread
From: Preben Randhol @ 2002-11-22 10:39 UTC (permalink / raw)


Randy Brukardt wrote:
> I agree. This code violates 9.5.2(17), which says that the subtype name
> has to fully conform between the specification and the body of the
> entry. The compiler should not accept it.
> 
> What the code actually does isn't particularly relevant, since it's
> illegal.

Could somebody with GNAT 3.15p try it to see if the bug is still there
or if it was fixed?

-- 
Preben Randhol ------------------------ http://www.pvv.org/~randhol/ --
                          �1984 is soon coming to a computer near you.�



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

* Re: Entry family
@ 2002-11-22 10:49 Grein, Christoph
  0 siblings, 0 replies; 11+ messages in thread
From: Grein, Christoph @ 2002-11-22 10:49 UTC (permalink / raw)


> Could somebody with GNAT 3.15p try it to see if the bug is still there
> or if it was fixed?

It's there even with 3.16w (the wavefront).



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

* Re: Entry family
  2002-11-22 10:39   ` Preben Randhol
@ 2002-11-23 17:21     ` Simon Wright
  0 siblings, 0 replies; 11+ messages in thread
From: Simon Wright @ 2002-11-23 17:21 UTC (permalink / raw)


Preben Randhol <randhol+news@pvv.org> writes:

> Could somebody with GNAT 3.15p try it to see if the bug is still
> there or if it was fixed?

3.15p still sees no problem (any more than GCC 3.3 at 20021025).



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

end of thread, other threads:[~2002-11-23 17:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-22 10:49 Entry family Grein, Christoph
  -- strict thread matches above, loose matches on Subject: below --
2002-11-22  5:29 Grein, Christoph
2002-11-21 12:14 Grein, Christoph
2002-11-21 14:18 ` evangeli
2002-11-22  1:30 ` Randy Brukardt
2002-11-22 10:39   ` Preben Randhol
2002-11-23 17:21     ` Simon Wright
2002-11-21 11:18 Evangelista Sami
2002-11-21 11:21 ` Preben Randhol
2002-11-21 12:39   ` evangeli
2002-11-21 12:10     ` Preben Randhol

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