You Don't Like Go Because You Are Small



  • @riking said:

    “Go is not meant to innovate programming theory. It’s meant to innovate programming practice.”

    How? Because I haven't seen anything that would make me drink that Kool Aid.


  • BINNED

    @riking said:

    You can't implement a control structure in a library.

    Sure you can. People do it in Lisp and Forth all the time.


  • FoxDev

    @riking said:

    You can't implement a control structure in a library.

    *ahem*

    an example from that page:

    // assuming openFiles is an array of file names 
    async.each(openFiles, function(file, callback) {
    
      // Perform operation on file here.
      console.log('Processing file ' + file);
    
      if( file.length > 32 ) {
        console.log('This file name is too long');
        callback('File name too long');
      } else {
        // Do work to process file here
        console.log('File processed');
        callback();
      }
    }, function(err){
        // if any of the file processing produced an error, err would equal that error
        if( err ) {
          // One of the iterations produced an error.
          // All processing will now stop.
          console.log('A file failed to process');
        } else {
          console.log('All files have been processed successfully');
        }
    });
    

    foreach implemented in javascript as a library!



  • @ben_lubar said:

    CSP-style concurrency.

    Yeah, Wikipedia doesn't have a realistically digestible explanation.





  • @riking said:

    You can't implement a control structure in a library.

    I understand that.

    But that IS the essence of my previous argument.

    Well, unless that means better performance, or better semantics/syntax,
    it doesn't actually give us any benefit over having a robust extendable
    language.

    The only thing a new language can give you, is baked in syntax. And you say a control structure, well that IS baked in syntax. You can implement a while loop in COBOL. It is a control structure, just more explicitly stated. Which makes it easier to make mistakes, or construct in a way that performs worse, and gives you really bad syntax and semantics.

    Baking in a while control structure is going to be beneficial by making it easier to read, easier to construct, and possibly more efficient.

    However, concurrency is already in C++. Unless I don't understand some magic of go, it's concurrency style can be implemented in C++.

    Matter of fact, most of C++'s advancement in 11 was simply providing more concise syntax. Anonymous methods do not provide any logical gains (They don't allow us to do anything new, or change the way we approach programming), but rather allow us to be more concise.

    "Moving" features simply become a resource management tool. It changes the way we approach resources (adds more recyclability), so that's a new thing, but anonymous methods was not.



  • If that was all it means, then how is that different than starting up two threads and using WaitFor__.


  • BINNED

    @xaade said:

    You can implement a while loop in COBOL.

    And a foreach in C++!

    #define Q_FOREACH(variable, container)                                \
    for (QForeachContainer<__typeof__(container)> _container_(container); \
         !_container_.brk && _container_.i != _container_.e;              \
         __extension__  ({ ++_container_.brk; ++_container_.i; }))        \
        for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;}))
    
    template <typename T>
    class QForeachContainer {
    public:
        inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { }
        const T c;
        int brk;
        typename T::const_iterator i, e;
    };
    

    Ok, I'm gonna go wash my eyes with soap and try to forget...



  • It's not, but that's not the point. Anything you can do in C, Java, C++, C#, Go, Haskell, JavaScript, BrainFuck, or any other turing-complete language can be done in any other turing-complete language. That doesn't mean it's easy or the right language for the job. For example, I wrote a streaming video decoder in JavaScript. Does it work? Yes. Is it the right language for the job? Probably not. Does that mean it's impossible? No.



  • I get it.

    The criticism here isn't that Go is offering something new, bleh, new, who needs it?

    How many different ways can I express this....
    deep breath

    The criticism is levied against this part...

    @ben_lubar said:

    That doesn't mean it's easy or the right language for the job

    Given, Go's unique syntax and built in constructs that are unique compared to C++, C#, etc (mostly compared against these two because of the syntax style)........

    ....... is it better suited for ANY job?

    I mean, ThreadPool and WaitFor__ in C# are about the damnest easy way to accomplish concurrency.
    Does Go really do that better?

    That's the criticism.

    Now

    The other half of the criticism is this.

    Even if it does THAT better.....

    Look at all the things it makes arbitrarily MORE complicated.


  • Discourse touched me in a no-no place

    @accalia said:

    foreach implemented in javascript as a library!

    That's not foreach syntax, just foreach semantics. The argument here is about syntax. There are languages that can have new (apparent) syntax introduced by libraries, but JS isn't really one of them. (JS's key USP is its wide deployment in browsers. That's the only reason why the majority of programmers have any time for it at all.)

    @xaade said:

    The only thing a new language can give you, is baked in syntax. And you say a control structure, well that IS baked in syntax.

    That's not quite true. It might be true in some languages like C++ (and Java and Go and … well quite a lot of languages really) but it's not in general true. A good counterexample is Ruby, where it's lightweight lambda syntax means that user code can define what appears to be new control structures quite easily. You can do similar things in a number of other languages too (both Perl and Tcl off the top of my head, and the Lisp variants too) though the details of how vary a lot.

    The fact that you think you don't need this sort of thing is just the good old Blub Effect once again. I've been writing more C++ in recent months than I used to, and while it's better than it used to be (WARNING: comparing with 1993 here!) I'm still frustrated by its lack of proper high-level constructs whenever I have to deal with stuff like its iteration idioms.

    Go has some reasonable things to it (imperative + CSP channels) but I still see no need to use it. It doesn't solve my problems.



  • @dkf said:

    That's not quite true. It might be true in some languages like C++ (and Java and Go and … well quite a lot of languages really) but it's not in general true. A good counterexample is Ruby, where it's lightweight lambda syntax means that user code can define what appears to be new control structures quite easily. You can do similar things in a number of other languages too (both Perl and Tcl off the top of my head, and the Lisp variants too) though the details of how vary a lot.

    The only significant omission from this list is Forth, and possibly Scala (but I don't know enough about Scala to know if it's significant or not).

    As a general rule, moving control flow syntax out of the core language into libraries is a net win for users of the language (with the proviso that the language has a sane enough base syntax that enough people will want to work with it in the first place...)


  • Discourse touched me in a no-no place

    @tar said:

    Forth

    Forgot. 😊

    @tar said:

    possibly Scala

    I'm not sure. It looks like (from a quick examination of the documentation and examples online) it's hovering on the edge of whether it supports them or not, and it's not clear which side of the line it is sitting,

    @tar said:

    As a general rule, moving control flow syntax out of the core language into libraries is a net win for users of the language (with the proviso that the language has a sane enough base syntax that enough people will want to work with it in the first place...)

    Agreed. Things that work better like this are stuff like iterating over the results in a DB result set, and making DB transactions integrate nicely. The former case can be wedged into many languages (result sets can conceivably match the model of an iterable) but the latter is trickier as you're typically doing it so that you can trigger a rollback by throwing an exception through the syntactic boundary, while a normal block termination results in a commit. (That's a wonderful way to work BTW; incredibly easy to use right. It'd scare the horses in C++ though, given its shaky exception model.)



  • @xaade said:

    The only thing a new language can give you, is baked in syntax.

    @dkf said:

    A good counterexample is Ruby, where it's lightweight lambda syntax [snip, blah blah]

    @dkf said:

    The fact that you think you don't need this sort of thing is just the good old Blub Effect once again.

    Never said you don't need it. Just saying that you need to justify it.

    @dkf said:

    It doesn't solve my problems.



  • @dkf said:

    Things that work better like this are stuff like iterating over the results in a DB result set, and making DB transactions integrate nicely.

    In Go, you can either use the pattern that bufio.Scanner uses or the pattern that bolt.DB uses.



  • @PleegWat said:

    Bash allows multiple statements between if and then as well, with the return value of the last being the one used for the if. I don't think I've ever seen it used.

    Same rule applies between while and do, where it's a fair bit more useful. The traditional way to achieve the same effect in something like C that doesn't allow this involves a forever loop with a break in the middle, or an extra boolean, or a duplicated test - all of which have always struck me as less than helpful to clarity.



  • @xaade said:

    you can mimic other languages with macros in C++ if you so deem fit.

    #DEFINE IF if(
    #DEFINE THEN ) {
    #DEFINE ENDIF }

    C++? What kind of johnny-come-lately japery is that?


  • Discourse touched me in a no-no place

    @ben_lubar said:

    In Go, you can either use the pattern that bufio.Scanner uses or the pattern that bolt.DB uses.

    The scanner pattern works (except for the ugly error handling bolted on the end, but that's one of these things that I suspect we could argue about for ages) but the DB one relies on an embedded function, which changes the semantics of return.



  • @ben_lubar said:

    bufio

    Bufio sounds like the villian from an exceptionally terrible Shakespeare play.


  • BINNED

    Or Rufio's brother:

    *shudders* I hope not, one's enough frankly...



  • I guess I'm alone when I actually enjoyed that character.

    Was it cheesy and childish? Yes.

    Wasn't that the point. To show what children would do/respect/look-up-to without adults around? Yes.



  • @xaade said:

    Was it cheesy and childish? Yes.

    It was also extremely toyetic, to borrow the Freakazoid term, and I think that's what most people objected to.

    @xaade said:

    Wasn't that the point. To show what children would do/respect/look-up-to without adults around? Yes.

    Yeah I got that; it was like Lord of the Flies but more fluffy and less blood.

    But they weren't playing like kids, they were playing in the full-size version of Hook Jungle Playset by Hasbro, $39.95! Using the new Super Squirter Hook edition, $59.99!



  • @blakeyrat said:

    full-size version of Hook Jungle Playset

    I must have missed the "buy me now" camera wink.

    not bad

    oh god, no......


  • @xaade said:

    I must have missed the "buy me now" camera wink.

    Watch the movie; I dare you to tell me that segment wasn't a giant 20-minute toy commercial right in the middle of it.



  • The food fight?

    Because, that means the sidewalk chalk segment of Mary Poppins missed an opportunity.

    http://ecx.images-amazon.com/images/I/415HyPrAuHL.SL500_AA500.jpg

    OMG, say it isn't so.


Log in to reply