Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Jesus saves...but Gretzky gets the rebound!" -- Daniel Hinojosa (hinojosa@hp-sdd)


devel / comp.lang.misc / Re: Namespaces, modularity, ... what's the big deal?

SubjectAuthor
* Namespaces, modularity, ... what's the big deal?luserdroog
+* Re: Namespaces, modularity, ... what's the big deal?David Brown
|+* Re: Namespaces, modularity, ... what's the big deal?James Harris
||+* Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|||`* Re: Namespaces, modularity, ... what's the big deal?James Harris
||| `* Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|||  `* Re: Namespaces, modularity, ... what's the big deal?James Harris
|||   `* Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|||    `* Re: Namespaces, modularity, ... what's the big deal?James Harris
|||     `* Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|||      `* Re: Namespaces, modularity, ... what's the big deal?James Harris
|||       `* Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|||        `- Re: Namespaces, modularity, ... what's the big deal?James Harris
||+* Re: Namespaces, modularity, ... what's the big deal?David Brown
|||`* Re: Namespaces, modularity, ... what's the big deal?James Harris
||| `* Re: Namespaces, modularity, ... what's the big deal?David Brown
|||  +- Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|||  `- Re: Namespaces, modularity, ... what's the big deal?James Harris
||+* Re: Namespaces, modularity, ... what's the big deal?Bart
|||`* Re: Namespaces, modularity, ... what's the big deal?James Harris
||| `* Re: Namespaces, modularity, ... what's the big deal?Bart
|||  `* Re: Namespaces, modularity, ... what's the big deal?James Harris
|||   +- Re: Namespaces, modularity, ... what's the big deal?James Harris
|||   `* Re: Namespaces, modularity, ... what's the big deal?Bart
|||    +- Re: Namespaces, modularity, ... what's the big deal?James Harris
|||    `* Re: Namespaces, modularity, ... what's the big deal?James Harris
|||     `* Re: Namespaces, modularity, ... what's the big deal?Bart
|||      `* Re: Namespaces, modularity, ... what's the big deal?James Harris
|||       `* Re: Namespaces, modularity, ... what's the big deal?Bart
|||        `* Re: Namespaces, modularity, ... what's the big deal?James Harris
|||         `* Re: Namespaces, modularity, ... what's the big deal?Bart
|||          `- Re: Namespaces, modularity, ... what's the big deal?James Harris
||`* Re: Namespaces, modularity, ... what's the big deal?antispam
|| +* Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|| |`* Re: Namespaces, modularity, ... what's the big deal?antispam
|| | `* Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|| |  `* Re: Namespaces, modularity, ... what's the big deal?antispam
|| |   `- Re: Namespaces, modularity, ... what's the big deal?Dmitry A. Kazakov
|| `- Re: Namespaces, modularity, ... what's the big deal?James Harris
|`* Re: Namespaces, modularity, ... what's the big deal?luserdroog
| +- Re: Namespaces, modularity, ... what's the big deal?luserdroog
| +* Re: Namespaces, modularity, ... what's the big deal?luserdroog
| |+- Re: Namespaces, modularity, ... what's the big deal?luserdroog
| |`* Re: Namespaces, modularity, ... what's the big deal?luserdroog
| | `* Re: Namespaces, modularity, ... what's the big deal?James Harris
| |  `* Re: Namespaces, modularity, ... what's the big deal?luserdroog
| |   `* Re: Namespaces, modularity, ... what's the big deal?James Harris
| |    `- Re: Namespaces, modularity, ... what's the big deal?luserdroog
| `- Re: Namespaces, modularity, ... what's the big deal?luserdroog
+- Re: Namespaces, modularity, ... what's the big deal?Bart
`- Re: Namespaces, modularity, ... what's the big deal?Stefan Ram

Pages:123
Re: Namespaces, modularity, ... what's the big deal?

<su8th1$cv0$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1787&group=comp.lang.misc#1787

  copy link   Newsgroups: comp.lang.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: james.harris.1@gmail.com (James Harris)
Newsgroups: comp.lang.misc
Subject: Re: Namespaces, modularity, ... what's the big deal?
Date: Sat, 12 Feb 2022 18:16:00 +0000
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <su8th1$cv0$1@dont-email.me>
References: <11e5e295-3f0d-4140-831d-7a9eb394cd3fn@googlegroups.com>
<sn0l7g$34f$1@dont-email.me> <sn2is4$9nr$1@dont-email.me>
<st2955$15o3$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 12 Feb 2022 18:16:01 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b36d7cd7a2226d888bf6546c38de8278";
logging-data="13280"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18aL2L/1eBk7uTlb0RjI+3YU6kQYIis72Q="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Cancel-Lock: sha1:S4ZVpeQ9LRmejSRPwPaThqYNwI4=
In-Reply-To: <st2955$15o3$1@gioia.aioe.org>
Content-Language: en-GB
 by: James Harris - Sat, 12 Feb 2022 18:16 UTC

On 29/01/2022 02:35, antispam@math.uni.wroc.pl wrote:
> James Harris <james.harris.1@gmail.com> wrote:
>> On 16/11/2021 16:11, David Brown wrote:
>>> On 16/11/2021 16:16, luserdroog wrote:
>>
>>>> I've been following with interest many of the threads started
>>>> by James Harris over the year and frequently the topic of
>>>> namespaces and modularity come up. Most recently in the
>>>> "Power operator and replacement..." thread.
>>>>
>>>> And I tend to find myself on James' side through unfamiliarity
>>>> with the other option. What's the big deal about namespaces
>>>> and modules? What do they cost and what do they facilitate?
>>
>> ...
>>
>>> namespace timers {
>>> void init();
>>> void enable();
>>> int get_current();
>>> void set_frequency(double);
>>> }
>>>
>>> You can use them as "timers::init();" or by pulling them into the
>>> current scope with "using timers; enable();".
>>
>> As this is about namespaces, I'd suggest some problems with that "using
>> timers" example:
>>
>> * AIUI it mixes the names from within 'timers' into the current
>> namespace. If that's right then a programmer taking such an approach
>> would have to avoid having his own versions of those names. (I.e. no
>> 'enable' or 'init' names in the local scope.)
>
> I did not check C++ rules here. But other languages have simple rule:
> local name wins. That is to access global one you either should
> not declare local one or use qualified version.
>
> If you think about this for a while you should see that this is
> the only sensible rule: imported modules can change without
> programmer of "client" module knowing this. And breakning clients
> by merely adding new export is in most cases not acceptable.

There's another option: Require all imported names to be within a local
name. For example,

import timers as t

then any names that happened to exist within timers could be referred to
such as t.init and t.enable. The name t would be local and thereby
manifestly distinguishable from other local names. There would be no
possibility of the import causing an inadvertent conflict even if a
later version of 'timers' were to have other names added to it.

--
James Harris

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor