I can continue research but currently I do not have the details of his objections to Ada 95 and how those may have continued through to today is perhaps a nuanced question.
"[T]he language [Ada] incorporates many excellent structural
features which have proved their value in many precursor
languages ..."
C. A. R. Hoare
I can continue research but currently I do not have the details of his
objections to Ada 95 and how those may have continued through to today is
perhaps a nuanced question.
Ichbiah's objections to Ada 95 are in >https://web.elastic.org/~fche/mirrors/old-usenet/ada-with-null.
I can continue research but currently I do not have the details of his
objections to Ada 95 and how those may have continued through to today is
perhaps a nuanced question.
Ichbiah's objections to Ada 95 are in >https://web.elastic.org/~fche/mirrors/old-usenet/ada-with-null.
On 5 Sep 2024, Jeffrey R.Carter wrote
(in article <vbcccj$a13q$1@dont-email.me>):
"[T]he language [Ada] incorporates many excellent structural
features which have proved their value in many precursor
languages ..."
C. A. R. Hoare
And he continued:
"one can look forward to a rapid and widespread improvement in programming practice,
both from those who use the language and from those who study its concepts and structures."
I am familiar with this, as one of the authors of the book
that contains that foreword. 8-)
What does this mean?
"elimination of accuracy constraints in subtypes"
What do you think Ichbiah would jettison from Ada 2022? All comments
welcome.
Keyword "variable" is needed to declare variables (we do not want the
worst option to be the easiest to write, as it is in Ada).
(10) Variable-returning functions are introduced.
Out of interest. Could anyone help me with what an Gnat or other compiler Ichbiah_2022_Mode might look like.
(A) Do we need tasks at all? Parallel and task are very much
overlapping capabilities.
"Randy Brukardt" <randy@rrsoftware.com> writes:
(A) Do we need tasks at all? Parallel and task are very much
overlapping capabilities.
I don't think I've ever wanted parallel. Most embedded system tasks are one-off, aren't they?
On Thu, 5 Sep 2024 19:03:22 -0500, Randy Brukardt wrote:...
(10) Variable-returning functions are introduced.
Is this like updater functions in POP-11, or "setf" in Lisp? So you have a procedure
set_var(var, new value)
which is declared to be attached to var in some way, such that when you write
var := new_value
this automatically invokes set_var?
I disagree with Randy's view that tasks and "parallel" are much
overlapping. Tasks are able to communicate with each other, but AIUI
parallel tasklets are not meant to do that, and may not be able to do
that. Tasks can have different priorities; tasklets cannot.
"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message news:lk3fsvF7aaaU1@mid.individual.net...
...
I disagree with Randy's view that tasks and "parallel" are much
overlapping. Tasks are able to communicate with each other, but AIUI
parallel tasklets are not meant to do that, and may not be able to do
that. Tasks can have different priorities; tasklets cannot.
I was (of course) presuming that "tasklets" would get those capabilities if they were to replace tasks. That's what I meant about "suspension", which is not currently allowed for threads in Ada (parallel code is not allowed to call potentially blocking operations). If that was changed, then all forms
of existing task communication would be allowed.
I'm less certain about the value of priorities, most of the time, they don't help writing correct Ada code. (You still need all of the protections
against race conditions and the like.) I do realize that they are a natural way to express constraints on a program. So I admit I don't know in this area, in particular if there are things that priorities are truly required for.
I don't mind at all if a future Ada evolution merges tasks and
"parallel", although it might defeat the easier access to multi-core
true parallelism that is the goal of the "parallel" extension, AIUI.
Priorities (or the equivalent, such as deadlines) are absolutely
required for real-time systems where there are fewer cores than concurrent/parallel activities so that the system has to schedule more
than one such activity on one core.
If Ada did not have tasks with priorities, most of the Ada applications
I have worked on in my life would have had to avoid Ada tasking and
retreat to using some other real-time kernel, with ad-hoc mapping of the kernels's threads to Ada procedures.
Despite the transition to multi-core processors, I think that there will continue to be systems where scheduling is required, because the number
of concurrent/parallel activities will increase too.
I was (of course) presuming that "tasklets" would get those capabilities if they were to replace tasks. That's what I meant about "suspension", which is not currently allowed for threads in Ada (parallel code is not allowed to call potentially blocking operations). If that was changed, then all formsWell, tasks are not only for speeding up code. They can be a very useful
of existing task communication would be allowed.
I'm less certain about the value of priorities, most of the time, they don't help writing correct Ada code. (You still need all of the protectionsIf you had as many cores as tasks, you would not need priorities.
against race conditions and the like.) I do realize that they are a natural way to express constraints on a program. So I admit I don't know in this area, in particular if there are things that priorities are truly required for.
Well, tasks are not only for speeding up code. They can be a very useful design tool (active objects, independant activities). I think the Ada
model is clean and simple, I would hate to see it disappear.
I'm less certain about the value of priorities, [...]
Priorities are just optimization on how to manage cores when there are
not enough of them.
I know that people use priorities to guarantee mutual exclusion, and
other properties. All these algorithms were designed at the time of
mono-CPU machines, but they fail on multi-cores.
If Ada did not have tasks with priorities, most of the Ada applications
I have worked on in my life would have had to avoid Ada tasking and
retreat to using some other real-time kernel, with ad-hoc mapping of the >kernels's threads to Ada procedures.
If Ada did not have tasks with priorities, most of the Ada
applications I have worked on in my life would have had to avoid Ada
tasking and retreat to using some other real-time kernel, with ad-hoc
mapping of the kernels's threads to Ada procedures.
Counter intuitively it is possible that this is holding Ada back. A lot of Ada code cannot run without some fairly complex runtime support due to
tasks, protected objects, finalization etc.. Runtimes have to be developed for each chip instead of each cpu.
If you need advanced multi core support then using an OS seems like a more suitable situation to be in to me.
"Lawrence D'Oliveiro" <ldo@nz.invalid> wrote in message news:vbdk2t$hj0r$6@dont-email.me...
On Thu, 5 Sep 2024 19:03:22 -0500, Randy Brukardt wrote:...
(10) Variable-returning functions are introduced.
Is this like updater functions in POP-11, or "setf" in Lisp?
No, it is a function that returns a variable, meaning you can assign
into the function result.
Priorities are just optimization on how to manage cores when there are
not enough of them.
In some contexts it could be optimization -- for example, to increase throughput in a soft real-time system -- but in hard real-time systems priorities (or deadlines) are needed for correctness, not just for optimizatiion.
Ok, I understand. In that case, what "parallel" adds to the current
tasking feature is an easy way to create a largish and perhaps dynamically defined number of concurrent threads from a "parallel" loop, where the threads are automatically created when the loop is started and
automatically "joined" and destroyed when the loop completes.
I think the parallel block is more useful for general tasking. The advantage of using parallel structures is that they look very similar to sequential structures, and one lets the system do the scheduling (rather than trying to figure out an organization manually).
One of the advantages of the model I'm thinking about is that it separates concerns such as parallel execution, mutual exclusion, inheritance, organization (privacy, type grouping), and so on into separate (mostly) non-overlapping constructs.
Ada started this process by having tagged types
a separate construct from packages;
but you can also construct many structures that are quite hard in
traditional "one construct" OOP. I think that ought to be done for all constructs, and thus the special task and protected constructs ought to go.
We already know that protected types cause problems with privacy of implementation and with inheritance. Tasks have similar issues (admittedly less encountered), so splitting them into a set of constructs would fit the model.
On Wed, 11 Sep 2024 23:39:27 -0500, Randy Brukardt wrote:
"Lawrence D'Oliveiro" <ldo@nz.invalid> wrote in message
news:vbdk2t$hj0r$6@dont-email.me...
On Thu, 5 Sep 2024 19:03:22 -0500, Randy Brukardt wrote:...
(10) Variable-returning functions are introduced.
Is this like updater functions in POP-11, or "setf" in Lisp?
No, it is a function that returns a variable, meaning you can assign
into the function result.
I think an updater function would be more generally useful. Because some things you want to update might not (depending on the implementation) live independently in an explicit variable. And it seems good not to constrain implementations unnecessarily.
Unfortunately, "updater" functions don't work with the Ada model of components, because you can't tell what to do when a component appears
or disappears in an assignment.
"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message news:lkg1vvF1tp6U1@mid.individual.net...
...
Priorities are just optimization on how to manage cores when there are
not enough of them.
In some contexts it could be optimization -- for example, to increase
throughput in a soft real-time system -- but in hard real-time systems
priorities (or deadlines) are needed for correctness, not just for
optimizatiion.
This I don't buy: priorities never help for correctness. At least not
without extensive static analysis, but if you can do that, you almost certainly can do the correctness without depending upon priorities.
... priorities never help for correctness.
(3) A number of syntax options are eliminated. Matching identifiers are required at the end of subprograms and packages. Initializers are always required (<> can be used if default initialization is needed). Keyword "variable" is needed to declare variables (we do not want the worst option
to be the easiest to write, as it is in Ada).
(10) Variable-returning functions are introduced. They're pretty similar the semantics of anonymous access returns (or the aliased function returns suggested by Tucker). This means that a variable can easily be treated as a function (and indeed, a variable declaration is just syntactic sugar for
such a function).
Square (2) := 3;
List.Index (3) := Item;
Le 06/09/2024 02:03, Randy Brukardt a crit :
(3) A number of syntax options are eliminated. Matching identifiers are
required at the end of subprograms and packages. Initializers are always
required (<> can be used if default initialization is needed). Keyword
"variable" is needed to declare variables (we do not want the worst
option
to be the easiest to write, as it is in Ada).
Why are you considering variables worst than constants?
I don't want the the "worst" option to be the easiest to write, but
neither do I want to put one more keyword in the most common case.
Note that :
1. I have no statistics, but it seems to me that there is more variables
than constants in my code.
2. I say "Useless" from my coder point of view, I dont know if it simplify the work for compiler or tools implementers.
Le 06/09/2024 02:03, Randy Brukardt a crit :
(10) Variable-returning functions are introduced. They're pretty similar
the
semantics of anonymous access returns (or the aliased function returns
suggested by Tucker). This means that a variable can easily be treated as
a
function (and indeed, a variable declaration is just syntactic sugar for
such a function).
I suppose that to allows the compiler to discriminate this non sense code
Square (2) := 3;
from the legitimate
List.Index (3) := Item;
you will have to introduce some specific syntax, like Tucker's "aliased function".
I see the huge benefit from a user point of view, but I'm not aware of compiler internals : doesn't the introduction of a second function type increase complexity?
"One more keyword" is irrelevant in terms of creating code, the only
question is whether it hurts readability.
But how many of them *have* to be variables vs. the number that just are because it is easier? I know I have a number of the latter.
Note that :
1. I have no statistics, but it seems to me that there is more variables
than constants in my code.
But how many of them *have* to be variables vs. the number that just are because it is easier? I know I have a number of the latter.
2. I say "Useless" from my coder point of view, I dont know if it simplify >> the work for compiler or tools implementers.
Constants do help the compiler generate better code, although a lot of the benefits can be gained also by working harder. (That's what C compilers do, after all.)
On 21.12.24 09:14, Randy Brukardt wrote:
Note that :
1. I have no statistics, but it seems to me that there is more variables >>> than constants in my code.
But how many of them *have* to be variables vs. the number that just are
because it is easier? I know I have a number of the latter.
2. I say "Useless" from my coder point of view, I dont know if it
simplify
the work for compiler or tools implementers.
Constants do help the compiler generate better code, although a lot of
the
benefits can be gained also by working harder. (That's what C
compilers do,
after all.)
What are some compilers offering today? That is, can they find declarations of variables that could be constants, if so instructed?
I am seeing some warnings about non-initialized variables for a meaningless mock-up, but not much else. Ada, C++, Java.
(Maybe there are options that I have missed. Or an analysis of a whole program yields more.)
function testc (b : Boolean) return Integer is
package P is
x : Integer;
end;
begin
if b then
P.x := 42;
end if;
return P.x;
end testc;
int testc(bool b) {
struct {
int x;
} P;
if (b) {
P.x = 42;
}
return P.x;
}
class testc {
class P {
int x;
}
P P;
int $(boolean b) {
if (b) {
P.x = 42;
}
return P.x;
}
}
Using "constant" for something that isn't going to be modified is
good
practice, but I'd say it's for the benefit of the human reader.
I am seeing some warnings about non-initialized variables for a meaningless mock-up, but not much else.
"G.B." <bauhaus@notmyhomepage.invalid> writes:
I am seeing some warnings about non-initialized variables for a meaningless >> mock-up, but not much else.
See -gnatwk, which is included in -gnatwa. Been around for a long time now.
On 22.12.24 13:15, Simon Wright wrote:
"G.B." <bauhaus@notmyhomepage.invalid> writes:
I am seeing some warnings about non-initialized variables for a meaningless >>> mock-up, but not much else.See -gnatwk, which is included in -gnatwa. Been around for a long
time now.
No effect of either here (gcc-14.1.0). I see a CONSTRAINT_ERROR at run time when using the uninitialized return value, for indexing an array.
What are some compilers offering today? That is, can they find
declarations of variables that could be constants, if so instructed?
On 21.12.24 09:14, Randy Brukardt wrote:...
Constants do help the compiler generate better code, although a lot of
the
benefits can be gained also by working harder. (That's what C compilers
do,
after all.)
What are some compilers offering today? That is, can they find
declarations
of variables that could be constants, if so instructed?
I put a lot of effort into making sure that all constants are so declared, because I have the rule that (with certain exceptions) no non-local
variables may be referenced from subprograms, but constants may be
referenced from anywhere.
However, I sometimes have constants that cannot be initialized with a
single expression, resulting in
C : T; -- Constant after initialization
Once C has been initialized, I treat it as a constant. Would your approach allow the compiler to know that C is really a constant?
--
Jeff Carter
"Anyone who cannot cope with mathematics
is not fully human."
The Notebooks of Lazarus Long
214
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 44:11:43 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,857,953 |