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.36.224.204 with SMTP id c195mr5345422ith.55.1512809627349; Sat, 09 Dec 2017 00:53:47 -0800 (PST) X-Received: by 10.157.42.99 with SMTP id t90mr1391597ota.5.1512809626225; Sat, 09 Dec 2017 00:53:46 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer03.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!193no856197itr.0!news-out.google.com!b73ni2008ita.0!nntp.google.com!193no856195itr.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 9 Dec 2017 00:53:46 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=68.147.43.80; posting-account=GO34ygoAAABjKWQJiUlszgvYtyWwgCPW NNTP-Posting-Host: 68.147.43.80 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: I am leaving Ada :-( because of GNAT bugs From: bj.mooremr@gmail.com Injection-Date: Sat, 09 Dec 2017 08:53:47 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 7148 X-Received-Body-CRC: 1043994233 Xref: reader02.eternal-september.org comp.lang.ada:49430 Date: 2017-12-09T00:53:46-08:00 List-Id: On Thursday, December 7, 2017 at 12:45:11 AM UTC-7, Victor Porton wrote: > Yet one mysterious bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D83= 310 >=20 > I am leaving Ada and try to learn Rust or D, or maybe even code in C#=20 > instead. >=20 > I cannot tolerate GNAT bugs anymore. >=20 > For the last bug I simply don't know what is a workaround. >=20 > --=20 > Victor Porton - http://portonvictor.org I had a look at your sources, and managed to get it to compile with some fi= ddling. I did not encounter the compiler crash that you ran into, but there= were a fair number of syntax errors in your sources. I am not sure which version of GNAT you are using, GPL for FSF. Both are go= od quality compilers, but if you are running into compiler bugs in one, it = might be worth trying your source in the other. For your source code, I was= trying it out with GNAT GPL 2017. The other point to mention is that it has been my experience that if the co= mpiler is crashing, it generally means I am trying to do something really w= eird and not allowed in Ada, or doing something allowed but convoluted, or = not elegant, and there is a better way to do the same thing. Here are some of the main problems I found with the source. 1. Many bodies of packages were missing. To get these, I used the "Generate= Body", utility from the GPS IDE, which generated most of these. I eventual= ly got it to generate all the bodies, once I fixed the issues below.=20 2. For a number of the tagged types, the Parse function had the controlling= parameter as the second parameter. I think Ada might allow that, but I gen= erally put the controlling parameter (the one that has the same type as the= tagged type), at the beginning as the first parameter. It's a convention I= always use, which I think helps readability, if nothing else. It may be th= at the compiler has better support for name resolution if you follow this c= onvention, but I really dont know, as I never code that way. I tried to loo= k this up in the RM, but couldnt not find a rule that says the controlling = parameters need to come first. 3. Parse in Boilder.RDF_Format.Resource.Parser is missing a return statemen= t, and the parameters in the body do not match the ones in the spec. 4. I would not put not overriding clauses on a primitive function that is a= root type. If it is a root type, it cant be overriding anything. Having "n= ot overriding" clauses on a root type might be weird enough that the compil= er doesn't support that very well. I would get rid of those. 5. In RDF-auxiliary-limited_handled_record, you have a nested generic packa= ge, called Common_Handlers where there is a type derived from a generic for= mal type that is in turn derived from a type of the enclosing package. On t= he nested type declaration you are overriding the Finalize procedure as a c= ontrolled type, but doing that as a rename of a function in the enclosing p= ackage. That strikes me as likely something that the compiler might have tr= ouble with. In fact, it was complaining about that line for me, but gave a = compiler error, not a crash. I fixed that by not declaring as a rename, but making it an actual procedur= e, then having that call the other function of the enclosing package in the= body of Finalize. 6. In RDF.Raptor.Term, There are 3 subtypes declared of a tagged type, befo= re all the primitive functions of the tagged type were declared. That might= be OK, but I'd be concerned about freezing rules, and in any case, I think= it is better form and more readable to move the subtype declarations down = further to after all the primitive functions of the tagged type that they a= re subtypes of have been declared. 7. In the same area, you declare a subtype of an access type declared in an= other package, then try to override a primitive of a type from that other p= ackage, but using the subtype declared in the new package. I believe you ne= ed exact matching on the subtypes passed to the overridden package, for non= -controlling parameters, which means you should declare your overriden func= tion using the access type declared in the original package. 8. You have several places where you declare a subtype with Dynamic_Predica= tes eg. subtype URI_Term_Type_Without_Finalize is Term_Type_Without_Finalize with Dynamic_Predicate =3D> Is_URI(URI_Term_Type_Without_Finalize); where Is_URI is a primitive function of the tagged type. I am not sure if i= t is legal to do it that way, but GNAT did not like this. I would use objec= t prefix notation, which I think is more readable in this case and makes it= more obvious that Is_URI is a primitive of the type. ie. subtype URI_Term_Type_Without_Finalize is Term_Type_Without_Finalize with Dynamic_Predicate =3D> URI_Term_Type_Without_Finalize.Is_URI; GNAT is happy if you do it this way. 9. In rdf-redland-query_results.ads, you declare a type derived from a tagg= ed type, but then try to apply a Pre'Class aspect. This apparently is not l= egal, though the GPL 2016 compiler doesn't complain. I ran into this, with = my own code, that GPL 2017 told me with a compiler error that the code was = not legal. Pre'Class can only be applied to a root type apparently. To fix that, change Pre'Class =3D> to just Pre =3D>=20 That might be the issue that is actually causing the compiler to crash, if = you are using the FSF GNAT. It might not have this check yet, and might hav= e trouble generating the code. Once I made these changes, the sources compiled. I had to create my own mai= n program, because I couldn't see a main in your sources, nor did I see a p= roject file, so I created a simple one from scratch. Hopefully this will get you to reconsider your decision to leave Ada.=20 I have done a little bit in Rust, and considerably more in C#. =20 For me, Ada is still by far the best choice, but you can come to your own c= onclusions. :-)=20 Brad