comp.lang.ada
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Bugged Multiway_Tree package?
@ 2022-06-13 21:49  5% Devin Rozsas
  0 siblings, 0 replies; 15+ results
From: Devin Rozsas @ 2022-06-13 21:49 UTC (permalink / raw)


I've been trying to instantiate `Ada.Containers.Multiway_Trees`, but I was getting some error message like "Value for Disable_Controlled must be static" or something of the sort.
I looked at GNAT's source in `a-comutr.adb`, and indeed, at lines 54 and 79, there are non-static expressions for `Disable_Controlled`.

Both the AdaCore 2021 installer and Fedora's repo versions of GNAT have this in the source-code.

Is this a bug?

^ permalink raw reply	[relevance 5%]

* Re: Unchecked_Deallocation with tagged types
  @ 2022-04-18  1:51  4%                       ` Thomas
  0 siblings, 0 replies; 15+ results
From: Thomas @ 2022-04-18  1:51 UTC (permalink / raw)


In article <s5vpul$ldb$1@franka.jacob-sparre.dk>,
 "Randy Brukardt" <randy@rrsoftware.com> wrote:

> "Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
> news:ie8uagFqaf2U1@mid.individual.net...
> > On 2021-04-20 23:32, Jeffrey R. Carter wrote:
> >> On 4/20/21 8:53 PM, Randy Brukardt wrote:
> >>>
> >>> 'Free makes more sense in a new language (an Ada follow-on).
> >>
> >> Right. I don't think it would be a good idea to add it to Ada.
> >>
> >> But I think a new language should not have pointers at all.
> >>
> >> No more radical than not having arrays.
> >
> > It seems to me that a language without arrays and pointers would be very 
> > difficult to use in an embedded, real-time, close-to-HW context. So we 
> > would lose the nice wide-spectrum nature of Ada.

i like "the nice wide-spectrum nature of Ada" :-)
If I got it right, it is the thickness*, that is, it goes both far in 
low level and far in high level.

* Natacha Porte, https://www.youtube.com/watch?v=b5lRyBRk0d8&t=430s 
(during 1:10 - sorry, it's only in french)


> 
> It's important that a new language have a way to interface to existing 
> hardware and software. So there has to be something that maps to C arrays 
> and pointers (and the equivalent for hardware). But that doesn't necessarily 
> have to be something that is used outside of interfacing. An Ada example is 
> Unchecked_Unions -- they exist for interfacing but shouldn't be used 
> otherwise.

i don't know much "exotic things" (for me) like embedded or real-time 
programming,
but i would not take the risk to exclude users who need low level in 
various cases (not only in interfaces),
so i think it would be better to keep a full thickness with the ability 
to go far in low level at any place it is considered usefull.

> A fixed vector type and a raw general access type would do the 
> trick, but those could be something that are almost never used outside of 
> interfacing packages.

an other point here, is the ability to create new structures that could 
be considered as "basic" later.

for example Ada.Containers.Multiway_Trees seems to be based on 
Ada.Containers.Doubly_Linked_Lists,
and i don't know if it could be needed / usefull to have trees based on 
Ada.Containers.Vectors,
but based on Ada.Containers.Ordered_Maps, certainly!

and sometimes using other high level data structures would be enough, 
but probably sometimes it would be non-optimal, and maybe, in the worst 
case, it could be impossible (especially in the event that we had not 
foreseen all the needed high level data structures)


so, i think:

- we could keep arrays as is, no matter if they are rarly used.

- for access types, it would be nice to find a kind of "controlled 
access type" that allows:
  - to access the "raw general access type", as low level type,
    when needed,
  - to need not Unchecked_Deallocation, making automatic Deallocation,
  - and which would not be too much high level
    (for example Ada.Containers.Indefinite_Holders is fine).

-- 
RAPID maintainer
http://savannah.nongnu.org/projects/rapid/

^ permalink raw reply	[relevance 4%]

* Re: Simple Components: adding an existing object to a graph
  2020-01-26 14:48  5% ` Jeffrey R. Carter
  2020-01-26 15:39  0%   ` Mart van de Wege
@ 2020-01-26 15:49  0%   ` Mart van de Wege
  1 sibling, 0 replies; 15+ results
From: Mart van de Wege @ 2020-01-26 15:49 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> writes:

> On 1/26/20 11:23 AM, Mart van de Wege wrote:
>> This one's for Dimitry, probably: I want to create a genealogy of
>> persons using his generic directed weighted graph package.
>
> Since a genealogy is a tree, wouldn't it make more sense to use
> Ada.Containers.Multiway_Trees?

Side note: A genealogy is only a tree if you only consider matrilineal
or patrilineal descent. A full genealogy is mathematically a Directed
Acyclic Graph.

Mart

-- 
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.


^ permalink raw reply	[relevance 0%]

* Re: Simple Components: adding an existing object to a graph
  2020-01-26 14:48  5% ` Jeffrey R. Carter
@ 2020-01-26 15:39  0%   ` Mart van de Wege
  2020-01-26 15:49  0%   ` Mart van de Wege
  1 sibling, 0 replies; 15+ results
From: Mart van de Wege @ 2020-01-26 15:39 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> writes:

> On 1/26/20 11:23 AM, Mart van de Wege wrote:
>> This one's for Dimitry, probably: I want to create a genealogy of
>> persons using his generic directed weighted graph package.
>
> Since a genealogy is a tree, wouldn't it make more sense to use
> Ada.Containers.Multiway_Trees?

I looked at that first, but how would you model the fact that a child
has 2 parents in a tree? As far as I can see Multiway_Trees is still
stuck in the model that every child node can have only one parent.

My idea was to link nodes, which can have multiple connections, using
the family relationship as a weight (using an enumeration type for the
relationships).

Regards,

Mart

-- 
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.


^ permalink raw reply	[relevance 0%]

* Re: Simple Components: adding an existing object to a graph
  @ 2020-01-26 14:48  5% ` Jeffrey R. Carter
  2020-01-26 15:39  0%   ` Mart van de Wege
  2020-01-26 15:49  0%   ` Mart van de Wege
  0 siblings, 2 replies; 15+ results
From: Jeffrey R. Carter @ 2020-01-26 14:48 UTC (permalink / raw)


On 1/26/20 11:23 AM, Mart van de Wege wrote:
> This one's for Dimitry, probably: I want to create a genealogy of
> persons using his generic directed weighted graph package.

Since a genealogy is a tree, wouldn't it make more sense to use 
Ada.Containers.Multiway_Trees?

-- 
Jeff Carter
"Perfidious English mouse-dropping hoarders."
Monty Python & the Holy Grail
10

^ permalink raw reply	[relevance 5%]

* Re: recursive map specification
  2019-06-25  9:22  0%     ` Egil H H
@ 2019-06-25  9:24  0%       ` mario.blunk.gplus
  0 siblings, 0 replies; 15+ results
From: mario.blunk.gplus @ 2019-06-25  9:24 UTC (permalink / raw)


On Tuesday, June 25, 2019 at 11:22:25 AM UTC+2, Egil H H wrote:
> On Tuesday, June 25, 2019 at 11:09:20 AM UTC+2, mario.b...@gmail.com wrote:
> > On Tuesday, June 25, 2019 at 10:44:11 AM UTC+2, Egil H H wrote:
> > > On Tuesday, June 25, 2019 at 10:21:03 AM UTC+2, mario.b...@gmail.com wrote:
> > > > Hello,
> > > > 
> > > > I want to specify a recursive map. To simplify the problem I use the example of a person and its ancestors and ancestors ... The problem does not seem special but I haven't found a solution. The approach below does not compile:
> > > > 
> > > > type person is record
> > > >  name : unbounded_string;
> > > > end record;
> > > > 
> > > > package tree is new ordered_maps 
> > > >  (
> > > >  key_type => person,
> > > >  element_type => tree.map -- compiler error. "tree" undefined
> > > >  );
> > > > 
> > > > Any ideas ? Thanks a lot !
> > > 
> > > 
> > > Is there a reason you don't use Ada.Containers.Multiway_Trees instead?
> > > 
> > > 
> > > -- 
> > > ~egilhh
> > 
> > It is the first time I read about multiway_trees. Do you have a simple example ready ? Otherwise I would dig into the package docs which lack practical examples... Thanks
> 
> 
> Sorry, I haven't used that package myself, but there's some additional explanation and example in the Rationale, http://www.ada-auth.org/standards/12rat/html/Rat12-8-4.html
> 
> 
> -- 
> ~egilhh

Yep, I just found that too. Thanks. Time for reading :-)


^ permalink raw reply	[relevance 0%]

* Re: recursive map specification
  2019-06-25  9:09  0%   ` mario.blunk.gplus
@ 2019-06-25  9:22  0%     ` Egil H H
  2019-06-25  9:24  0%       ` mario.blunk.gplus
  0 siblings, 1 reply; 15+ results
From: Egil H H @ 2019-06-25  9:22 UTC (permalink / raw)


On Tuesday, June 25, 2019 at 11:09:20 AM UTC+2, mario.b...@gmail.com wrote:
> On Tuesday, June 25, 2019 at 10:44:11 AM UTC+2, Egil H H wrote:
> > On Tuesday, June 25, 2019 at 10:21:03 AM UTC+2, mario.b...@gmail.com wrote:
> > > Hello,
> > > 
> > > I want to specify a recursive map. To simplify the problem I use the example of a person and its ancestors and ancestors ... The problem does not seem special but I haven't found a solution. The approach below does not compile:
> > > 
> > > type person is record
> > >  name : unbounded_string;
> > > end record;
> > > 
> > > package tree is new ordered_maps 
> > >  (
> > >  key_type => person,
> > >  element_type => tree.map -- compiler error. "tree" undefined
> > >  );
> > > 
> > > Any ideas ? Thanks a lot !
> > 
> > 
> > Is there a reason you don't use Ada.Containers.Multiway_Trees instead?
> > 
> > 
> > -- 
> > ~egilhh
> 
> It is the first time I read about multiway_trees. Do you have a simple example ready ? Otherwise I would dig into the package docs which lack practical examples... Thanks


Sorry, I haven't used that package myself, but there's some additional explanation and example in the Rationale, http://www.ada-auth.org/standards/12rat/html/Rat12-8-4.html


-- 
~egilhh

^ permalink raw reply	[relevance 0%]

* Re: recursive map specification
  2019-06-25  8:44  5% ` Egil H H
@ 2019-06-25  9:09  0%   ` mario.blunk.gplus
  2019-06-25  9:22  0%     ` Egil H H
  0 siblings, 1 reply; 15+ results
From: mario.blunk.gplus @ 2019-06-25  9:09 UTC (permalink / raw)


On Tuesday, June 25, 2019 at 10:44:11 AM UTC+2, Egil H H wrote:
> On Tuesday, June 25, 2019 at 10:21:03 AM UTC+2, mario.b...@gmail.com wrote:
> > Hello,
> > 
> > I want to specify a recursive map. To simplify the problem I use the example of a person and its ancestors and ancestors ... The problem does not seem special but I haven't found a solution. The approach below does not compile:
> > 
> > type person is record
> >  name : unbounded_string;
> > end record;
> > 
> > package tree is new ordered_maps 
> >  (
> >  key_type => person,
> >  element_type => tree.map -- compiler error. "tree" undefined
> >  );
> > 
> > Any ideas ? Thanks a lot !
> 
> 
> Is there a reason you don't use Ada.Containers.Multiway_Trees instead?
> 
> 
> -- 
> ~egilhh

It is the first time I read about multiway_trees. Do you have a simple example ready ? Otherwise I would dig into the package docs which lack practical examples... Thanks

^ permalink raw reply	[relevance 0%]

* Re: recursive map specification
  @ 2019-06-25  8:44  5% ` Egil H H
  2019-06-25  9:09  0%   ` mario.blunk.gplus
  0 siblings, 1 reply; 15+ results
From: Egil H H @ 2019-06-25  8:44 UTC (permalink / raw)


On Tuesday, June 25, 2019 at 10:21:03 AM UTC+2, mario.b...@gmail.com wrote:
> Hello,
> 
> I want to specify a recursive map. To simplify the problem I use the example of a person and its ancestors and ancestors ... The problem does not seem special but I haven't found a solution. The approach below does not compile:
> 
> type person is record
>  name : unbounded_string;
> end record;
> 
> package tree is new ordered_maps 
>  (
>  key_type => person,
>  element_type => tree.map -- compiler error. "tree" undefined
>  );
> 
> Any ideas ? Thanks a lot !


Is there a reason you don't use Ada.Containers.Multiway_Trees instead?


-- 
~egilhh

^ permalink raw reply	[relevance 5%]

* Re: How to use Multiway_Trees
  2017-04-09 15:36  7% How to use Multiway_Trees Mart van de Wege
@ 2017-04-09 16:27  0% ` Niklas Holsti
  0 siblings, 0 replies; 15+ results
From: Niklas Holsti @ 2017-04-09 16:27 UTC (permalink / raw)


On 17-04-09 18:36 , Mart van de Wege wrote:
> I was interested in using Ada.Containers.Multiway_Trees in another
> project, so I wrote some Proof of Concept code to see if I understood
> correctly how to use it.
>
> However, even the most simple use case, the following code, raises a
> Program_Error:
>
> raised PROGRAM_ERROR : Tree_Test.Test_Tree.Replace_Element: Position cursor designates root
>
> with Ada.Text_Io;
> with Ada.Containers.Multiway_Trees;
> procedure Test_Tree is
>    type String_Access is access String;
>    package Tr is new Ada.Containers.Multiway_Trees
>      ( Element_Type => String_Access );
>    use Tr;
>    T : Tree := Empty_Tree;
>    C : Cursor := Root(T);
> begin
>    T.Insert_Child(Parent => C,
>                   Before => No_Element,
>                   New_Item => new String'("Test"));
> end Test_Tree;
>
> How do I create a tree if I can't even insert a child under the root
> node?
>
> Mart

That code works (no exceptions, and T.Node_Count = 2 after the 
Insert_Child) on my system, which is a Mac OS X 10.8.5 with GNAT GPL 
2012 (old, yes...).

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .


^ permalink raw reply	[relevance 0%]

* How to use Multiway_Trees
@ 2017-04-09 15:36  7% Mart van de Wege
  2017-04-09 16:27  0% ` Niklas Holsti
  0 siblings, 1 reply; 15+ results
From: Mart van de Wege @ 2017-04-09 15:36 UTC (permalink / raw)


I was interested in using Ada.Containers.Multiway_Trees in another
project, so I wrote some Proof of Concept code to see if I understood
correctly how to use it.

However, even the most simple use case, the following code, raises a
Program_Error:

raised PROGRAM_ERROR : Tree_Test.Test_Tree.Replace_Element: Position cursor designates root

with Ada.Text_Io;
with Ada.Containers.Multiway_Trees;
procedure Test_Tree is
   type String_Access is access String;
   package Tr is new Ada.Containers.Multiway_Trees
     ( Element_Type => String_Access );
   use Tr;
   T : Tree := Empty_Tree;
   C : Cursor := Root(T);
begin
   T.Insert_Child(Parent => C,
                  Before => No_Element,
                  New_Item => new String'("Test"));
end Test_Tree;

How do I create a tree if I can't even insert a child under the root
node?

Mart

-- 
"We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.


^ permalink raw reply	[relevance 7%]

* Re: BDD package in Ada.
  @ 2015-04-08 21:20  5%   ` Randy Brukardt
  0 siblings, 0 replies; 15+ results
From: Randy Brukardt @ 2015-04-08 21:20 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:1miph3v72f4y2$.1u76w2ujg74zf$.dlg@40tude.net...
...
> I don't think structures like trees and directed graphs could be packed in
> a library.

Of course, Ada has Ada.Containers.Multiway_Trees, so it's pretty clear that 
trees *can* be in a library. It wouldn't be hard to do something similar for 
more general directed graphs. Whether that's useful or not I'll leave others 
to judge. (It does match many things in my work, but nothing since it was 
added to Ada, so I've never had an opportunity to use it.)

                                         Randy.



^ permalink raw reply	[relevance 5%]

* Re: Ada & Ontology ( OWL,RDF, JSON, dot)
  @ 2013-07-16  0:35  5%   ` Randy Brukardt
  0 siblings, 0 replies; 15+ results
From: Randy Brukardt @ 2013-07-16  0:35 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:pgggo3irufxz$.mbvohwd9o6qd.dlg@40tude.net...
> On Sun, 14 Jul 2013 23:36:22 -0700 (PDT), Peter Brooks wrote:
>
>> Alternatively, is there a good Ada package for handling directed graphs?
>
> Well, it is difficult to provide a universal implementation of graphs.
> Usually, you would needs a custom implementation.

Right. If your graph doesn't have any cycles (that is, it's a tree), then 
Ada.Containers.Multiway_Trees is the way to go (because it's part of the Ada 
Standard). Most of the data structures that I've needed can be described as 
a tree (possibility with a bit of rethinking), which is why we put that 
container into the Ada Standard.

                                 Randy.






^ permalink raw reply	[relevance 5%]

* Re: Inventors of the Holder container
  @ 2011-09-30  1:58  4%   ` Randy Brukardt
  0 siblings, 0 replies; 15+ results
From: Randy Brukardt @ 2011-09-30  1:58 UTC (permalink / raw)


"Jeffrey Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:j62cmj$gof$1@tornado.tornevall.net...
> On 09/29/2011 07:34 AM, marius63 wrote:
>> "I've been using this 'holder' approach for years." (Alex Mosteo, in 
>> another thread)
>>
>> Me too. But I've got proof :-)
>>
>> "... the simplest way is to make your own with any other of the standard 
>> containers..." (Alex)
>>
>> Curiously enough, exactly how I proposed it.
>
> I think this is one of those "obvious" things that has been (re-)invented 
> many times by many people.

Right. Pretty much everything about containers has been (re-)invented over 
and over and over...

Not being able to read other people's minds, but my recollection is that the 
holder container came up pretty organically in the ARG, while we were 
discussing a problem with the use of the proposed ASIS semantic interface. 
We had examples that needed to store class-wide objects as local variable, 
and someone suggested that a container could be used to store them. And then 
someone suggested that such a container should be part of the standard 
library. And someone was assigned to make a formal proposal.

Note that an important part of the Ada.Containers packages was to suggest a 
layout for such packages, and pretty much every new package proposed 
following that layout is going to look the same.

In any case, if you want credit for some package in the Standard, you need 
to present a proposal including RM-quality wording. Ideas are a 
dime-a-dozen -- everyone has proposed some package or other, but only a few 
have gone to the hard work of providing RM wording for them. (And then gone 
through the bloody process of getting the ARG to like your work.) I've done 
two (Ada.Directories and Ada.Containers.Multiway_Trees) -- and proposing new 
features like expression functions was not half as hard. (Part of the 
problem is that everyone has an opinion on the right way to design packages; 
that's much less true for language features.) I have an amazing amount of 
respect for Matt Heaney's efforts in getting Ada.Containers into language 
form in the first place -- because I realize how hard it is to have people 
continually pick at your best efforts, finding flaws that you're not even 
sure are flaws.

                                                  Randy.





^ permalink raw reply	[relevance 4%]

* Re: ada commercial options
  @ 2011-04-23  0:50  5%             ` Randy Brukardt
  0 siblings, 0 replies; 15+ results
From: Randy Brukardt @ 2011-04-23  0:50 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message 
news:m2zknivnht.fsf@pushface.org...
> "Randy Brukardt" <randy@rrsoftware.com> writes:
>
>>>  2. Avoid gnat-specific libraries.
>>
>> This also is caught by the above profile.
>
> Unless a compiler has a special "don't allow 'with GNAT'" rule, I don't
> see how it can do this?
>
> Or is it that vendors are expected to disallow use of their own
> non-standard libraries?

The restriction only applies to children of the language defined packages, 
since things like "with GNAT" are trivial to find and eliminate. Children of 
Ada, System, and Interfaces are difficult to tell language-defined ones from 
implementation-defined ones (especially as we keep adding them in each new 
language version - an Ada 95 program depending on 
Ada.Containers.Multiway_Trees is looking for trouble).

But for children of the language-defined packages, the answer is yes, they 
are supposed to disallow (when the restriction is present) use of their own 
non-standard libraries. That's the whole point.

                                 Randy.







^ permalink raw reply	[relevance 5%]

Results 1-15 of 15 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2011-04-18 18:21     ada commercial options tonyg
2011-04-18 18:49     ` Vinzent Hoefler
2011-04-19  7:37       ` Maciej Sobczak
2011-04-20 23:24         ` Randy Brukardt
2011-04-21  8:08           ` stefan-lucks
2011-04-21 23:42             ` Randy Brukardt
2011-04-22  5:55               ` Simon Wright
2011-04-23  0:50  5%             ` Randy Brukardt
2011-09-29 14:34     Inventors of the Holder container marius63
2011-09-29 18:10     ` Jeffrey Carter
2011-09-30  1:58  4%   ` Randy Brukardt
2013-07-15  6:36     Ada & Ontology ( OWL,RDF, JSON, dot) Peter Brooks
2013-07-15  7:14     ` Dmitry A. Kazakov
2013-07-16  0:35  5%   ` Randy Brukardt
2015-04-07 20:35     BDD package in Ada Vincent DIEMUNSCH
2015-04-08  6:38     ` Dmitry A. Kazakov
2015-04-08 21:20  5%   ` Randy Brukardt
2017-04-09 15:36  7% How to use Multiway_Trees Mart van de Wege
2017-04-09 16:27  0% ` Niklas Holsti
2019-06-25  8:21     recursive map specification mario.blunk.gplus
2019-06-25  8:44  5% ` Egil H H
2019-06-25  9:09  0%   ` mario.blunk.gplus
2019-06-25  9:22  0%     ` Egil H H
2019-06-25  9:24  0%       ` mario.blunk.gplus
2020-01-26 10:23     Simple Components: adding an existing object to a graph Mart van de Wege
2020-01-26 14:48  5% ` Jeffrey R. Carter
2020-01-26 15:39  0%   ` Mart van de Wege
2020-01-26 15:49  0%   ` Mart van de Wege
2021-04-17 21:45     Unchecked_Deallocation with tagged types DrPi
2021-04-18  8:21     ` Dmitry A. Kazakov
2021-04-18  8:46       ` Gautier write-only address
2021-04-18  9:09         ` Jeffrey R. Carter
2021-04-18 10:20           ` J-P. Rosen
2021-04-18 10:34             ` Dmitry A. Kazakov
2021-04-18 15:14               ` J-P. Rosen
2021-04-18 15:23                 ` Gautier write-only address
2021-04-20 18:53                   ` Randy Brukardt
2021-04-20 20:32                     ` Jeffrey R. Carter
2021-04-20 21:10                       ` Niklas Holsti
2021-04-24  0:49                         ` Randy Brukardt
2022-04-18  1:51  4%                       ` Thomas
2022-06-13 21:49  5% Bugged Multiway_Tree package? Devin Rozsas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox