Google's got a new language... Go...

Mel Wilson mwilson-4YeSL8/OYKRWk0Htik3J/w at public.gmane.org
Thu Nov 12 13:21:41 UTC 2009


Rajinder Yadav wrote:
> Christopher Browne wrote:

>> Keep in mind: The people that designed this are the same people that
>> originally designed Unix.  I trust their sense of "taste" quite a bit.
> 
> The following
> 
> s := sum(&[3]int{1,2,3});
> 
> looks like fun code, good times for sure =), unfortunately I don't see 
> any UNIX beauty ;) .... My poor head hurts looking at this line!

Thats why I don't want to see type declarations in Python.  Not so bad 
in Go, though, if it wants them.  Looks like the C for that would be

int sum (int* terms, size_t length);
const int [3] temp = {1,2,3};
int s = sum (temp, 3);

except that temp would be thrown away right after use, which C can't 
really do.  That Go statement is packed pretty full.  [3]int declares 
an array, {1,2,3} initializes it, & takes a reference, := declares a 
new variable with type and value from the RHS.  Kind of cute, 
actually.  Avoids C's cardinal sin of cutting the length of an array 
away from any references to it.

	Mel.

--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list