Thread overview
Re: Sharing in D
Jul 31, 2008
Jason House
Aug 01, 2008
Walter Bright
Aug 01, 2008
superdan
Aug 01, 2008
downs
Aug 01, 2008
Sean Kelly
July 31, 2008
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.
August 01, 2008
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.

August 01, 2008
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.
August 01, 2008
superdan wrote:
> 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.

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
August 01, 2008
== 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/
> >>> 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.
> 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.

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