top | item 42565172

(no title)

LysPJ | 1 year ago

As a C programmer, declarations in Go appeared "backwards" to me when I first saw them.

IMO the Go syntax is a vast improvement as it's much simpler and avoids the clockwise/spiral issue: https://appliedgo.com/blog/go-declaration-syntax

discuss

order

rollcat|1 year ago

It's worth to remember that C "happened" to stick around because of UNIX, but it's been just another iteration of what started as BCPL; with Go coming from the same people who made Plan 9 (the spiritual successor to Research UNIX) and Alef/Limbo. These guys are equally interested in pushing both PL/OS research and practice.

(I also have no doubt that just like Go fixed C's type declarations, in another 20-30 years, Go's successor will finally fix error handling.)

unrealhoang|1 year ago

hence why every recent programming languages are type after name (go included).

gf000|1 year ago

I think a proper type system that doesn't special-cases arrays are better, e.g. Array<String>. Pointers may also be part of this uniform structure, e.g. Array<Ref<String>>, and there is zero question on how to parse it even if you are not familiar.

atiedebee|1 year ago

I like the way Dlang does it. It keeps the types on the left like C, but are actually readable.

tpoacher|1 year ago

even better, they should have it above or below!

or, declare the type separately, like in fortran or haskell (or in fact, pre-C99 c)