comp.lang.ada
 help / color / mirror / Atom feed
* gnoga build fails on Mac
@ 2020-06-21  7:57 Roger
  2020-06-21  8:41 ` Dmitry A. Kazakov
  2020-06-21 14:24 ` Jeffrey R. Carter
  0 siblings, 2 replies; 20+ messages in thread
From: Roger @ 2020-06-21  7:57 UTC (permalink / raw)


Mac Mini (2018)
OSX 10.15.5
XCode 11.5
GNAT  Community Edition 2020

Attempting to build git clone git://git.code.sf.net/p/gnoga/code gnoga.

First problem with -gnat05 flag which I overcame but probably not the correct way.
Second, killer, problem:
object-handle.adb:153:22: access attribute cannot be used as actual for universal_access equality
object-handle.adb:163:23: access attribute cannot be used as actual for universal_access equality

How can I fix this?
Thanks for any constructive advice.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-21  7:57 gnoga build fails on Mac Roger
@ 2020-06-21  8:41 ` Dmitry A. Kazakov
  2020-06-21 11:18   ` Roger
  2020-06-21 14:24 ` Jeffrey R. Carter
  1 sibling, 1 reply; 20+ messages in thread
From: Dmitry A. Kazakov @ 2020-06-21  8:41 UTC (permalink / raw)


On 21/06/2020 09:57, Roger wrote:
> Mac Mini (2018)
> OSX 10.15.5
> XCode 11.5
> GNAT  Community Edition 2020
> 
> Attempting to build git clone git://git.code.sf.net/p/gnoga/code gnoga.
> 
> First problem with -gnat05 flag which I overcame but probably not the correct way.
> Second, killer, problem:
> object-handle.adb:153:22: access attribute cannot be used as actual for universal_access equality
> object-handle.adb:163:23: access attribute cannot be used as actual for universal_access equality
> 
> How can I fix this?

GNAT CE 2020 does not accept comparisons like:

    procedure Foo (X : access T) is
    begin
       ...
       if Y'Access = X then
       ...

I cannot say anything about legality of such comparisons, maybe the 
change is related to the upcoming standard, maybe it was never legal.

The latest version 4.50 of the Simple Components fixes the issue by 
replacing access types comparison with by address comparison. [*]

    http://www.dmitry-kazakov.de/ada/components.htm

Replace the offending source files and it should compile again.

-------------------
* I don't know the motivation behind forbidding comparison of access 
attribute, probably some obscure unlikely portability case. Comparing 
addresses would be less safe, for sure, but not much.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-21  8:41 ` Dmitry A. Kazakov
@ 2020-06-21 11:18   ` Roger
  2020-06-21 13:28     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 20+ messages in thread
From: Roger @ 2020-06-21 11:18 UTC (permalink / raw)


On Sunday, June 21, 2020 at 6:41:58 PM UTC+10, Dmitry A. Kazakov wrote:
> On 21/06/2020 09:57, Roger wrote:
> > Mac Mini (2018)
> > OSX 10.15.5
> > XCode 11.5
> > GNAT  Community Edition 2020
> > 
> > Attempting to build git clone git://git.code.sf.net/p/gnoga/code gnoga.
> > 
> > First problem with -gnat05 flag which I overcame but probably not the correct way.
> > Second, killer, problem:
> > object-handle.adb:153:22: access attribute cannot be used as actual for universal_access equality
> > object-handle.adb:163:23: access attribute cannot be used as actual for universal_access equality
> > 
> > How can I fix this?
> 
> GNAT CE 2020 does not accept comparisons like:
> 
>     procedure Foo (X : access T) is
>     begin
>        ...
>        if Y'Access = X then
>        ...
> 
> I cannot say anything about legality of such comparisons, maybe the 
> change is related to the upcoming standard, maybe it was never legal.
> 
> The latest version 4.50 of the Simple Components fixes the issue by 
> replacing access types comparison with by address comparison. [*]
> 
>     http://www.dmitry-kazakov.de/ada/components.htm
> 
> Replace the offending source files and it should compile again.
> 
> -------------------
> * I don't know the motivation behind forbidding comparison of access 
> attribute, probably some obscure unlikely portability case. Comparing 
> addresses would be less safe, for sure, but not much.
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Thanks,
That problem is fixed.
However, I now have another problem that I don't know how to fix that is not part of Simple Components but presumably due to GNAT CE 2020 restrictions.
gnoga-gui-view-docker.adb:117:40: implicit conversion of anonymous access parameter not allowed
and other similar errors in gnoga-gui-view-docker.adb:117:40

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-21 11:18   ` Roger
@ 2020-06-21 13:28     ` Dmitry A. Kazakov
  2020-06-22  3:15       ` Roger
  0 siblings, 1 reply; 20+ messages in thread
From: Dmitry A. Kazakov @ 2020-06-21 13:28 UTC (permalink / raw)


On 21/06/2020 13:18, Roger wrote:

> However, I now have another problem that I don't know how to fix that is not part of Simple Components but presumably due to GNAT CE 2020 restrictions.
> gnoga-gui-view-docker.adb:117:40: implicit conversion of anonymous access parameter not allowed
> and other similar errors in gnoga-gui-view-docker.adb:117:40

I looked shortly at the gnoga sources, you could try to replace

    View.Element_Map.Include ("top", Dock);

with

    View.Element_Map.Include ("top", Dock.all'Unchecked_Access);

P.S. gnoga uses universal access for pointers in containers. I always 
avoided doing this preferring pool-specific access types. So I had to 
deal with the restriction on anonymous access from the beginning. 
Basically in my code I presume that a pointer cannot be obtained either 
from the object or from an anonymous access to the object. Now this hits 
all code which had chosen an easier path.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-21  7:57 gnoga build fails on Mac Roger
  2020-06-21  8:41 ` Dmitry A. Kazakov
@ 2020-06-21 14:24 ` Jeffrey R. Carter
  2020-06-21 16:46   ` Simon Wright
  1 sibling, 1 reply; 20+ messages in thread
From: Jeffrey R. Carter @ 2020-06-21 14:24 UTC (permalink / raw)


On 6/21/20 9:57 AM, Roger wrote:
> 
> First problem with -gnat05 flag which I overcame but probably not the correct way.

Certainly not the correct way. Gnoga is in Ada 12 and should not be compiled 
with an earlier version of the language. Note the --gnat2012 switch in 
settings.gpr to ensure this. The same functionality could be implemented in 
earlier versions of Ada, but if you do that, then we can't know if your problems 
are due to your changes or something else.

Compiling Gnoga with --gnat2012 doesn't necessarily mean that you can't compile 
your code with -gnat05, but again, it makes it harder to understand any problems 
you may encounter.

-- 
Jeff Carter
"Beyond 100,000 lines of code you
should probably be coding in Ada."
P. J. Plauger
26

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-21 14:24 ` Jeffrey R. Carter
@ 2020-06-21 16:46   ` Simon Wright
  0 siblings, 0 replies; 20+ messages in thread
From: Simon Wright @ 2020-06-21 16:46 UTC (permalink / raw)


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

> On 6/21/20 9:57 AM, Roger wrote:
>>
>> First problem with -gnat05 flag which I overcame but probably not
>> the correct way.

What problem? No mention of -gnat05 in the gnoga tree?

> Certainly not the correct way. Gnoga is in Ada 12 and should not be
> compiled with an earlier version of the language. Note the --gnat2012
> switch in settings.gpr to ensure this. The same functionality could be
> implemented in earlier versions of Ada, but if you do that, then we
> can't know if your problems are due to your changes or something else.
>
> Compiling Gnoga with --gnat2012 doesn't necessarily mean that you
> can't compile your code with -gnat05, but again, it makes it harder to
> understand any problems you may encounter.

And you can't use GNAT CE 2020 to compile other than with -gnat2012
(which is the default)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-21 13:28     ` Dmitry A. Kazakov
@ 2020-06-22  3:15       ` Roger
  2020-06-22  5:56         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 20+ messages in thread
From: Roger @ 2020-06-22  3:15 UTC (permalink / raw)


In reply to Sunday, June 21, 2020 at 11:28:18 PM UTC+10, Dmitry A. Kazakov wrote:

Thanks, that worked. A similar problem occurred with Gnoga.Gui.View.adb.
Additional problems:
demo/db_maker/movies.adb
"equality operator must be declared before type "Movie_Info" is frozen (RM 4.5.2 (9.8)) (Ada 2012)"
I couldn't figure out how to fix this so I removed this demo from the build.
deps/zanyblue
Numerous style warnings which I fixed, except for zanyblue-text-codecs.adb which were numerous so I used pragma Warnings (Off);
deps/zanyblue/src/zbmcompile
Numerous style warnings which I fixed.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-22  3:15       ` Roger
@ 2020-06-22  5:56         ` Dmitry A. Kazakov
  2020-06-22  6:14           ` Roger
  2020-06-22 11:37           ` Jeffrey R. Carter
  0 siblings, 2 replies; 20+ messages in thread
From: Dmitry A. Kazakov @ 2020-06-22  5:56 UTC (permalink / raw)


On 22/06/2020 05:15, Roger wrote:
> In reply to Sunday, June 21, 2020 at 11:28:18 PM UTC+10, Dmitry A. Kazakov wrote:
> 
> Thanks, that worked. A similar problem occurred with Gnoga.Gui.View.adb.
> Additional problems:
> demo/db_maker/movies.adb
> "equality operator must be declared before type "Movie_Info" is frozen (RM 4.5.2 (9.8)) (Ada 2012)"
> I couldn't figure out how to fix this so I removed this demo from the build.

That looks like a compiler bug to me. But what happens when you do 
declarations first. E.g. replace

type Movie_Info is record
    Title       : Strng;
    Year        : Strng;
    Director    : Strng;
    Writer      : Strng;
    Male_Lead   : Strng;
    Female_Lead : Strng;
end record;

function "=" (Left : Movie_Info; Right : Movie_Info) return Boolean is
    ...
end "=";

function "<" (Left : Movie_Info; Right : Movie_Info) return Boolean is
    ...
end "<";

...

with


type Movie_Info is record
    Title       : Strng;
    Year        : Strng;
    Director    : Strng;
    Writer      : Strng;
    Male_Lead   : Strng;
    Female_Lead : Strng;
end record;

-- Declarations first
function "=" (Left : Movie_Info; Right : Movie_Info) return Boolean;
function "<" (Left : Movie_Info; Right : Movie_Info) return Boolean;
...

-- All bodies
function "=" (Left : Movie_Info; Right : Movie_Info) return Boolean is
    ...
end "=";

function "<" (Left : Movie_Info; Right : Movie_Info) return Boolean is
    ...
end "<";
...

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-22  5:56         ` Dmitry A. Kazakov
@ 2020-06-22  6:14           ` Roger
  2020-06-22 11:37           ` Jeffrey R. Carter
  1 sibling, 0 replies; 20+ messages in thread
From: Roger @ 2020-06-22  6:14 UTC (permalink / raw)


In reply to: On Monday, June 22, 2020 at 3:56:19 PM UTC+10, Dmitry A. Kazakov:

Yes! that did the trick.
demo/db_maker now builds and runs.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-22  5:56         ` Dmitry A. Kazakov
  2020-06-22  6:14           ` Roger
@ 2020-06-22 11:37           ` Jeffrey R. Carter
  2020-06-22 23:25             ` Roger
  2020-06-29  0:55             ` Randy Brukardt
  1 sibling, 2 replies; 20+ messages in thread
From: Jeffrey R. Carter @ 2020-06-22 11:37 UTC (permalink / raw)


On 6/22/20 7:56 AM, Dmitry A. Kazakov wrote:
> On 22/06/2020 05:15, Roger wrote:
>>
>> demo/db_maker/movies.adb
>> "equality operator must be declared before type "Movie_Info" is frozen (RM 
>> 4.5.2 (9.8)) (Ada 2012)"
> 
> That looks like a compiler bug to me. 

I agree. What happens if you change "=" from an expression function to a regular 
function?

-- 
Jeff Carter
"Death awaits you all, with nasty, big, pointy teeth!"
Monty Python & the Holy Grail
20

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-22 11:37           ` Jeffrey R. Carter
@ 2020-06-22 23:25             ` Roger
  2020-06-23 11:27               ` Jeffrey R. Carter
  2020-06-29  0:55             ` Randy Brukardt
  1 sibling, 1 reply; 20+ messages in thread
From: Roger @ 2020-06-22 23:25 UTC (permalink / raw)


On Monday, June 22, 2020 at 9:37:26 PM UTC+10, Jeffrey R. Carter wrote:
> On 6/22/20 7:56 AM, Dmitry A. Kazakov wrote:
> > On 22/06/2020 05:15, Roger wrote:
> >>
> >> demo/db_maker/movies.adb
> >> "equality operator must be declared before type "Movie_Info" is frozen (RM 
> >> 4.5.2 (9.8)) (Ada 2012)"
> > 
> > That looks like a compiler bug to me. 
> 
> I agree. What happens if you change "=" from an expression function to a regular 
> function?
> 
> -- 
> Jeff Carter
> "Death awaits you all, with nasty, big, pointy teeth!"
> Monty Python & the Holy Grail
> 20

Fixed by declaring functions first per Dmitry's suggestion.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-22 23:25             ` Roger
@ 2020-06-23 11:27               ` Jeffrey R. Carter
  0 siblings, 0 replies; 20+ messages in thread
From: Jeffrey R. Carter @ 2020-06-23 11:27 UTC (permalink / raw)


On 6/23/20 1:25 AM, Roger wrote:
> 
> Fixed by declaring functions first per Dmitry's suggestion.

Not fixed. Worked around.

I'm wondering if the compiler error is related to expression functions, or to 
subprogram bodies in general.

-- 
Jeff Carter
"I like it when the support group complains that they have
insufficient data on mean time to repair bugs in Ada software."
Robert I. Eachus
91

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-22 11:37           ` Jeffrey R. Carter
  2020-06-22 23:25             ` Roger
@ 2020-06-29  0:55             ` Randy Brukardt
  2020-06-29  8:29               ` Jeffrey R. Carter
  1 sibling, 1 reply; 20+ messages in thread
From: Randy Brukardt @ 2020-06-29  0:55 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:rcq55l$r03$1@dont-email.me...
> On 6/22/20 7:56 AM, Dmitry A. Kazakov wrote:
>> On 22/06/2020 05:15, Roger wrote:
>>>
>>> demo/db_maker/movies.adb
>>> "equality operator must be declared before type "Movie_Info" is frozen 
>>> (RM 4.5.2 (9.8)) (Ada 2012)"
>>
>> That looks like a compiler bug to me.
>
> I agree. What happens if you change "=" from an expression function to a 
> regular function?

It is illegal either way. This was an incompatible change in Ada 2012; it 
stems from the fact that "=" of untagged records composes in Ada 2012 but 
not in earlier versions of Ada. Composition cannot be view dependent, and as 
such we cannot allow "late" declarations of operators where some users would 
not see the redefined operator.

                            Randy.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-29  0:55             ` Randy Brukardt
@ 2020-06-29  8:29               ` Jeffrey R. Carter
  2020-07-01  1:09                 ` Randy Brukardt
  0 siblings, 1 reply; 20+ messages in thread
From: Jeffrey R. Carter @ 2020-06-29  8:29 UTC (permalink / raw)


On 6/29/20 2:55 AM, Randy Brukardt wrote:
> "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message
> news:rcq55l$r03$1@dont-email.me...
>> On 6/22/20 7:56 AM, Dmitry A. Kazakov wrote:
>>> On 22/06/2020 05:15, Roger wrote:
>>>>
>>>> demo/db_maker/movies.adb
>>>> "equality operator must be declared before type "Movie_Info" is frozen
>>>> (RM 4.5.2 (9.8)) (Ada 2012)"
>>>
>>> That looks like a compiler bug to me.
>>
>> I agree. What happens if you change "=" from an expression function to a
>> regular function?
> 
> It is illegal either way. This was an incompatible change in Ada 2012; it
> stems from the fact that "=" of untagged records composes in Ada 2012 but
> not in earlier versions of Ada. Composition cannot be view dependent, and as
> such we cannot allow "late" declarations of operators where some users would
> not see the redefined operator.

The declaration of "=" is the first declaration after the type declaration in a 
procedure. How can it be "late"? What users might not see the operator?

-- 
Jeff Carter
"Brave Sir Robin ran away."
Monty Python and the Holy Grail
59

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-06-29  8:29               ` Jeffrey R. Carter
@ 2020-07-01  1:09                 ` Randy Brukardt
  2020-07-01  8:52                   ` Jeffrey R. Carter
  0 siblings, 1 reply; 20+ messages in thread
From: Randy Brukardt @ 2020-07-01  1:09 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:rdc8p2$u5v$1@dont-email.me...
> On 6/29/20 2:55 AM, Randy Brukardt wrote:
>> "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message
>> news:rcq55l$r03$1@dont-email.me...
>>> On 6/22/20 7:56 AM, Dmitry A. Kazakov wrote:
>>>> On 22/06/2020 05:15, Roger wrote:
>>>>>
>>>>> demo/db_maker/movies.adb
>>>>> "equality operator must be declared before type "Movie_Info" is frozen
>>>>> (RM 4.5.2 (9.8)) (Ada 2012)"
>>>>
>>>> That looks like a compiler bug to me.
>>>
>>> I agree. What happens if you change "=" from an expression function to a
>>> regular function?
>>
>> It is illegal either way. This was an incompatible change in Ada 2012; it
>> stems from the fact that "=" of untagged records composes in Ada 2012 but
>> not in earlier versions of Ada. Composition cannot be view dependent, and 
>> as
>> such we cannot allow "late" declarations of operators where some users 
>> would
>> not see the redefined operator.
>
> The declaration of "=" is the first declaration after the type declaration 
> in a procedure. How can it be "late"? What users might not see the 
> operator?

I based my comment on the error message; I did not look at the code. The 
message says (correctly) that "=" must be declared before the type 
Movie_Info is frozen. Ada 83 has some stupid rules allowing "late" 
declarations of operators that do not override the usual operators. One 
cannot allow that to happen for record "=". (It shouldn't be allowed ever, 
but it is one stupid rule that we're stuck with.)

I suppose there could be a compiler bug if Movie_Info is prematurely frozen, 
but I suspect it is much more likely that the code is illegal. GNAT didn't 
enforce this rule until recently (it has recently been catching up with 
newer ACATS tests for newer incompatible rules), so I find it likely that 
the code is wrong.

                                  Randy.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-07-01  1:09                 ` Randy Brukardt
@ 2020-07-01  8:52                   ` Jeffrey R. Carter
  2020-07-03  0:23                     ` Randy Brukardt
  0 siblings, 1 reply; 20+ messages in thread
From: Jeffrey R. Carter @ 2020-07-01  8:52 UTC (permalink / raw)


On 7/1/20 3:09 AM, Randy Brukardt wrote:
> 
> I suppose there could be a compiler bug if Movie_Info is prematurely frozen,
> but I suspect it is much more likely that the code is illegal. GNAT didn't
> enforce this rule until recently (it has recently been catching up with
> newer ACATS tests for newer incompatible rules), so I find it likely that
> the code is wrong.

It's certainly possible that the code is wrong, but if so, I'd like to 
understand why. This is a small demo program for Gnoga, and as Gnoga uses Ada 12 
I wrote it with Ada 12 features. I normally use the previous version of the 
language, so my understanding of the changes in this area may be lacking.

As the code is only 115 lines total, I include it here (long lines may wrap):

-- Demo for DB_Maker: Catalog your extensive collection of BetaMax videotape 
cassettes!
--
-- Copyright (C) 2017 by Jeffrey R. Carter
--
with DB_Maker;
with PragmARC.B_Strings;

procedure Movies is
    subtype Strng is PragmARC.B_Strings.B_String (Max_Length => 100);
    use type Strng;

    type Movie_Info is record
       Title       : Strng;
       Year        : Strng;
       Director    : Strng;
       Writer      : Strng;
       Male_Lead   : Strng;
       Female_Lead : Strng;
    end record;

    function "=" (Left : Movie_Info; Right : Movie_Info) return Boolean is
       (Left.Title = Right.Title and Left.Year = Right.Year and Left.Director = 
Right.Director);

    function "<" (Left : Movie_Info; Right : Movie_Info) return Boolean is
       -- Empty
    begin -- "<"
       if Left.Title /= Right.Title then
          return Left.Title < Right.Title;
       end if;

       if Left.Year /= Right.Year then
          return Left.Year < Right.Year;
       end if;

       return Left.Director < Right.Director;
    end "<";

    subtype Field_Number is Integer range 1 .. 6;

    function Field_Name (Field : in Field_Number) return String is
       -- Empty
    begin -- Field_Name
       case Field is
       when 1 =>
          return "Title";
       when 2 =>
          return "Year";
       when 3 =>
          return "Director";
       when 4 =>
          return "Screenplay";
       when 5 =>
          return "Male Lead";
       when 6 =>
          return "Female Lead";
       end case;
    end Field_Name;

    function Value (Item : in Movie_Info; Field : in Field_Number) return String is
       -- Empty
    begin -- Value
       case Field is
       when 1 =>
          return +Item.Title;
       when 2 =>
          return +Item.Year;
       when 3 =>
          return +Item.Director;
       when 4 =>
          return +Item.Writer;
       when 5 =>
          return +Item.Male_Lead;
       when 6 =>
          return +Item.Female_Lead;
       end case;
    end Value;

    procedure Put (Item : in out Movie_Info; Field : in Field_Number; Value : in 
String) is
       -- Empty
    begin -- Put
       case Field is
       when 1 =>
          Item.Title.Assign (From => Value);
       when 2 =>
          Item.Year.Assign (From => Value);
       when 3 =>
          Item.Director.Assign (From => Value);
       when 4 =>
          Item.Writer.Assign (From => Value);
       when 5 =>
          Item.Male_Lead.Assign (From => Value);
       when 6 =>
          Item.Female_Lead.Assign (From => Value);
       end case;
    end Put;

    package Movie_DB is new DB_Maker (Max_Field_Length => 100,
                                      File_Name        => "Movies",
                                      Field_Number     => Field_Number,
                                      Field_Name       => Field_Name,
                                      Element          => Movie_Info,
                                      Value            => Value,
                                      Put              => Put);
begin -- Movies
    null;
end Movies;
--
-- This is free software; you can redistribute it and/or modify it under
-- terms of the GNU General Public License as published by the Free Software
-- Foundation; either version 2, or (at your option) any later version.
-- This software is distributed in the hope that it will be useful, but WITH
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- for more details. Free Software Foundation, 59 Temple Place - Suite
-- 330, Boston, MA 02111-1307, USA.

Thanks for any insight you or others can provide.

-- 
Jeff Carter
"Propose to an Englishman any principle, or any instrument, however
admirable, and you will observe that the whole effort of the English
mind is directed to find a difficulty, a defect, or an impossibility
in it. If you speak to him of a machine for peeling a potato, he will
pronounce it impossible: if you peel a potato with it before his eyes,
he will declare it useless, because it will not slice a pineapple."
Charles Babbage
92

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-07-01  8:52                   ` Jeffrey R. Carter
@ 2020-07-03  0:23                     ` Randy Brukardt
  2020-07-03  9:09                       ` Jeffrey R. Carter
  0 siblings, 1 reply; 20+ messages in thread
From: Randy Brukardt @ 2020-07-03  0:23 UTC (permalink / raw)


A body is always freezing; an expression function is freezing if it is a 
completion. So that would suggest that this particular case should be legal.

But I wouldn't want to insist that a compiler writer get this case right, 
because of interaction between types and primitive operations when not 
declared in a package. About the only time it makes sense to declare a type 
in a procedure like this is to write simple test/example programs - which 
necessarily makes those tests/examples less realistic than they should be. 
So forcing implementers to spend a lot of time on corner cases for these 
sorts of declarations.

If  I was designing a simpler Ada-like language, I'd completely ban 
declaring types outside of packages, so that the rules for primitive 
operations and overriding would be the same for all types. (I'd also ban 
declaring packages that aren't at library level, which would get rid of the 
majority of accessibility checking and similar nonsense.) The only time 
anyone would miss it would be when writing simple test programs. Not a huge 
loss.

                                                         Randy.

"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message 
news:rdhirj$h5f$1@dont-email.me...
> On 7/1/20 3:09 AM, Randy Brukardt wrote:
>>
>> I suppose there could be a compiler bug if Movie_Info is prematurely 
>> frozen,
>> but I suspect it is much more likely that the code is illegal. GNAT 
>> didn't
>> enforce this rule until recently (it has recently been catching up with
>> newer ACATS tests for newer incompatible rules), so I find it likely that
>> the code is wrong.
>
> It's certainly possible that the code is wrong, but if so, I'd like to 
> understand why. This is a small demo program for Gnoga, and as Gnoga uses 
> Ada 12 I wrote it with Ada 12 features. I normally use the previous 
> version of the language, so my understanding of the changes in this area 
> may be lacking.
>
> As the code is only 115 lines total, I include it here (long lines may 
> wrap):
>
> -- Demo for DB_Maker: Catalog your extensive collection of BetaMax 
> videotape cassettes!
> --
> -- Copyright (C) 2017 by Jeffrey R. Carter
> --
> with DB_Maker;
> with PragmARC.B_Strings;
>
> procedure Movies is
>    subtype Strng is PragmARC.B_Strings.B_String (Max_Length => 100);
>    use type Strng;
>
>    type Movie_Info is record
>       Title       : Strng;
>       Year        : Strng;
>       Director    : Strng;
>       Writer      : Strng;
>       Male_Lead   : Strng;
>       Female_Lead : Strng;
>    end record;
>
>    function "=" (Left : Movie_Info; Right : Movie_Info) return Boolean is
>       (Left.Title = Right.Title and Left.Year = Right.Year and 
> Left.Director = Right.Director);
>
>    function "<" (Left : Movie_Info; Right : Movie_Info) return Boolean is
>       -- Empty
>    begin -- "<"
>       if Left.Title /= Right.Title then
>          return Left.Title < Right.Title;
>       end if;
>
>       if Left.Year /= Right.Year then
>          return Left.Year < Right.Year;
>       end if;
>
>       return Left.Director < Right.Director;
>    end "<";
>
>    subtype Field_Number is Integer range 1 .. 6;
>
>    function Field_Name (Field : in Field_Number) return String is
>       -- Empty
>    begin -- Field_Name
>       case Field is
>       when 1 =>
>          return "Title";
>       when 2 =>
>          return "Year";
>       when 3 =>
>          return "Director";
>       when 4 =>
>          return "Screenplay";
>       when 5 =>
>          return "Male Lead";
>       when 6 =>
>          return "Female Lead";
>       end case;
>    end Field_Name;
>
>    function Value (Item : in Movie_Info; Field : in Field_Number) return 
> String is
>       -- Empty
>    begin -- Value
>       case Field is
>       when 1 =>
>          return +Item.Title;
>       when 2 =>
>          return +Item.Year;
>       when 3 =>
>          return +Item.Director;
>       when 4 =>
>          return +Item.Writer;
>       when 5 =>
>          return +Item.Male_Lead;
>       when 6 =>
>          return +Item.Female_Lead;
>       end case;
>    end Value;
>
>    procedure Put (Item : in out Movie_Info; Field : in Field_Number; Value 
> : in String) is
>       -- Empty
>    begin -- Put
>       case Field is
>       when 1 =>
>          Item.Title.Assign (From => Value);
>       when 2 =>
>          Item.Year.Assign (From => Value);
>       when 3 =>
>          Item.Director.Assign (From => Value);
>       when 4 =>
>          Item.Writer.Assign (From => Value);
>       when 5 =>
>          Item.Male_Lead.Assign (From => Value);
>       when 6 =>
>          Item.Female_Lead.Assign (From => Value);
>       end case;
>    end Put;
>
>    package Movie_DB is new DB_Maker (Max_Field_Length => 100,
>                                      File_Name        => "Movies",
>                                      Field_Number     => Field_Number,
>                                      Field_Name       => Field_Name,
>                                      Element          => Movie_Info,
>                                      Value            => Value,
>                                      Put              => Put);
> begin -- Movies
>    null;
> end Movies;
> --
> -- This is free software; you can redistribute it and/or modify it under
> -- terms of the GNU General Public License as published by the Free 
> Software
> -- Foundation; either version 2, or (at your option) any later version.
> -- This software is distributed in the hope that it will be useful, but 
> WITH
> -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> -- for more details. Free Software Foundation, 59 Temple Place - Suite
> -- 330, Boston, MA 02111-1307, USA.
>
> Thanks for any insight you or others can provide.
>
> -- 
> Jeff Carter
> "Propose to an Englishman any principle, or any instrument, however
> admirable, and you will observe that the whole effort of the English
> mind is directed to find a difficulty, a defect, or an impossibility
> in it. If you speak to him of a machine for peeling a potato, he will
> pronounce it impossible: if you peel a potato with it before his eyes,
> he will declare it useless, because it will not slice a pineapple."
> Charles Babbage
> 92 


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-07-03  0:23                     ` Randy Brukardt
@ 2020-07-03  9:09                       ` Jeffrey R. Carter
  2020-07-07 14:41                         ` Shark8
  0 siblings, 1 reply; 20+ messages in thread
From: Jeffrey R. Carter @ 2020-07-03  9:09 UTC (permalink / raw)


On 7/3/20 2:23 AM, Randy Brukardt wrote:
> A body is always freezing; an expression function is freezing if it is a
> completion. So that would suggest that this particular case should be legal.

Thanks. So now all 3 of us who have looked at this code agree on that.

> About the only time it makes sense to declare a type
> in a procedure like this is to write simple test/example programs - which
> necessarily makes those tests/examples less realistic than they should be.

Or when, as here, the functionality is provided by a generic, and one only needs 
a simple main-program procedure to instantiate it.

> If  I was designing a simpler Ada-like language, I'd completely ban
> declaring types outside of packages, so that the rules for primitive
> operations and overriding would be the same for all types. (I'd also ban
> declaring packages that aren't at library level, which would get rid of the
> majority of accessibility checking and similar nonsense.) The only time
> anyone would miss it would be when writing simple test programs. Not a huge
> loss.

An interesting idea, and certainly a simplification. I would like to see more 
about your language design.

I have been thinking recently about what it would be like to have something like 
package types, to extend the package-as-object concept to things that can be 
declared and passed. My simplifications would be to eliminate type extension and 
accessibility checking and similar nonsense.

-- 
Jeff Carter
"I'm a kike, a yid, a heebie, a hook nose! I'm Kosher,
Mum! I'm a Red Sea pedestrian, and proud of it!"
Monty Python's Life of Brian
77

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-07-03  9:09                       ` Jeffrey R. Carter
@ 2020-07-07 14:41                         ` Shark8
  2020-07-07 15:37                           ` Jeffrey R. Carter
  0 siblings, 1 reply; 20+ messages in thread
From: Shark8 @ 2020-07-07 14:41 UTC (permalink / raw)


On Friday, July 3, 2020 at 3:09:51 AM UTC-6, Jeffrey R. Carter wrote:
> 
> I have been thinking recently about what it would be like to have something like 
> package types, to extend the package-as-object concept to things that can be 
> declared and passed. My simplifications would be to eliminate type extension and 
> accessibility checking and similar nonsense.

IIUC, there was a similar idea floated around by Intel for/after the iAPX 432.
http://www.textfiles.com/bitsavers/pdf/intel/iAPX_432/172283-001_Reference_Manual_for_the_Intel_432_Extensions_to_Ada_Dec81.pdf

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: gnoga build fails on Mac
  2020-07-07 14:41                         ` Shark8
@ 2020-07-07 15:37                           ` Jeffrey R. Carter
  0 siblings, 0 replies; 20+ messages in thread
From: Jeffrey R. Carter @ 2020-07-07 15:37 UTC (permalink / raw)


On 7/7/20 4:41 PM, Shark8 wrote:
> On Friday, July 3, 2020 at 3:09:51 AM UTC-6, Jeffrey R. Carter wrote:
>>
>> I have been thinking recently about what it would be like to have something like
>> package types, to extend the package-as-object concept to things that can be
>> declared and passed. My simplifications would be to eliminate type extension and
>> accessibility checking and similar nonsense.
> 
> IIUC, there was a similar idea floated around by Intel for/after the iAPX 432.
> http://www.textfiles.com/bitsavers/pdf/intel/iAPX_432/172283-001_Reference_Manual_for_the_Intel_432_Extensions_to_Ada_Dec81.pdf

Interesting. Not what I have in mind, though.

-- 
Jeff Carter
"Alms for an ex-leper!"
Monty Python's Life of Brian
75

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-07-07 15:37 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-21  7:57 gnoga build fails on Mac Roger
2020-06-21  8:41 ` Dmitry A. Kazakov
2020-06-21 11:18   ` Roger
2020-06-21 13:28     ` Dmitry A. Kazakov
2020-06-22  3:15       ` Roger
2020-06-22  5:56         ` Dmitry A. Kazakov
2020-06-22  6:14           ` Roger
2020-06-22 11:37           ` Jeffrey R. Carter
2020-06-22 23:25             ` Roger
2020-06-23 11:27               ` Jeffrey R. Carter
2020-06-29  0:55             ` Randy Brukardt
2020-06-29  8:29               ` Jeffrey R. Carter
2020-07-01  1:09                 ` Randy Brukardt
2020-07-01  8:52                   ` Jeffrey R. Carter
2020-07-03  0:23                     ` Randy Brukardt
2020-07-03  9:09                       ` Jeffrey R. Carter
2020-07-07 14:41                         ` Shark8
2020-07-07 15:37                           ` Jeffrey R. Carter
2020-06-21 14:24 ` Jeffrey R. Carter
2020-06-21 16:46   ` Simon Wright

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