I'm porting some go code to D

Rory McGuire rjmcguire at gmail.com
Sat Aug 24 06:43:10 PDT 2013


On 24 Aug 2013 11:25, "Moritz Maxeiner" <moritz at ucworks.org> wrote:
>
> On Friday, 23 August 2013 at 23:54:55 UTC, Rory McGuire wrote:
>>
>> So I'm porting so #golang code to #dlang and there is all these blasted
>> "go" statements.So I thought I'd give implmenting it in D a shot. What do
>> you guys think?
>> Fire away :).
>>
>> /**
>>  * chan allows messaging between threads without having to deal with
locks,
>> similar to how chan works in golang
>>  */
>> class chan_(T) {
>>     shared Mutex lock;
>>     struct Container(T) {
>>         T value;
>>         Container!T* next;
>
>
> I'm probably missunderstanding somehting about the TLS model, but from
what I know, for something like this, shouldn't you make the class instance
itself go into shared storage instead instead of all the members?
>
I have no idea if shared on the class makes all it's parts shared.
It was a struct but I had problems with passing it to the spawn func when I
was using std.concurrent .

I'm trying to port a cassandra cql library from go so it's really just to
help with that.

I'm having a hard time imagining how to implement select from go. Could
probably use std.concurrent.receive because that can handle multiple types
at once.

Sorry I'm rambling...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20130824/bbc2b4cf/attachment.html>


More information about the Digitalmars-d-announce mailing list