From: Andrew Shvets <andrew.shvets@gmail.com>
Subject: Re: Select + Accept syntax question
Date: Sat, 27 Aug 2016 12:47:42 -0700 (PDT)
Date: 2016-08-27T12:47:42-07:00 [thread overview]
Message-ID: <79a47c37-90e6-440f-8b40-cdb525758d8b@googlegroups.com> (raw)
In-Reply-To: <e2e7feFrg8eU1@mid.individual.net>
On Saturday, August 27, 2016 at 3:20:16 PM UTC-4, Niklas Holsti wrote:
> On 16-08-27 21:26 , Andrew Shvets wrote:
>
> > The one thing that threw me for a loop was when I put any type of code right before the above two accept keywords, like so:
> > while Go_Loop LOOP
> > select
> > when Internal_Value = 0 =>
> > Ada.Text_IO.Put_Line("hello world");
> > accept Input(Value : in Integer) do
> > Internal_Value := Value;
> > end Input;
> > or
> > when Internal_Value /= 0 =>
> > Ada.Text_IO.Put_Line("hello world");
> > accept Retrieve(Value : out Integer) do
> > Value := Internal_Value;
> > end Retrieve;
> >
> > And I get the following output from the compiler:
> >
> >> gnatmake -g .\task_demo_11.adb
> > gcc -c -I.\ -g -I- .\task_demo_11.adb
> > task_demo_11.adb:25:16: missing "END SELECT;" for "SELECT" at line 18
> > task_demo_11.adb:25:17: select alternative ("ACCEPT", "ABORT", "DELAY") expected
> > task_demo_11.adb:38:07: "OR" not allowed here
> > task_demo_11.adb:42:07: no "SELECT" for this "END SELECT"
> > gnatmake: ".\task_demo_11.adb" compilation error
> >
> > Why does this happen? Why can't I have code right before the accept?
>
> Before I try to answer that question, I would like to know what
> behaviour you expect from such code. In particular, exactly when would
> that code be executed?
>
> --
> Niklas Holsti
> Tidorum Ltd
> niklas holsti tidorum fi
> . @ .
To print something out and then wait for a message to arrive.
next prev parent reply other threads:[~2016-08-27 19:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-27 18:26 Select + Accept syntax question Andrew Shvets
2016-08-27 19:20 ` Niklas Holsti
2016-08-27 19:47 ` Andrew Shvets [this message]
2016-08-28 6:52 ` Niklas Holsti
2016-08-27 19:36 ` Jeffrey R. Carter
2016-08-27 19:48 ` Andrew Shvets
2016-08-27 23:22 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox