(Untitled)

Nov 10, 2009 23:19

Initial reactions to the new Go programming language (not that I plan to do much systems programming ( Read more... )

Leave a comment

Comments 10

big_bad_al November 11 2009, 10:19:34 UTC
I feel like there are a lot of inconsistencies in the language. Do we really need to distinguish between arrays and slices? I promise you that the differences between new() and make() will trip people up and have them allocating const nil values. I still don't see an easy way to do inheritance (since it's only kinda object oriented, and the interfaces don't let you inherit functionality), but perhaps I just haven't looked hard enough. I don't understand the rationale behind type assertions; it seems like it's casting everything to/from void*'s, which feels wrong given how type-safe the rest of it is.

I do like the concurrency primitives, though. and I agree that the multiple return values and _ are a huge step up from something like C++ (though they're certainly not novel).

Reply

inferno0069 November 11 2009, 16:38:52 UTC
For new() vs make(), I think I've got it (at least for their provided types) because new is pretty similar to the default values for Java types.

Type assertions feel more to me like newtype in Haskell, but I'm not sure I remember them right at the moment.

For inheritance, see the Embedding section in the Effective Go doc for everything I've seen about that so far.

http://golang.org/doc/effective_go.html

Reply

big_bad_al November 12 2009, 00:01:20 UTC
Thanks for pointing me to that; it makes more sense now. I think the most succinct way to phrase my inheritance complaint is that it doesn't automatically build superclasses: you need to construct the superclass yourself and pass it into the subclass explicitly. and I guess that's not as bad as I had originally thought, since you've probably made factories for every struct you define (each of which can call the factory of its superstructs, and so on up the hierarchy).

So, I guess my "complaint" here is that it's just not anything I'm used to, rather than something really wrong with the language. :-P

Reply


firegoblin November 11 2009, 14:19:03 UTC
Yesterday I started a project with Python and discovered that there the newline is the end-of-statement marker. *right pinky cries for lack of semicolons*

Reply

big_bad_al November 11 2009, 17:16:08 UTC
Really? I far prefer Python's lack of semicolons. It's obvious to people where statements end, and it ought to be obvious to the parser as well.

Reply

firegoblin November 11 2009, 17:58:47 UTC
It doesn't bother me conceptually, I'm just going to have to retrain my pinky.

Reply

avani November 11 2009, 17:35:19 UTC
I remember thinking it was a little wierd for a few hours, but it grows on you very quickly, and now, a few years later, I find languages that use other delimiters unnatural. Also, I believe you can still put semi-colons in if you choose and the parser will just ignore them (just tried it; seems to work on basic examples).

I highly recommend setting your indentation level to something small so you don't end up out of screen real estate 3 levels in. The only mildly annoying bit about python using newline is that you may have to do some creative line-breaking to avoid hitting 80 char, if you care about that sort of thing.

Reply


thegreatgonz November 11 2009, 16:29:15 UTC
Nothing nags at me so much as their dismissal of assertions. Used wrong, sure, they can be a crutch to avoid proper error handling, but they can be an invaluable debugging and documentation tool when used well.

Reply


Leave a comment

Up