The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Go-ing with C Syntax

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Go-ing with C Syntax Posted: Nov 12, 2009 8:33 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Go-ing with C Syntax
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

Even Google can't "think different" when it comes to language design - the straightjacket of C language syntax conformance has been fitted around their new Go language. I took a short walk around the FAQs and language description, and came away somewhat non-plussed:

  • C style syntax - I suppose this continues the "it looks like what I know already" thing, but it also makes it harder to break from the past
  • Which leads to: Pointers, but no pointer arithmetic. That just makes no sense to me. Either you don't need pointers (because, as with Smalltalk, everything could be considered a pointer), or you really want the power. This seems like a halfway house that will make no one happy
  • Go has Casts, which is, IMHO, a huge mistake. A type system that includes Casts is a type system that the designers know has problems. I feel like Obi-Wan - "Just use the force, Google"
  • No function overloading and no user defined types. Back to one of my favorite issues - the old "designer is a god who knows all possible uses" error. This is how Java ended up with helper classes all over the place; seems Go will get to the same bad place
  • Instead of "while", you can add a condition to a "for" loop. To quote Google's page: "Omitting the condition entirely is an endless loop.". There's a whole class of needless bugs introduced right there, guys. Brilliant.

Constants look interesting - they are untyped, but they gain an implicit type based on context. I love code that makes me guess what'll happen based on the surroundings. This mixture of static typing and dynamic typing is kind of a worst of all possible worlds thing; IMHO, you need to go in one direction or the other. Obviously, I prefer dynamic typing, but this half in/half out thing is just asking for trouble.

I will say that providing interfaces instead of the bizarre mix of things in C++ was a good idea. Anytime you can pitch N concepts and retain just one, you've made life easier for people.

The Goroutine idea is interesting, but they've elided over an interesting issue - one that Smalltalk (lightweight) threads have, by the way, although having them run as native OS threads gives you even less control. To wit:

All goroutines in a single program share the same address space. Internally, goroutines act like coroutines that are multiplexed among multiple operating system threads. You do not have to worry about these details.

Except that you do need to worry about the details - at least the relevant ones. It's just as easy to use #fork in Smalltalk, but that doesn't relieve you of the need to worry about shared state issues. All Goroutines run in the same address space - unlike Erlang's "share nothing" concept, this is "share everything". Making it easy to invoke an OS thread is not the hard problem; the hard problem is state. Channels (akin to class SharedQueue in Smalltalk) can be used to communicate between Goroutines, but that just doesn't help. Having them all in the same address space means that your state issue is still there, waiting to explode.

So what do I think, overall? It could be considered a better Java, but not by a lot. Creating new threads in Java is easy enough. It's harder than Python, because it adds a static type system (with the wonderfully ambiguous Constant thing). They claim it compiles fast, which would be a benefit - but I'd like to see some real world examples of that. Ultimately, I just don't think that Goroutines buy you much. If you go to their memory model page, you'll note that there's syntax for locks and synchronization - and that's because you still have a shared state model going on. I can see this being a simpler language than Java or C++, but I don't see it being that useful for most users of Smalltalk, Ruby, Python (et. al.). The complexity level seems lower than C++ or Java, but higher than the dynamic camp - and it doesn't seem to be bringing enough to the party to make dynamic language users switch. The big win over C++ (and, to a lesser extent, Java), is package (dependency) management. Looks like they've done a good job at simplifying that.

That's my 4 cents, anyway - what do you think?

Technorati Tags: ,

Read: Go-ing with C Syntax

Topic: Web Velocity Editing: What's Coming Previous Topic   Next Topic Topic: My Challenge to Agile Tool Vendors

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use