|
|
| The Go Programming Language (by Google) |
|
Samuel Henderson
Member #3,757
August 2003
|
Project's main page From what I understand they are trying to combine the speed of development of a dynamic language with the performance and security of a compiled language. So... I wonder how long before Allegro gets ported to Go? ================================================= |
|
axilmar
Member #1,204
April 2001
|
Go is not a dynamic language. It is a statically and strongly typed language. The dynamic part is explicitly programmed by the programmer by using interface casts like in Java. Personally, I don't understand what's the fuss. Slashdot says "Parallelism is emphasized in Go's design. The language introduces the concept of 'goroutines' which are executed concurrently", but if you look at the documentation, goroutines are nothing more than threads and channels are nothing more than synchronized data queues...big deal. I can do a synchronized queue in C++ with very little effort. Example: 1#include <pthread.h>
2#include <deque>
3
4template <class T> class Queue {
5public:
6 Queue() {
7 pthread_mutex_create(&m_mutex);
8 pthread_sem_create(&m_semaphore, 0, 0);
9 }
10
11 ~Queue() {
12 pthread_mutex_destroy(&m_mutex);
13 pthread_sem_destroy(&m_semaphore);
14 }
15
16 T get() {
17 sem_wait(&m_semaphore);
18 pthread_mutex_lock(&m_mutex);
19 T result = m_data.front();
20 m_data.pop_front();
21 pthread_mutex_unlock(&m_mutex);
22 return result;
23 }
24
25 void put(T item) {
26 pthread_mutex_lock(&m_mutex);
27 m_data.push_back(item);
28 pthread_mutex_unlock(&m_mutex);
29 sem_post();
30 }
31
32private:
33 sem_t m_semaphore;
34 pthread_mutex_t m_mutex;
35 std::deque<T> m_data;
36};
The interface decoupling from the class is a nice feature, but I can do with with C++ as well, with very little coding, using duck typing. For example: 1class IBuffer {
2public:
3 virtual void read() = 0;
4 virtual void write() = 0;
5};
6
7template <class T> class Buffer : public IBuffer {
8public:
9 Buffer(T *object) : m_object(object) {
10 }
11
12 void read() {
13 m_object->read();
14 }
15
16 void write() {
17 m_object->write();
18 }
19
20private:
21 T *m_object;
22};
What else is there? nothing much, really. Go does not have templates, so writing any compile-time safe reusable code that has minimal performance is not possible. |
|
Samuel Henderson
Member #3,757
August 2003
|
Samuel Henderson said: ... they are trying to combine the speed of development of a dynamic language with the performance... I didn't say they were actually making a dynamic language ... but rather a language that feels like one. I still think it will be interesting to see how much momentum this gains... ================================================= |
|
SiegeLord
Member #7,827
October 2006
|
Go looks like a crippled version of D with bizarre syntax. In fact, it looks like D from like 5 years ago (D started out with no templates too) with bizarre syntax. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
|
bamccaig
Member #7,536
July 2006
|
It sounds interesting to me. I'd like to see it take off. Hopefully the language improves and the toolchain stabilizes. I'm anxious to try it, but don't have access to a Linux system right now[1]... ** EDIT Quote: package main I've already got two problems with the language. Number one, it's using packages, instead of namespaces. I find namespaces, as implemented in C# (and I guess .NET) work a lot better than packages. namespace identifier { // code. namespace identifier { // code. } // code. }
The structuring is obvious in the code. It's hierarchical. Also, the package declaration should have to end in a semi-colon (;). ** EDIT ** Now that I've seen the first two example programs in the tutorial, I don't really care for the syntax of the language. It seems too disorganized and loose. Semi-colons are optional, variable types are declared after the name, etc. Not my dream language. I might use it if it becomes stable enough, but I don't see it becoming my favorite language. References
-- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
|
Billybob
Member #3,136
January 2003
|
Parentheses around if statements are optional, but curly brackets for the block are required. Personally, I've never had grief with the parentheses, but being forced to use curly brackets bloats the code. Based on that, I am going to assume the designer is making another Java-like language. By that I mean a language which arbitrarily restricts the code for "best practices". We are supposed to be giving more control to programmers, not less. Java was a step backwards from C++ in my mind, even with all of its modern features. Think of those cars that steer themselves during an accident. Imagine if they didn't have the override feature. Do you really want to trust your life to a computer? In this case, I'm fine with trusting the compiler for most things, but I want an override. C# is much more the language I prefer. It has the feature describe in the OP; being dynamic yet compiled. It's loaded with features, a nice set of standard libraries, and best of all provides that all essential override in case of accident. It is a shame C# is VM based. It sure does run fast, and pretty much every Windows system has .NET on it by now (and Linux has Mono). Still, I consider that a major flaw.
|
|
Kibiz0r
Member #6,203
September 2005
|
At first, I was repulsed. But after taking another look at it, there are a lot of things that I like about it. I like that channels are first-class citizens. I tried out Microsoft's Axum for that very reason. I also like the dynamic feel. It seems like the dynamism you get from template metaprogramming in C++ but without the brittle megastructure required to get it going. The thing I am most happy to see is that interfaces are looser than most static languages. Managing that boilerplate stuff has always seemed like a painful waste of time to me, and it's only useful as long as everything plays nice. It's an interesting language, and definitely Google-esque. You can really see the influence of languages like Newsqueak, Java, and JavaScript. --- |
|
Peter Wang
Member #23
April 2000
|
The involvement of Rob Pike and Ken Thompson alone makes it worth a longer glance than most new languages. I only looked briefly yesterday, but it could be quite nice for a certain niche. axilmar said: goroutines are nothing more than threads and channels are nothing more than synchronized data queues...big deal Actually, goroutines are green threads, so you can have a lot more of them before running out of memory, as compared to OS threads. Which is of course not new, but is a feature which works best when its natively supported by the compiler/runtime rather than hacked on. Further, programming languages are not about who came up with what feature first, but how the features combine (or not combine).
|
|
Martin Kalbfuß
Member #9,131
October 2007
|
Billybob said: By that I mean a language which arbitrarily restricts the code for "best practices". We are supposed to be giving more control to programmers, not less. Java was a step backwards from C++ in my mind, even with all of its modern features
You should try Common Lisp. As I know, you can customize nearly everything to your needs. Or Assembler But if it's best practise, why not use it? No one produces perfect code. Especially when the project is getting bigger. A good amount of rules helps. http://remote-lisp.spdns.de -- my server side lisp interpreter |
|
Billybob
Member #3,136
January 2003
|
Martin Kalbfuß said: But if it's best practise, why not use it? Because: Quote: No one produces perfect code. Do you trust the car makers to have a perfect piloting system? Even if they did, why not have the override option? I guess what it all comes down to is freedom; the freedom to choose my own best practices rather than follow blindly the ideas of another. Quote: A good amount of rules helps. I totally agree, but the people writing the code should choose the rules, not some skanky compiler. I will reference C# again as a fair example. The compiler generally does not enforce best practices with errors. The C# language specification, however, comes with a list of best practices, including how to space code. Visual Studio will automatically do the specified code spacing, but I can override it any time I wish. Perhaps it would be nice if compilers could be loaded with sets of custom rules, instead of having a fixed set.
|
|
Martin Kalbfuß
Member #9,131
October 2007
|
The ada gnat compiler has such a tool. http://remote-lisp.spdns.de -- my server side lisp interpreter |
|
Tobias Dammers
Member #2,604
August 2002
|
Billybob said: It is a shame C# is VM based. It sure does run fast, and pretty much every Windows system has .NET on it by now (and Linux has Mono). Still, I consider that a major flaw.
It does impact performance, but there are HUGE advantages to such a model; to name a few: Billybob said: I guess what it all comes down to is freedom; the freedom to choose my own best practices rather than follow blindly the ideas of another. This is all fine and dandy if it's a solo project, or if you are the lead and the rest of your team follows your guidelines. In other situations however, I'm thankful for any sane rule that the language, the compiler, or the IDE, forces on me and my team. Martin Kalbfuß said: You should try Common Lisp. As I know, you can customize nearly everything to your needs. Which is exactly why nobody uses it these days. --- |
|
Neil Walker
Member #210
April 2000
|
Seems like another waste of space Google project to me. Aren't there enough programming languages in the world at the minute that do the job well. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
|
Billybob
Member #3,136
January 2003
|
Neil Walker said: that do the job well. No.
|
|
ImLeftFooted
Member #3,935
October 2003
|
Quote: that do the job well. No. (once more for added effect) |
|
Goalie Ca
Member #2,579
July 2002
|
I watched the talk.. rather half of the talk. The big names got my interest since everyone including google is involved. Then the introduction really got my attention: a simple grammar, orthogonal features, systems level language with GC, etc. It really seems like simplicity at its best! .. And then I saw the code itself. ------------- |
|
Arvidsson
Member #4,603
May 2004
|
And??? The suspense is killing me!
|
|
Trezker
Member #1,739
December 2001
|
Quote: that do the job well
No. I think it's time for the next big language beyond C and C++. Anything more? |
|
axilmar
Member #1,204
April 2001
|
Tobias Dammers said:
It does impact performance, but there are HUGE advantages to such a model; to name a few: Why all these things cannot be done in a native programming language, i.e. a programming language with a virtual machine? I think that they are entirely possible. -Reflection is a matter of storing type information in the binary. Why do all things things need a VM? they don't. Dustin Dettmer said: No. (once more for added effect) NO!!!!! (more effect!) One big disadvantage of decoupling interfaces and classes is the inability to send messages to self. |
|
miran
Member #2,407
June 2002
|
I didn't read the project page, so I'm just going to ask here. Is Go's standard library named Ogle? -- |
|
anonymous
Member #8025
November 2006
|
I think Go! is better (because of the exclamation mark). |
|
Evert
Member #794
November 2000
|
miran said: Is Go's standard library named Ogle? Apparently that's the proposed name of the debugger. |
|
piccolo
Member #3,163
January 2003
|
dynamic language would be sweet we could have a program program itself at run time. this is posible now but not with out memory hacks. and a module design where you have module prgraming module. wow |
|
Ben Delacob
Member #6,141
August 2005
|
anonymous said: I think Go! [en.wikipedia.org] is better (because of the exclamation mark). Why would Google name it "Go"? Sure, it's catchy and has a similarity to their name but I can't even search for the board game Go. C was bad enough. However, not nearly as many people just start using the letter C when talking but Go is everywhere. I'd prefer to search for something in another language rather than try to find it done in Go. __________________________________ |
|
Evert
Member #794
November 2000
|
I agree, they could have named it "G" to stick with the tradition of single-character names (there's "D" obviously and there's "F", not sure if there's "E", but "G" would be the next one up). |
|
|
|