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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c8bbb1419c8e81a X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Waiver question Date: 1997/05/02 Message-ID: #1/1 X-Deja-AN: 238906893 References: <5kb8ol$18o@bcrkh13.bnr.ca> <1997May2.063334.1@eisner> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-05-02T00:00:00+00:00 List-Id: In article <1997May2.063334.1@eisner>, Larry Kilgallen wrote: >I do not understand why you feel the default should be task-unsafe. >The general trend in Ada seems to be that safeguards are enabled by >default and disabled by explicit statement. I agree with that general language design principle. Mostly, Ada follows it, and that's usually good. In some cases, Ada disobeys this principle, and that's usually bad. (For example, Ada requires extra effort to declare a constant, rather than a variable -- it should be the other way 'round; that is, "X: Integer := 7;" would be a constant, whereas "X: var Integer := 7;" would be a variable (or "X: variable Integer := 7;", if you hate abbreviations). Interestingly, Ada is inconsistent on this point -- for a parameter, the default is "in", which means it's constant.) Anyway, back to the point: Independent addressability does not imply task-safety. So, if variables are not automatically protected by locking/synchronization by default, it seems to me that they should not have to be independently addressable by default. In keeping with the principle you describe, above, I think I would prefer a language in which any variable that is potentially shared by multiple tasks would have to be explicitly declared "shared". But to do that, you would need a good deal of extra mechanism. For example, subprogram specs would need to be annotated with some syntax that says "I modify shared variables" or whatever. In the absence of such mechanisms, Ada defaults to task-unsafe -- if you want locking of some sort, you have to say so, and if you don't, you're erroneous. Any variable is potentially shared, and any use of shared variables requires a great deal of care. Given that, it seems that independent addressability should also default to the "unsafe" way. Anyway, my main point was that independent addressability should not be turned on and off by pragma Pack. These should be two independent features. I don't feel strongly, one way or the other, about what the default should be, and I'm partly convinced by your argument above. >The only wasted resource is memory, and typical applications on >Alpha have lots. I don't buy this reasoning. Wasting space will typically cause you to waste time, too, due to caching and paging. So it's not true that "Now that memory is cheap, we can squander it." - Bob