From: Shark8 <onewingedshark@gmail.com>
Subject: Re: I'm facing an issue with: call to abstract procedure must be dispatching
Date: Sun, 13 Dec 2015 13:37:11 -0800 (PST)
Date: 2015-12-13T13:37:11-08:00 [thread overview]
Message-ID: <2b70cc02-600e-4f4e-b6fe-86d7e01648ef@googlegroups.com> (raw)
In-Reply-To: <d674e44a-6341-4f73-903f-4bcee8406912@googlegroups.com>
On Tuesday, December 8, 2015 at 4:04:08 PM UTC-7, Serge Robyns wrote:
>
> 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 := 0;
End Counter;
Package Body Counter is
Procedure Inc is
begin
Data:= Natural'Succ( Data );
end Inc;
Procedure Dec is
begin
Data:= 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; and if you need multiple singletons you could always use a generic version and then make an instance for each needed singleton.
What those above are warning you against is trying to write C (or C++) in Ada. There's a lot of differences that can usually greatly simplify and/or make your code more reliable. (The most obvious of those is probably the Array type, which because it contains the range/indices means you don't have to pass that sort of info in parameters.
> Also in the future I would like to have multiple "tasks" running, each with 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.
next prev parent reply other threads:[~2015-12-13 21:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-08 16:45 I'm facing an issue with: call to abstract procedure must be dispatching Serge Robyns
2015-12-08 16:59 ` G.B.
2015-12-08 17:04 ` Dmitry A. Kazakov
2015-12-08 17:24 ` Serge Robyns
2015-12-08 17:42 ` Dmitry A. Kazakov
2015-12-08 18:00 ` Serge Robyns
2015-12-08 18:22 ` Dmitry A. Kazakov
2015-12-08 20:21 ` Serge Robyns
2015-12-08 21:08 ` Dmitry A. Kazakov
2015-12-08 21:55 ` Serge Robyns
2015-12-08 22:43 ` Serge Robyns
2015-12-08 22:55 ` Jeffrey R. Carter
2015-12-09 23:03 ` Randy Brukardt
2015-12-10 8:38 ` Serge Robyns
2015-12-10 23:43 ` Randy Brukardt
2015-12-09 8:48 ` Dmitry A. Kazakov
2015-12-09 10:53 ` G.B.
2015-12-09 12:03 ` Dmitry A. Kazakov
2015-12-09 13:42 ` G.B.
2015-12-09 14:23 ` Dmitry A. Kazakov
2015-12-08 22:55 ` Jeffrey R. Carter
2015-12-08 23:04 ` Serge Robyns
2015-12-08 23:42 ` Jeffrey R. Carter
2015-12-09 13:40 ` Jere
2015-12-09 13:48 ` G.B.
2015-12-09 15:33 ` Jere
2015-12-13 21:37 ` Shark8 [this message]
2015-12-14 2:20 ` Jeffrey R. Carter
2015-12-15 7:26 ` Shark8
2015-12-08 17:30 ` Jeffrey R. Carter
2015-12-08 17:48 ` Serge Robyns
2015-12-08 18:46 ` Jeffrey R. Carter
2015-12-08 20:28 ` Serge Robyns
2015-12-08 22:20 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox