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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: What is your opinion on Global Objects? Date: Mon, 17 Nov 2014 19:52:49 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Tue, 18 Nov 2014 02:52:38 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="e1e8835fd7030ec2a5463beff662d0eb"; logging-data="23803"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185dh1OePfmcWGmtdwm718YEGyYJNFrP/E=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: Cancel-Lock: sha1:TYDHvSW5VN9PqZCPVr5nBTbWZ4o= Xref: news.eternal-september.org comp.lang.ada:23499 Date: 2014-11-17T19:52:49-07:00 List-Id: On 11/17/2014 06:36 PM, Hubert wrote: > > So my question is basically, is it OK to make these entities available through > global access variables, or should they all be passed as arguments to function > calls? We all know global objects are bad (not to mention that theorists heftily > denounce the Singleton Pattern as bad, but, hey there is only one way to the > internet and only one database, I'm sorry) but we also know that it is bad to > carry "tramp data" through multiple levels of function calls when the functions > do nothing with that data but pass it on to lower functions. This is only a problem in poorly designed languages. In Ada these "singletons" should be packages. No global variables needed. No access types needed, much less global access variables. -- Jeff Carter "So if I understand 'The Matrix Reloaded' correctly, the Matrix is basically a Microsoft operating system--it runs for a while and then crashes and reboots. By design, no less. Neo is just a memory leak that's too hard to fix, so they left him in ... The users don't complain because they're packed in slush and kept sedated." Marin D. Condic 65