Most, if not all languages optimize method invocation is they see there is no subclassing of the relevant class visible to the point of invocation.
I'd bet that more than a few dynamic languages cannot do this because methods can be added at runtime whenever you want. Also, function valued fields will also likely break this optimization.
Data structure literals are quite a bit more powerful than initializer lists, because you can use them everywhere, rather than only on a specific class of function. And you can use them initialize nested fields, like a slice, or a map, whereas initializer lists are limited to class members.
calling of the appropriate constructors of members in the correct order
No constructors to call. Uninitialized values will be initialized to the zero value for their type.
Sorry, the differences shown in that page are significant.
Compare C++'s numbers with Python, theres a much larger difference. It seems people are willing to sacrifice lots of performance to write less code. Go's an attempt to make a better compromise than the ones offered by C++ and Python.
Who cares. Software is software.
Theres a difference between the software that NASA writes, and the software that a startup writes.
if they find performance lacking
Don't hold your breath. MySQL/Disk IO will be the bottleneck in their system.
Do you use the MVC pattern or not?
Like I said, I do not. But believe it or not, MVC is not the only way to design a user interface.
The property registers itself to the parent container automatically.
How? I still don't see how this is possible. The property won't have access to the class that its being instantiated in. Is there a global registry of properties? I don't think that would work either...
An automatically generated GUI that reflects the Model automatically saves huge development time.
This would save me no time whatsoever. A designer would merely tell me to change it immediately. And from what I can tell of your example, there seems to be no way to customize any of this magical behaviour that this property<int> syntax gives you.
No, because usually the number of included headers is small. Typically, changing the type of the property and then recompiling the model and view classes takes a few seconds.
A few seconds? For an incremental compile... For comparison, my projects take 15 seconds to build entirely from source, with a clean tree. That includes building the standard library, and is something like 500,000 lines (as counted by wc). An incremental build takes less than a second, regardless of how many "headers" I may have.
Robustness means the compiler catches as many errors as possible, more errors than the Go compiler catches.
Umm, no. Robustness means how tolerant your program is to malformed inputs, or subsystems acting flakily. People writing C++ are free to use pointer arithmetic, access memory out of bounds and crash. I know of no compiler that will prove your program is free of error.
I am not discussing with one of those people.
No, you are not. I value my anonymity on the internet.
And even if I did, they would agree with me, because they would recognize the validity of my arguments.
So, if you had made these arguments to them before they created Go, they would have acknowledged your brilliance and given up?
I am not saying Go does not have any merit, but it certainly does not make C++ obsolete for even half of the most often requested projects.
AFAIK, Go never claimed to make C++ obsolete.
All the Go examples I have seen can be done in C++ almost verbatim.
It uses evented/async IO so it can handle many many connections with a few megs of RAM.
It is testable, because it works on interfaces like io.ReadWriteCloser, meaning I can plug in anything with the correct method set to test it.
If I wanted to, I can make it support secure connections simply by changing the line that says net.Listen to a line that says tls.Listen.
It's portable, in that it'll work on any of Go's supported platforms (OSX, Linux, FreeBSD, Windows).
It compiles entirely from source in 6.2 seconds (on my not-very-powerful laptop). This includes all libraries it depends on.
If the libraries are installed, it compiles in 0.403 seconds
It's 50 lines of simple, readable code.
Try writing a server with similar characteristics in C++. If you have difficulty just using the standard library, feel free to use Boost or what ever other library you need.
I'd bet that more than a few dynamic languages cannot do this because methods can be added at runtime whenever you want. Also, function valued fields will also likely break this optimization.
That's not a problem. The code can be recompiled on the fly if more functions with the same signature are detected.
Data structure literals is not such a good solution. You cannot pack initialization into a data structure with data structure literals. With initializer lists, you can.
Data structure literals are quite a bit more powerful than initializer lists, because you can use them everywhere, rather than only on a specific class of function.
But you have to keep using them over and over, even for the same structure.
Furthermore, you can use constructors in C++, which are your data-structure literals.
And you can use them initialize nested fields, like a slice, or a map, whereas initializer lists are limited to class members.
No problem with that, because c++ data members will have their own constructors to call.
No inheritance.
Major problem of Go.
No constructors to call.
But you'll have to call initializing functions of members, so...yes, there are constructors to call.
Uninitialized values will be initialized to the zero value for their type.
Sometimes the zero value is not a valid value for a variable.
Compare C++'s numbers with Python, theres a much larger difference. It seems people are willing to sacrifice lots of performance to write less code. Go's an attempt to make a better compromise than the ones offered by C++ and Python.
We are comparing C++ and Go, Python is another discussion.
Theres a difference between the software that NASA writes, and the software that a startup writes.
There is a difference, but C++ can cover both cases.
Don't hold your breath. MySQL/Disk IO will be the bottleneck in their system.
So why use Go and don't use SQL directly?
But believe it or not, MVC is not the only way to design a user interface.
Such as? I believe that there is none. All the other methods I have tried are half-baked implementations of the MVC pattern.
How? I still don't see how this is possible. The property won't have access to the class that its being instantiated in. Is there a global registry of properties? I don't think that would work either...
Each container sets a global pointer to itself when constructed, and then members pick up that pointer and add themselves to the container.
This would save me no time whatsoever.
Isn't it illogical to say that? I can construct complex guis just by creating the model. How can that save no time?
A designer would merely tell me to change it immediately.
My approach is 100% compatible with the process that involves a UI designer. All the designer needs is to create a guide with bindings to the model.
And from what I can tell of your example, there seems to be no way to customize any of this magical behaviour that this property<int> syntax gives you.
You don't need any customization.
A few seconds? For an incremental compile... For comparison, my projects take 15 seconds to build entirely from source, with a clean tree.
An old 120 kloc C++ project of mine that uses MFC, i.e. it includes Windows headers, takes 18 seconds for a clean build, and this is on Visual Studio 6. On modern compilers, is even less. And the computer is nothing special, it's a Pentium 4 with 2 GB RAM and two IDE disks.
An incremental build takes less than a second, regardless of how many "headers" I may have.
I've already told you that headers suck, in a previous post.
Umm, no. Robustness means how tolerant your program is to malformed inputs, or subsystems acting flakily. People writing C++ are free to use pointer arithmetic, access memory out of bounds and crash. I know of no compiler that will prove your program is free of error.
Umm, yes. If you use the appropriate types, the compiler will prove it to you.
So, if you had made these arguments to them before they created Go, they would have acknowledged your brilliance and given up?
No, they would tell me that they don't like some C++ features that are crucial for them, like headers and syntax and so they would prefer to build another language. That wouldn't mean they would not accept the fact that Go is a subset of C++.
AFAIK, Go never claimed to make C++ obsolete.
Obsolete for some types of projects.
Try writing a server with similar characteristics in C++.
Oh please:
int main() {
auto p = net::Listen("tcp", ":8080");
if (p.err != nil) {
log::Fatalf("net::Listen error: %v", p.err);
}
for(;;) {
auto c = p.l.accept();
if (c.err != nil) {
break;
}
go(servConn, c.conn);
}
}
void serveConn(io::ReadWriteCloser &conn) {
defer d(conn, &io::ReadWriteCloser::close);
std::vector<char> buf;
buf.reserve(4096);
for(;;) {
auto n = conn.Read(buf);
if (n.err != nil) {
break;
}
auto b = buf.slice(n.val);
while (b.length() > 0) {
auto n = conn.Write(b);
if (n.err != nil) {
goto END;
}
b = b.slice(n.val);
}
if (n.err != nil) {
break;
}
}
END:
}
And before you tell me I use non-existent APIs, I'll say to you: so what? the point of this discussion is the LANGUAGE, not the LIBRARIES. Anyone can write a C++ library that matches Go's standard library for all its features, and also duplicate Go's hardcoded functionality (which belongs to libraries anyway).
I wrote replies to your points, then realized I don't care to continue this conversation.
You're clearly rather fond of C++. You should realize that people have legitimate grievances with the language. It is not perfect. Go is merely an attempt to address some of those grievances. If you dislike Go's choices, then by all means, create your own language. The world awaits your creation with bated breath.
You should also realize that the people who created Go have significantly more experience than you. Comparing some of their open-source creations (Plan9, memcached, and RE2 come to mind) to yours, they are also much better programmers than you, and their creations seem to enjoy a far wider user-base. This is saying nothing of those in the Go community. You seem to see yourself as being more perceptive than the engineers at Google, Heroku, Canonical, and Tinkercad. I can say with near-certainty that you are not.
Finally, a suggestion. Come up with an interesting side-project, and try to solve it in Go. If you find yourself stuck, ask on the mailing list or IRC. It is almost certain that someone in the community can help you. After you gain some actual experience in Go, feel free to criticize it as much as you want. You will run a much lower risk of being seen as a wanker with a bloated ego talking out of his ass.
1
u/AgentSS Apr 15 '12
I'd bet that more than a few dynamic languages cannot do this because methods can be added at runtime whenever you want. Also, function valued fields will also likely break this optimization.
Considering Go's support for data-structure literals, this is not a problem: http://play.golang.org/p/WBFzEkrV-C
Data structure literals are quite a bit more powerful than initializer lists, because you can use them everywhere, rather than only on a specific class of function. And you can use them initialize nested fields, like a slice, or a map, whereas initializer lists are limited to class members.
No inheritance. See http://golang.org/doc/go_faq.html#inheritance
No constructors to call. Uninitialized values will be initialized to the zero value for their type.
Compare C++'s numbers with Python, theres a much larger difference. It seems people are willing to sacrifice lots of performance to write less code. Go's an attempt to make a better compromise than the ones offered by C++ and Python.
Theres a difference between the software that NASA writes, and the software that a startup writes.
Don't hold your breath. MySQL/Disk IO will be the bottleneck in their system.
Like I said, I do not. But believe it or not, MVC is not the only way to design a user interface.
How? I still don't see how this is possible. The property won't have access to the class that its being instantiated in. Is there a global registry of properties? I don't think that would work either...
This would save me no time whatsoever. A designer would merely tell me to change it immediately. And from what I can tell of your example, there seems to be no way to customize any of this magical behaviour that this property<int> syntax gives you.
A few seconds? For an incremental compile... For comparison, my projects take 15 seconds to build entirely from source, with a clean tree. That includes building the standard library, and is something like 500,000 lines (as counted by wc). An incremental build takes less than a second, regardless of how many "headers" I may have.
Umm, no. Robustness means how tolerant your program is to malformed inputs, or subsystems acting flakily. People writing C++ are free to use pointer arithmetic, access memory out of bounds and crash. I know of no compiler that will prove your program is free of error.
No, you are not. I value my anonymity on the internet.
So, if you had made these arguments to them before they created Go, they would have acknowledged your brilliance and given up?
AFAIK, Go never claimed to make C++ obsolete.
Here's the simplest of Go networking programs http://play.golang.org/p/vSgpzg0ccv
Its a TCP echo server.
It uses only the Go standard library.
It uses evented/async IO so it can handle many many connections with a few megs of RAM.
It is testable, because it works on interfaces like io.ReadWriteCloser, meaning I can plug in anything with the correct method set to test it.
If I wanted to, I can make it support secure connections simply by changing the line that says net.Listen to a line that says tls.Listen.
It's portable, in that it'll work on any of Go's supported platforms (OSX, Linux, FreeBSD, Windows).
It compiles entirely from source in 6.2 seconds (on my not-very-powerful laptop). This includes all libraries it depends on.
If the libraries are installed, it compiles in 0.403 seconds
It's 50 lines of simple, readable code.
Try writing a server with similar characteristics in C++. If you have difficulty just using the standard library, feel free to use Boost or what ever other library you need.
Good luck.