Re: Immutable Message Passing

2011-12-11 Thread Graham St Jack
On 11/12/11 12:59, Andrew Gough wrote: On Mon, 05 Dec 2011 08:21:45 +0100 Jacob Carlborg wrote: On 2011-12-04 21:46, Andrew Wiley wrote: On Sun, Dec 4, 2011 at 1:42 AM, Jonathan M Davis wrote: On Sunday, December 04, 2011 01:24:02 Andrew Wiley wrote: This should work, right? I'm not just

Re: Immutable Message Passing

2011-12-10 Thread Andrew Gough
On Mon, 05 Dec 2011 08:21:45 +0100 Jacob Carlborg wrote: > On 2011-12-04 21:46, Andrew Wiley wrote: > > On Sun, Dec 4, 2011 at 1:42 AM, Jonathan M > > Davis wrote: > >> On Sunday, December 04, 2011 01:24:02 Andrew Wiley wrote: > >>> This should work, right? I'm not just going crazy or something?

Re: Immutable Message Passing

2011-12-06 Thread Andrei Alexandrescu
On 12/5/11 11:55 PM, Andrew Wiley wrote: On Sun, Dec 4, 2011 at 9:12 PM, Andrei Alexandrescu wrote: On 12/4/11 4:32 PM, Andrew Wiley wrote: In that case, no object copying is occurring, and I have message passing for immutable objects working, although my current solution is basically to che

Re: Immutable Message Passing

2011-12-05 Thread Andrew Wiley
On Sun, Dec 4, 2011 at 9:12 PM, Andrei Alexandrescu wrote: > On 12/4/11 4:32 PM, Andrew Wiley wrote: >> >> In that case, no object copying is occurring, and I have message >> passing for immutable objects working, although my current solution is >> basically to check whether the object is immutabl

Re: Immutable Message Passing

2011-12-05 Thread Graham St Jack
On 05/12/11 18:48, Jacob Carlborg wrote: On 2011-12-05 08:25, Graham St Jack wrote: I always use arrays or structs. Until the tail-const thing (or something like it) happens, classes don't seem to be viable in messages between threads. You can always serialize the object, if a copy is accepta

Re: Immutable Message Passing

2011-12-05 Thread Timon Gehr
On 12/05/2011 02:24 PM, Jason House wrote: Timon Gehr Wrote: On 12/05/2011 02:16 AM, Graham St Jack wrote: What is the status of the immutable(Object) ref proposal? Is it on the list of things to do, or is it ruled out? If it is ruled out, then what is the superior proposal? It is not full

Re: Immutable Message Passing

2011-12-05 Thread Jason House
Timon Gehr Wrote: > On 12/05/2011 02:16 AM, Graham St Jack wrote: > > > > What is the status of the immutable(Object) ref proposal? Is it on the > > list of things to do, or is it ruled out? If it is ruled out, then what > > is the superior proposal? > > > > It is not fully implemented and appare

Re: Immutable Message Passing

2011-12-05 Thread Timon Gehr
On 12/05/2011 02:56 AM, bearophile wrote: Timon Gehr: It is not fully implemented and apparently Walter would like a different solution, because it is quite ugly. Do you know why it is ugly? Bye, bearophile It overloads the 'ref' keyword with an unrelated meaning. And furthermore: auto x

Re: Immutable Message Passing

2011-12-05 Thread Jacob Carlborg
On 2011-12-05 08:25, Graham St Jack wrote: I always use arrays or structs. Until the tail-const thing (or something like it) happens, classes don't seem to be viable in messages between threads. You can always serialize the object, if a copy is acceptable. -- /Jacob Carlborg

Re: Immutable Message Passing

2011-12-04 Thread Graham St Jack
On 05/12/11 17:51, Jacob Carlborg wrote: On 2011-12-04 21:46, Andrew Wiley wrote: On Sun, Dec 4, 2011 at 1:42 AM, Jonathan M Davis wrote: On Sunday, December 04, 2011 01:24:02 Andrew Wiley wrote: This should work, right? I'm not just going crazy or something? import std.concurrency; import s

Re: Immutable Message Passing

2011-12-04 Thread Jacob Carlborg
On 2011-12-04 21:46, Andrew Wiley wrote: On Sun, Dec 4, 2011 at 1:42 AM, Jonathan M Davis wrote: On Sunday, December 04, 2011 01:24:02 Andrew Wiley wrote: This should work, right? I'm not just going crazy or something? import std.concurrency; import std.stdio; class Bob { } void main() {

Re: Immutable Message Passing

2011-12-04 Thread Andrei Alexandrescu
On 12/4/11 4:32 PM, Andrew Wiley wrote: In that case, no object copying is occurring, and I have message passing for immutable objects working, although my current solution is basically to check whether the object is immutable, and if so, memcpy the reference. That breaks immutability, but only f

Re: Immutable Message Passing

2011-12-04 Thread Andrew Wiley
On Sun, Dec 4, 2011 at 6:19 PM, Timon Gehr wrote: > On 12/04/2011 11:32 PM, Andrew Wiley wrote: >> >> On Sun, Dec 4, 2011 at 4:23 PM, Andrei Alexandrescu >>  wrote: >>> >>> On 12/4/11 4:16 PM, Andrew Wiley wrote: >>> So it looks like right now, message passing is copying objects, which

Re: Immutable Message Passing

2011-12-04 Thread bearophile
Timon Gehr: > It is not fully implemented and apparently Walter would like a different > solution, because it is quite ugly. Do you know why it is ugly? Bye, bearophile

Re: Immutable Message Passing

2011-12-04 Thread Timon Gehr
On 12/05/2011 02:16 AM, Graham St Jack wrote: My vote is for something like immutable(Object) ref, as Andrew suggested earlier. This would allow mutable references to immutable objects to be passed through a message channel without nasty typecasting. std.typecons.Rebindable has always been an ug

Re: Immutable Message Passing

2011-12-04 Thread Jonathan M Davis
On Monday, December 05, 2011 11:46:29 Graham St Jack wrote: > My vote is for something like immutable(Object) ref, as Andrew suggested > earlier. This would allow mutable references to immutable objects to be > passed through a message channel without nasty typecasting. > > std.typecons.Rebindable

Re: Immutable Message Passing

2011-12-04 Thread Graham St Jack
My vote is for something like immutable(Object) ref, as Andrew suggested earlier. This would allow mutable references to immutable objects to be passed through a message channel without nasty typecasting. std.typecons.Rebindable has always been an ugly hack that doesn't quite do the job. Certa

Re: Immutable Message Passing

2011-12-04 Thread Timon Gehr
On 12/04/2011 11:32 PM, Andrew Wiley wrote: On Sun, Dec 4, 2011 at 4:23 PM, Andrei Alexandrescu wrote: On 12/4/11 4:16 PM, Andrew Wiley wrote: So it looks like right now, message passing is copying objects, which seems very bad. Check this out: import std.stdio; import std.concurren

Re: Immutable Message Passing

2011-12-04 Thread Andrew Wiley
On Sun, Dec 4, 2011 at 4:23 PM, Andrei Alexandrescu wrote: > On 12/4/11 4:16 PM, Andrew Wiley wrote: >> >> So it looks like right now, message passing is copying objects, which >> seems very bad. Check this out: >> >> import std.stdio; >> import std.concurrency; >> >> class Bob { >> } >>

Re: Immutable Message Passing

2011-12-04 Thread Andrei Alexandrescu
On 12/4/11 4:16 PM, Andrew Wiley wrote: So it looks like right now, message passing is copying objects, which seems very bad. Check this out: import std.stdio; import std.concurrency; class Bob { } void main() { auto tid = spawn(&func); auto bob = new shared(Bob)();

Re: Immutable Message Passing

2011-12-04 Thread Andrew Wiley
On Sun, Dec 4, 2011 at 2:46 PM, Andrew Wiley wrote: > On Sun, Dec 4, 2011 at 1:42 AM, Jonathan M Davis wrote: >> On Sunday, December 04, 2011 01:24:02 Andrew Wiley wrote: >>> This should work, right? I'm not just going crazy or something? >>> >>> import std.concurrency; >>> import std.stdio; >>>

Re: Immutable Message Passing

2011-12-04 Thread Andrew Wiley
On Sun, Dec 4, 2011 at 1:42 AM, Jonathan M Davis wrote: > On Sunday, December 04, 2011 01:24:02 Andrew Wiley wrote: >> This should work, right? I'm not just going crazy or something? >> >> import std.concurrency; >> import std.stdio; >> >> class Bob { >> } >> >> void main() { >>     auto tid = spa

Re: Immutable Message Passing

2011-12-03 Thread Jonathan M Davis
On Sunday, December 04, 2011 01:24:02 Andrew Wiley wrote: > This should work, right? I'm not just going crazy or something? > > import std.concurrency; > import std.stdio; > > class Bob { > } > > void main() { > auto tid = spawn(&b); > tid.send(new immutable(Bob)()); > } > > void b() {

Immutable Message Passing

2011-12-03 Thread Andrew Wiley
This should work, right? I'm not just going crazy or something? import std.concurrency; import std.stdio; class Bob { } void main() { auto tid = spawn(&b); tid.send(new immutable(Bob)()); } void b() { receive( (immutable(Bob) b) { writeln("got it"); }