comp.lang.ada
 help / color / mirror / Atom feed
From: John Smith <yoursurrogategod@gmail.com>
Subject: Re: I have no idea why this will not compile.
Date: Sun, 1 May 2016 13:55:57 -0700 (PDT)
Date: 2016-05-01T13:55:57-07:00	[thread overview]
Message-ID: <3043d4f4-299d-4a8b-b8e9-cb029b1e9e32@googlegroups.com> (raw)
In-Reply-To: <15f01439-2333-4482-a37c-3aeb33102c4d@googlegroups.com>

That's more helpful, thanks.  And no, I'm not very proficient in Ada, hence my 
confusion.  Based on what you suggested, option two makes the most sense.

Again, since I'm still learning, this is what I've come up with:
http://pastebin.ca/3588100

And now I'm getting the following error:
"full view of private extension must be an extension"

On Sunday, May 1, 2016 at 6:10:34 AM UTC-4, mockturtle wrote:
> You already received two answers that help you to solve the problem.  However, depending on your knowledge of Ada, maybe a longer explanation could be useful.
> 
> "limited" in Ada is used to mark a type that cannot be copied.  For example, task types are limited (it does not make much sense copying a task), protected objects are limited (what means to copy them is doubtful).  In the case of File_Type I guess they are limited because the file has an "internal state" that could be bring to subtle errors if copied.  (BTW, also in C you never copy a FILE, but a pointer to FILE, never copying the underling structure).
> 
> In Ada is not permitted to use a limited type as a component of a *non limited* record, since this would allow you to avoid the original limited restriction (by copying the record you would copy also the limited component).  Because of this, Ada requires that you declare limited any record that has a limited component.
> 
> Solutions?  I can think about three solutions:
> 
> 1.  Make the record limited
> 2. Use an access to the limited type
> 3. Move the limited component outside the record
> 
> I think that the best solution depends on your specfic case.
> 
> Riccardo


  reply	other threads:[~2016-05-01 20:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-01  3:22 I have no idea why this will not compile John Smith
2016-05-01  4:07 ` Jeffrey R. Carter
2016-05-01  6:47 ` Georg Bauhaus
2016-05-01 21:52   ` John Smith
2016-05-02  7:36     ` Georg Bauhaus
2016-05-01 10:10 ` mockturtle
2016-05-01 20:55   ` John Smith [this message]
2016-05-01 23:52     ` Jeffrey R. Carter
2016-05-02  1:02     ` Jeremiah
replies disabled

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