D vs Go in real life

Chris wendlec at tcd.ie
Fri Nov 29 08:15:09 PST 2013


On Friday, 29 November 2013 at 15:21:26 UTC, Chris Cain wrote:
> On Friday, 29 November 2013 at 12:06:17 UTC, Chris wrote:
>> [1] Raises the question whether we've been conditioned by C or 
>> whether C was intuitive.
>
> I'll answer for you: C was very counter intuitive which is why 
> no one has done exactly what it did since. Look up the spiral 
> rule for reading types in C. Most often it can be thought of 
> being read from right to left, but that's not the actual 
> reading.
>
> http://c-faq.com/decl/spiral.anderson.html
>
> D fixes this massive issue to a certain degree, but it still 
> feels backwards to me, despite me having been raised with 
> "types on the left of the name". After using a language doing 
> it "the right way" for awhile, you quickly adapt and realize it 
> makes the most sense.
>
> At least, that's the way that I feel.

I agree that D, too, can be a bit confusing. I sometimes have 
problems with AA declarations.

Example:

string[string][string] hm; // What am I?

But I don't think it's the reading direction. I wonder why you 
would want the variable name first.

var omitNewline bool

or

func (r RepeatByte) Read(p []byte) (n int, err error)

or ":="

or "var". _Of course_ it's a variable:

bool yes;
string answer;

For my liking Go code looks too cluttered (pointing out the 
obvious). But I guess it's just the way you're "brought up" with 
a language. Maybe I'm a dinosaur.


More information about the Digitalmars-d mailing list