A few notes on choosing between Go and D for a quick project

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 14 10:11:55 PDT 2015


On 3/14/15 2:02 AM, Russel Winder via Digitalmars-d wrote:
> On Fri, 2015-03-13 at 07:55 -0700, Andrei Alexandrescu via Digitalmars-d
> wrote:
>> On 3/13/15 6:45 AM, Russel Winder via Digitalmars-d wrote:
>>> The removal of shared memory multi-threading in favour of using
>>> processes and channels should never be underestimated as a Really Good
>>> Thing™ that other native code languages (*) have failed to do anything
>>> about. Thus Go wins, others lose.
>>
>> That's a marketing success as well. Go didn't "remove" shared memory
>> multi-threading, it just unrecommends it. That's quite unremarkable from
>> a programming language design standpoint, but as discussed that's not
>> always crucial for success. -- Andrei
>
> I think you need to show a bit of Go code that uses threads to be able
> to back up that claim.

package main

type Data struct {
     i int
}

func func1(c chan *Data ) {
     var t *Data;
     t = <-c
     println(t)
}

func func2(c chan *Data ) {
     var t *Data;
     t = <-c
     println(t)
}

func main() {
     c := make(chan *Data)
     t := Data{10}
     go func1(c)
     c <- &t
     go func2(c)
     c <- &t
     println(&t)
}



More information about the Digitalmars-d mailing list