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.107.148.147 with SMTP id w141mr8274180iod.34.1450042632006; Sun, 13 Dec 2015 13:37:12 -0800 (PST) X-Received: by 10.182.28.129 with SMTP id b1mr361454obh.4.1450042631985; Sun, 13 Dec 2015 13:37:11 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!mv3no11995715igc.0!news-out.google.com!l1ni2403igd.0!nntp.google.com!mv3no11995708igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 13 Dec 2015 13:37:11 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.161.116.59; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 75.161.116.59 References: <8bc7fd76-f00a-4eea-9715-470af028fc84@googlegroups.com> <1krm4xun4e4ny.jmh9kvf6s0a9.dlg@40tude.net> <12dc7aea-933d-4271-95bd-10df808917e4@googlegroups.com> <5hfb2q9imjfu.zs3xp9gxw0d3.dlg@40tude.net> <5788b259-8886-4ee2-8c3d-7799abfd840e@googlegroups.com> <14acd8b0-a5e9-40fd-b7cc-d319f914d507@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2b70cc02-600e-4f4e-b6fe-86d7e01648ef@googlegroups.com> Subject: Re: I'm facing an issue with: call to abstract procedure must be dispatching From: Shark8 Injection-Date: Sun, 13 Dec 2015 21:37:12 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28802 Date: 2015-12-13T13:37:11-08:00 List-Id: On Tuesday, December 8, 2015 at 4:04:08 PM UTC-7, Serge Robyns wrote: >=20 > How do I then pass the context? I mean, now I pass the parameter around.= through global variables? No, you use the package. If you want a single application-wide object you can use a package. Here is= a single counter: Package Counter is Procedure Inc; Procedure Dec; Function Value Return Natural; Private Data : Natural :=3D 0; End Counter; Package Body Counter is Procedure Inc is begin Data:=3D Natural'Succ( Data ); end Inc; Procedure Dec is begin Data:=3D Natural'Pred( Data ); end Dec; Function Value return Natural is ( Data ); End Counter; You could also enclose that sort of logic in a task or protected object; an= d if you need multiple singletons you could always use a generic version an= d then make an instance for each needed singleton. What those above are warning you against is trying to write C (or C++) in A= da. There's a lot of differences that can usually greatly simplify and/or m= ake your code more reliable. (The most obvious of those is probably the Arr= ay type, which because it contains the range/indices means you don't have t= o pass that sort of info in parameters. > Also in the future I would like to have multiple "tasks" running, each wi= th their "context", especially the db session. I do believe these are good= reasons for having a variable. That is doable, I did it with a mock-up test and it worked pretty nicely...= though personally I have had problems getting a good DB interface/binding = up and running w/ Ada.