Linked by kragil on Wed 23rd Jan 2013 20:26 UTC
Google "Native Client enables Chrome to run high-performance apps compiled from your C and C++ code. One of the main goals of Native Client is to be architecture-independent, so that all machines can run NaCl content. Today we're taking another step toward that goal: our Native Client SDK now supports ARM devices, from version 25 and onwards."
Thread beginning with comment 550173
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[5]: Comment by Laurence
by Hiev on Wed 23rd Jan 2013 22:27 UTC in reply to "RE[4]: Comment by Laurence"
Member since:

I can read the code:

func fib() func() int {

declares a function that returns a function.

a, b := 0, 1

declares a and b as integer then initialized them with a zero.

return func() int {
a, b = b, a+b
return a

That's the closure, but the difference with its counterparts like Javascript and C# is that you can mix that example with pointers and a weird array initialization syntax that Go allows.

I said Go is a C like language, why do you keep comparing it with Javascript and C#?

Reply Parent Score: 2

RE[6]: Comment by Laurence
by satsujinka on Thu 24th Jan 2013 03:22 in reply to "RE[5]: Comment by Laurence"
satsujinka Member since:

I'm not comparing it with JavaScript or C#. I was just showing that it's a 1-to-1 match with how you'd normally write a function that returns a function that computes successive Fibonacci numbers.

Though since you mention it, the JavaScript version looks identical as well.

function fib() {
var a = 0; var b = 1;
return function() {a = b; b = b + 1; return a;};

How's pointer or array syntax weird?

func f() []int {...}
func f() *int {...}

There's nothing weird about those signatures.
Array initialization is almost exactly like C:


Reply Parent Score: 2