From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.13.223.84 with SMTP id i81mr7744568ywe.9.1472327262903; Sat, 27 Aug 2016 12:47:42 -0700 (PDT) X-Received: by 10.157.20.143 with SMTP id d15mr714938ote.1.1472327262866; Sat, 27 Aug 2016 12:47:42 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!j37no11062101qta.0!news-out.google.com!d68ni40955ith.0!nntp.google.com!x131no486448ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 27 Aug 2016 12:47:42 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.250.26.106; posting-account=3pYsyQoAAACcI-ym7XtMOI2PDU8gRZS5 NNTP-Posting-Host: 50.250.26.106 References: <60637c3a-c699-4e4c-9fd3-1a081cb6152c@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <79a47c37-90e6-440f-8b40-cdb525758d8b@googlegroups.com> Subject: Re: Select + Accept syntax question From: Andrew Shvets Injection-Date: Sat, 27 Aug 2016 19:47:42 +0000 Content-Type: text/plain; charset=UTF-8 X-Received-Bytes: 2705 X-Received-Body-CRC: 3832070862 Xref: news.eternal-september.org comp.lang.ada:31610 Date: 2016-08-27T12:47:42-07:00 List-Id: 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.