Re: What is shared functions?

2011-11-08 Thread Marco Leise
Am 23.10.2011, 21:51 Uhr, schrieb bearophile bearophileh...@lycos.com: Jonathan M Davis: my general take on it is that dmd should _never_ ignore attributes, I agree. Such sloppiness is a very good source for problems, long term ones too, and it makes it harder to learn D. Bye,

Re: What is shared functions?

2011-10-26 Thread mta`chrono
void main() { shared s1 = cast(shared)new S(); s1.onlyShared(); // ok //s1.notShared(); // error: not callable using argument types () shared auto s2 = new S(); //s2.onlyShared(); // error: not callable using argument types () s2.notShared(); // ok } I would rather

Re: What is shared functions?

2011-10-24 Thread Jacob Carlborg
On 2011-10-23 20:14, Jonathan M Davis wrote: On Sunday, October 23, 2011 14:32:34 simendsjo wrote: What does shared for functions mean? I thought it was supposed to automatically synchronize access, but this doesn't seem to be the case. void f() shared { // no synchronization } void f

Re: What is shared functions?

2011-10-24 Thread Steven Schveighoffer
On Sun, 23 Oct 2011 08:32:34 -0400, simendsjo simend...@gmail.com wrote: What does shared for functions mean? I thought it was supposed to automatically synchronize access, but this doesn't seem to be the case. void f() shared { // no synchronization } void f() { synchronized

Re: What is shared functions?

2011-10-24 Thread simendsjo
On 24.10.2011 17:23, Steven Schveighoffer wrote: On Sun, 23 Oct 2011 08:32:34 -0400, simendsjo simend...@gmail.com wrote: What does shared for functions mean? I thought it was supposed to automatically synchronize access, but this doesn't seem to be the case. void f() shared

Re: What is shared functions?

2011-10-24 Thread Steven Schveighoffer
On Mon, 24 Oct 2011 12:01:07 -0400, simendsjo simend...@gmail.com wrote: On 24.10.2011 17:23, Steven Schveighoffer wrote: On Sun, 23 Oct 2011 08:32:34 -0400, simendsjo simend...@gmail.com wrote: What does shared for functions mean? I thought it was supposed to automatically synchronize

Re: What is shared functions?

2011-10-24 Thread simendsjo
On 24.10.2011 21:41, Steven Schveighoffer wrote: So you cannot create a function to be called on both shared and unshared instances? For mutable/immutable there's const, but there is no maybeShared. No. There isn't a hybrid that works as well as const does. I suspect one could be created,

What is shared functions?

2011-10-23 Thread simendsjo
What does shared for functions mean? I thought it was supposed to automatically synchronize access, but this doesn't seem to be the case. void f() shared { // no synchronization } void f() { synchronized { // do stuff } }

Re: What is shared functions?

2011-10-23 Thread Jonathan M Davis
On Sunday, October 23, 2011 14:32:34 simendsjo wrote: What does shared for functions mean? I thought it was supposed to automatically synchronize access, but this doesn't seem to be the case. void f() shared { // no synchronization } void f() { synchronized { // do stuff

Re: What is shared functions?

2011-10-23 Thread Jonathan M Davis
On Sunday, October 23, 2011 20:22:01 simendsjo wrote: On 23.10.2011 20:14, Jonathan M Davis wrote: On Sunday, October 23, 2011 14:32:34 simendsjo wrote: What does shared for functions mean? I thought it was supposed to automatically synchronize access, but this doesn't seem to be the case

Re: What is shared functions?

2011-10-23 Thread bearophile
Jonathan M Davis: my general take on it is that dmd should _never_ ignore attributes, I agree. Such sloppiness is a very good source for problems, long term ones too, and it makes it harder to learn D. Bye, bearophile