4 ms·
It is probably a bit misleading when so many say: 'golang is easy', it is not, it is as difficult as Java or other language, probably easier than c++ and rust,
by synergy20 4y ago
It is probably a bit misleading when so many say: 'golang is easy', it is not, it is as difficult as Java or other language, probably easier than c++ and rust, but definitely not an easy language.
it makes great sense for network with concurrency, not so with real time or low resource devices to me.
- mort96 4y agoI always found languages which require you to always remember to manually call destructors to be quite hard, be they C or Go or JavaScript, when the system has lots of moving parts and performance is a concern. A single mistake and you're leaking.
- asp_hornet 4y agoGo doesn’t require you to call a destructor
- morelisp 4y agoClose, e.g., is a destructor in this context. Defer helps but some true lexical scoping might be nicer.
- andsoitis 4y ago> remember to manually call destructors to be quite hard, be they C or Go or JavaScript I thought JacaScript doesn’t have destructors (in the memory/resource management sense) or finalizers…
- mort96 4y agoFile handle destructor: https://nodejs.org/api/fs.html#filehandleclose https://nodejs.org/api/fs.html#filehandleclose WebSocket's destructor: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/c... HTTP server's destructor: https://nodejs.org/api/http.html#serverclosecallback https://nodejs.org/api/http.html#serverclosecallback Etc etc etc. You're right that JS/C/Go don't have language features called destructors, but they have a whole bunch of types with ad-hoc destructor functions which you have to remember to call if you want to avoid leaking resources.
- bakkoting 4y agoThere's a proposal for syntax to help with this in JS, incidentally: https://github.com/tc39/proposal-explicit-resource-management https://github.com/tc39/proposal-explicit-resource-managemen...
- baby 4y agoI found it much easier than java, and a bit harder than python, for reference
- kaba0 4y agoWhat is hard about Java? It is a very small language.
- philosopher1234 4y agoPublic static void is already quite a lot for beginners to learn
- kaba0 4y agoI don’t know — do you have to know how an engine works to drive a car? While they may not understand at first why they have to write this, I really dislike when people make that 3 words into something impossible to grasp. A good chunk of all programmers have learnt to program by starting with Java. And besides these 3 words, it is a small language (very few keywords), easy, but sufficiently strong type system that will catch most of your problems at compile time, and first and foremost, very well-defined runtime semantics, even when errors happen, all of which help beginners greatly.
- kweingar 4y agoOne of the underrated difficulties of learning Java is the fact that it demands separate files for each exported class. Writing and reading simple Go libraries is a breeze. I’ve written tiny libraries that fit in one file. You can read it linearly, starting at the top and following the logical progression of type declarations, functions, globals, etc. Whereas with an identical Java library, a reader would be presented with several small files and have no idea where to start reading.
- simiones 4y agoIf you really need this, you can always expose all your actual classes as public static class members of a single wrapper class: public class Wrapper { public static class C1 { } public static class C2 { } } //other module: var x = new Wrapper.C1();