www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Sharing in D

reply Jason House <jason.james.house gmail.com> writes:
Walter Bright Wrote:

 http://www.reddit.com/comments/6u7k0/sharing_in_d/

This is one of my 3 big wishes for the D language. The artical talks about shared being transitive just like const/invariant. I certainly hope it's more like pure than transitive invariant. Allowing access to thread-local globals is a bad idea.
Jul 31 2008
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Jason House wrote:
 Walter Bright Wrote:
 
 http://www.reddit.com/comments/6u7k0/sharing_in_d/

This is one of my 3 big wishes for the D language. The artical talks about shared being transitive just like const/invariant. I certainly hope it's more like pure than transitive invariant.

Pure doesn't apply to data types, it applies to functions. I don't know what you mean.
 Allowing access to thread-local globals is a bad idea.

Why? Global thread local storage is even enshrined into C++0x.
Jul 31 2008
parent reply superdan <super dan.org> writes:
Walter Bright Wrote:

 Jason House wrote:
 Walter Bright Wrote:
 
 http://www.reddit.com/comments/6u7k0/sharing_in_d/

This is one of my 3 big wishes for the D language. The artical talks about shared being transitive just like const/invariant. I certainly hope it's more like pure than transitive invariant.

Pure doesn't apply to data types, it applies to functions. I don't know what you mean.

looks 2 me more like more of the confusion in yesterthread.
 Allowing access to thread-local globals is a bad idea.

Why? Global thread local storage is even enshrined into C++0x.

99% of the global shit i ever defined i wanted to be thread local. i had to take special measures to make it so. dealing with globals in one thread is shitty to boot. using globals to communicate across threads is sheer suicide.
Jul 31 2008
parent reply downs <default_357-line yahoo.de> writes:
superdan wrote:
 Walter Bright Wrote:
 
 Jason House wrote:
 Walter Bright Wrote:

 http://www.reddit.com/comments/6u7k0/sharing_in_d/

The artical talks about shared being transitive just like const/invariant. I certainly hope it's more like pure than transitive invariant.

what you mean.

looks 2 me more like more of the confusion in yesterthread.
 Allowing access to thread-local globals is a bad idea.


99% of the global shit i ever defined i wanted to be thread local. i had to take special measures to make it so. dealing with globals in one thread is shitty to boot. using globals to communicate across threads is sheer suicide.

What about cases that depend on external resources, like a global buffer object for HTTP downloads? In that case you want cached results to be available to as many threads as possible, especially if the respective server has a high latency. --downs
Aug 01 2008
parent Sean Kelly <sean invisibleduck.org> writes:
== Quote from downs (default_357-line yahoo.de)'s article
 superdan wrote:
 Walter Bright Wrote:

 Jason House wrote:
 Walter Bright Wrote:

 http://www.reddit.com/comments/6u7k0/sharing_in_d/

The artical talks about shared being transitive just like const/invariant. I certainly hope it's more like pure than transitive invariant.

what you mean.

looks 2 me more like more of the confusion in yesterthread.
 Allowing access to thread-local globals is a bad idea.


99% of the global shit i ever defined i wanted to be thread local. i had to


 dealing with globals in one thread is shitty to boot. using globals to


 What about cases that depend on external resources, like a global buffer object

 In that case you want cached results to be available to as many threads as

Yup. This is pretty much the only time I use globals in my apps-- if there's some huge data structure I want to reference in all my threads. A user list... something like that. In a language like Erlang, that user list would probably be managed by a distinct process and would serve requests from other processes that wanted to perform operations on it. Without shared data in D I'd do pretty much the same thing. All D would need is a solid messaging system. libd has one built-in, but we avoided this with Tango because it would effectively change the language. Sean
Aug 01 2008