From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Package's private parts and protected types
Date: Thu, 11 Feb 2010 19:29:48 -0600
Date: 2010-02-11T19:29:48-06:00 [thread overview]
Message-ID: <hl2aud$ejh$1@munin.nbi.dk> (raw)
In-Reply-To: wccvde3gwts.fsf@shell01.TheWorld.com
"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message
news:wccvde3gwts.fsf@shell01.TheWorld.com...
> "Randy Brukardt" <randy@rrsoftware.com> writes:
...
>> Moreover, it is easy to imagine errors that would cause the unit to no
>> longer be the body (such as misspelling the name, or misspelling "body"),
>> at
>
> I see your point about misspelling the name. But misspelling "body"?
> That would just be a syntax error.
I often leave out "body" altogether. But either are a syntax error, but only
if the build system tries to compile the file! And why is it doing that,
build systems don't compile random files that aren't needed.
I could imagine a warning if you have strong links (naming conventions,
whatever) to this particular file, but that is often not the case. (It
wasn't in Janus/Ada until we added the project manager in the mid-90's - if
the file didn't have the right name or the right contents, it was ignored.
We didn't want to be picking up random documents and leftover debugger
files, which used to happen in the old days.)
>> which point the implementation would have to guess. But the problem of a
>> body that the programmer expected to be included being left out would
>> continue.
>
> But the so-called "solution" in Ada 95 didn't actually solve anything.
> Early versions of GNAT had the same bug -- they ignored a non-required
> body, simply by saying it's not part of the program library.
> That was fixed because it's bad behavior, not because it failed
> to conform to the Ada 95 rules.
I don't see how you could "fix" it in general. If the file matches the
naming conventions or already has a link from a project manager, sure you
can see it. But if those things aren't true, are you going to nag the user
everytime? (No body found for package X!) We actually did that for a while
in late Ada 83 days and it drove everybody nuts.
...
>> I'm also dubious of the basic idea. I suppose you could keep the private
>> part in a separate file, but I can't imagine any useful way to *compile*
>> it
>> separately (you'd have to have both parts available in order to do any
>> sort
>> of code generation).
>
> I don't think you need to look at the private part to generate code.
> If you change it to "to generate efficient code", then I'll agree.
I don't know how to compile a subprogram call if I don't know the parameter
passing kind (by-copy or by-reference). You could make everything
by-reference, but then you have to fake by-copy at the call site. Not sure
how you could do that if you don't know anything about the type.
It's the reason you can't make calls to subprograms with parameters of
incomplete types. (We recently discovered that Ada has been wrong about
disallowing the *declaration* of such subprograms; the only problem is
*calling* them; Ada 2012 will relax that restriction, which will be great
for "limited with".)
>>...So there wouldn't be much, if any, advantage in terms
>> of development.
>
> I disagree -- I think there are big advantages to storing the
> private part in a separate file. I don't much care what files
> the compiler wants to look at, so long as it's not too slow.
Maybe. It sounds like more separate windows to juggle in the editor.
> The private part is part of the implementation. It's useful
> to manage it separately in your CM system (and CM systems
> are file based). Consider, for example, a visible part
> that has multiple implementations (maybe target dependent),
> selected by the build scripts. It's really annoying to
> have to duplicate the visible part.
CM systems have been a pet peeve of mind for years. File-based management
simply doesn't work; unfortunately, everything else is too complex to use.
Janus/Ada plenty of files that are mostly shared (like the definition of
Standard for different targets), and it is pain to keep them all consistent.
I built a front-end to our CM system to track those relationships, but it
doesn't work that well because of the need to manually update things, even
when the change is in the shared part (which is the usual case).
There is no particular part of the code that is more or less common for
these "unshared" parts to occur. Bodies, private declarations, and visible
constants all are involved. So you're fixing one corner of a wide tools
problem with a language feature.
If you really wanted to fix that (without creating a new kind of CM
system!), I think you would need to support putting arbitrary parts of
compilation units in different files. Almost like the old include files, but
with first class support in the programming environment so it is easy to see
and work on the assembled result. But that isn't a language enhancement
per-se.
>>... (For Janus/Ada, at least, every source file is compiled
>> separately, and code is generated as necessary without needing anything
>> other than direct semantic dependencies to have been previously compiled.
>> That model is impossible for separate private parts; the specification
>> would
>> not contain enough information to generate any code or any code for calls
>> to
>> it.)
>
> This seems backwards. Of course you chose a compilation model
> based on the rules of Ada (Ada 83, in fact). But I'm speculating
> about what Ada should have been -- a language very similar
> to Ada, but slightly different. You can't argue against such
> a language by saying existing Ada compilers can't handle it.
> If Ada had been designed differently, then so would the compilers
> have been.
We're talking about Ada here (and possibly enhancements to Ada). I'm not
talking about the Duff language, nor am I very interested in it. Ada is
going to be compiled by Ada compilers, and the vast majority of them already
exist. How they work *is* relevant.
Randy.
next prev parent reply other threads:[~2010-02-12 1:29 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-08 4:30 Package's private parts and protected types Hibou57 (Yannick Duchêne)
2010-02-08 8:30 ` Martin
2010-02-08 9:11 ` Hibou57 (Yannick Duchêne)
2010-02-08 10:10 ` Alex R. Mosteo
2010-02-08 10:46 ` Hibou57 (Yannick Duchêne)
2010-02-09 14:55 ` Alex R. Mosteo
2010-02-08 10:20 ` Dmitry A. Kazakov
2010-02-08 10:54 ` Hibou57 (Yannick Duchêne)
2010-02-08 10:58 ` Hibou57 (Yannick Duchêne)
2010-02-08 11:01 ` Dmitry A. Kazakov
2010-02-08 13:19 ` Georg Bauhaus
2010-02-08 15:17 ` Robert A Duff
2010-02-08 16:15 ` (see below)
2010-02-08 20:44 ` Robert A Duff
2010-02-08 22:00 ` Hibou57 (Yannick Duchêne)
2010-02-09 5:48 ` AdaMagica
2010-02-09 14:56 ` Robert A Duff
2010-02-10 2:29 ` Randy Brukardt
2010-02-11 23:46 ` Robert A Duff
2010-02-12 1:29 ` Randy Brukardt [this message]
2010-02-11 23:53 ` Robert A Duff
2010-02-12 1:10 ` Randy Brukardt
2010-02-10 16:05 ` Adam Beneschan
2010-02-10 20:17 ` sjw
2010-02-12 0:05 ` Robert A Duff
2010-02-12 11:07 ` Stephen Leake
2010-02-12 15:01 ` Robert A Duff
2010-02-13 8:00 ` Stephen Leake
2010-02-09 9:04 ` stefan-lucks
2010-02-08 17:11 ` Jeffrey R. Carter
2010-02-08 14:56 ` Robert A Duff
2010-02-08 15:36 ` Dmitry A. Kazakov
2010-02-08 16:06 ` Robert A Duff
2010-02-08 17:46 ` Jean-Pierre Rosen
2010-02-08 20:39 ` Robert A Duff
2010-02-08 21:54 ` Hibou57 (Yannick Duchêne)
2010-02-08 21:50 ` Hibou57 (Yannick Duchêne)
2010-02-08 22:04 ` Hibou57 (Yannick Duchêne)
2010-02-09 10:58 ` Hibou57 (Yannick Duchêne)
2010-02-09 14:47 ` Robert A Duff
2010-02-09 19:34 ` Hibou57 (Yannick Duchêne)
2010-02-09 20:19 ` Hibou57 (Yannick Duchêne)
2010-02-09 23:29 ` Robert A Duff
2010-02-10 2:39 ` Randy Brukardt
2010-02-10 5:12 ` Hibou57 (Yannick Duchêne)
2010-02-10 7:17 ` Hibou57 (Yannick Duchêne)
2010-02-10 16:09 ` Robert A Duff
2010-02-10 22:21 ` Hibou57 (Yannick Duchêne)
2010-02-11 0:48 ` Robert A Duff
2010-02-09 0:48 ` Randy Brukardt
2010-02-09 12:43 ` Hibou57 (Yannick Duchêne)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox