What’s Wrong with OOP and FP

logicchains jonathan.t.barnard at gmail.com
Wed Nov 13 04:05:49 PST 2013


On Wednesday, 13 November 2013 at 11:30:14 UTC, eles wrote:
> On Wednesday, 13 November 2013 at 10:19:34 UTC, logicchains 
> wrote:
>> On Wednesday, 13 November 2013 at 09:12:40 UTC, Jonathan M 
>> Davis wrote:
>
>> struct, then I have to write (*pt).X to access field X of that
>
> It is in our guidelines too. I almost never write "->".

Ah, right. I just tested, and turns out Go does actually 
automatically dereference pointers to structs, but not to arrays. 
So if arrp is a pointer to an array, writing arrp[0] is a syntax 
error in Go, and it must be written as (*arrp)[0]. D on the other 
hand, as far as I'm aware (correct me if I'm wrong), would 
automatically dereference the pointer.


More information about the Digitalmars-d mailing list