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

Russel Winder via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 17 00:37:15 PDT 2015


On Sat, 2015-03-14 at 22:18 +0000, deadalnix via Digitalmars-d wrote:
[…]
> So now we are going from Go is safe, to well, it is obviously not 
> safe (then, why were you so eager to have a proof ?) but nobody 
> in their right mind would do something like this.

It is usually Andrei that catches me out overstating the case in
general…

My model of dataflow is of processes (separate address spaces) passing
messages which are values not address. This is the way I use GPars,
Python-CSP and Go. As Andrei proved with an existence proof, Go makes it
easy to break this model by sending address around because goroutines
are not processes: goroutines are tasks on a thread pool in a single
address space.
 
> But this is only a short snippet. This can happen the same way in 
> a million line codebase, and good luck finding it.
> 
> Also, the "no good programmer would do this" is an immediate red 
> flag. Not only programmer will do this, but the one that claim 
> they won't will do it even sooner as they evidently lack self 
> awareness.

Indeed. Which is why goroutines really should be enforced processes,
i.e. no access to state outside the goroutine code should be allowed. As
far as I am aware Erlang is the premier example of doing this right. We
try hard with GPars, but there are still ways of circumventing.
Python-CSP has the "problem" that every process is a separate PVM so
they really are processes, no mutable state sharing is possible unless
you actively construct it. You can, but it is quite hard to do by
accident.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150317/9db97b85/attachment-0001.sig>


More information about the Digitalmars-d mailing list