Live data from Hacker News

Why Go Is Not Good

yager.io

11–20 of 367 posts

Re: Why Go Is Not Good

#11
post #2

>I like Go. I use it for a number of things (including this blog) and yet it goes down once it is posted on HN. I have had some articles of mine end up on HN and I never went down, even when my blog was still WordPress hosted on a machine of mine. This is probably more of a shortcoming of the various cloud providers than of the language/environment itself I guess.

Not a great metric. My blog once got unexpectedly slash dotted (ended up on Reddit and HN front pages for a day; silly enough the post was the one I put the least work into by far and the idea was not even mine). I was at the time running WordPress with WP Supercache using only right PHP workers. The site never had a hiccup. Ergo PHP is the best language out there? :)

In reality, do use something like WP Supercache. It will save your hide.

Re: Why Go Is Not Good

#12
post #2

>I like Go. I use it for a number of things (including this blog) and yet it goes down once it is posted on HN. I have had some articles of mine end up on HN and I never went down, even when my blog was still WordPress hosted on a machine of mine. This is probably more of a shortcoming of the various cloud providers than of the language/environment itself I guess.

[deleted]

Re: Why Go Is Not Good

#13
post #2

>I like Go. I use it for a number of things (including this blog) and yet it goes down once it is posted on HN. I have had some articles of mine end up on HN and I never went down, even when my blog was still WordPress hosted on a machine of mine. This is probably more of a shortcoming of the various cloud providers than of the language/environment itself I guess.

Dang it! I wasn't intending this to hit HN so soon. I was planning beefing up my VPS before I shared this one on HN. Sorry. I'll try to keep it up.

If you just let it hang, the Cloudflare cached page should kick in.

Re: Why Go Is Not Good

#14
Haskell (with third party library)

http://snapframework.com/docs/tutorials/snap-api

main :: IO () main = quickHttpServe site

site :: Snap () site = ifTop (writeBS "hello world") route [ ("foo", writeBS "bar") , ("echo/:echoparam", echoHandler) ] dir "static" (serveDirectory ".")

echoHandler :: Snap () echoHandler = do param -----

Rust (with third party library)

https://github.com/chris-morgan/rust-http/blob/master/src/ex...

//! A very simple HTTP server which responds with the plain text "Hello, World!" to every request.

#![crate_id = "hello_world"]

extern crate time; extern crate http;

use std::io::net::ip::{SocketAddr, Ipv4Addr}; use std::io::Writer;

use http::server::{Config, Server, Request, ResponseWriter}; use http::headers::content_type::MediaType;

#[deriving(Clone)] struct HelloWorldServer;

impl Server for HelloWorldServer { fn get_config(&self) -> Config { Config { bind_address: SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 8001 } } }

    fn handle_request(&self, _r: Request, w: &mut ResponseWriter) {
        w.headers.date = Some(time::now_utc());
        w.headers.content_length = Some(14);
        w.headers.content_type = Some(MediaType {
            type_: String::from_str("text"),
            subtype: String::from_str("plain"),
            parameters: vec!((String::from_str("charset"), String::from_str("UTF-8")))
        });
        w.headers.server = Some(String::from_str("Example"));

        w.write(b"Hello, World!\n").unwrap();
    }
}

fn main() { HelloWorldServer.serve_forever(); }

-----

Go (native)

package main

import ( "fmt" "net/http" )

func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:]) }

func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }

-----

Yeah, ok.

Re: Why Go Is Not Good

#15
I am completely in support of Haskell and functional languages in general. There are some gaps in Go and definitely some glaring problems. But this comparison also only lists the bad. Go is good for what it was intended for which is concurrent programming and server/web application.

Just a note: I don't think it is fair to say Go has absolutely no immutability as it was defined, it does have "const". See http://golang.org/ref/spec#Constant_expressions

Re: Why Go Is Not Good

#16
post #7

Every single thing listed in the article can be added to Go at any point, since it currently has a very minimal feature set. Once something like generics are added, they have to support it until the end of time or risk having an unstable API like Rust did for a while there.

> or risk having an unstable API like Rust did for a while there. Every language, including all the languages described in this article, goes through a period of instability while it figures out what works and what doesn't.

Sure, I'd just say that Go has been extremely stable since before 1.0 (~2 years).

Author's point was that we should not use "not good" languages for the fear that we might be stuck with them for next 20 years. I'd rather be stuck with a language whose designers are very resistant to change vs one that gets features haphazardly bolted on every few years (PHP comes to mind).

Re: Why Go Is Not Good

#17
post #14

Haskell (with third party library) http://snapframework.com/docs/tutorials/snap-api main :: IO () main = quickHttpServe site site :: Snap () site = ifTop (writeBS "hello world") route [ ("foo", writeBS "bar") , ("echo/:echoparam", echoHandler) ] dir "static" (serveDirectory ".") echoHandler :: Snap () echoHandler = do param ----- Rust (with third party library) https://github.com/chris-morgan/rust-http/blob/master/sr…

Your primary criticism of Rust is that one (community-maintained, and not "official") Web package requires setting headers explicitly. OK.

Re: Why Go Is Not Good

#18
post #14

Haskell (with third party library) http://snapframework.com/docs/tutorials/snap-api main :: IO () main = quickHttpServe site site :: Snap () site = ifTop (writeBS "hello world") route [ ("foo", writeBS "bar") , ("echo/:echoparam", echoHandler) ] dir "static" (serveDirectory ".") echoHandler :: Snap () echoHandler = do param ----- Rust (with third party library) https://github.com/chris-morgan/rust-http/blob/master/sr…

prefix code lines with two spaces to get a pre tag.

  like
  this

Re: Why Go Is Not Good

#19
post #7

Every single thing listed in the article can be added to Go at any point, since it currently has a very minimal feature set. Once something like generics are added, they have to support it until the end of time or risk having an unstable API like Rust did for a while there.

>Every single thing listed in the article can be added to Go at any point

Every single thing listed in this article could be added to TI BASIC at any point. It would just require a complete re-formulation of the language into something completely unrecognizable.

Re: Why Go Is Not Good

#20
post #14

Haskell (with third party library) http://snapframework.com/docs/tutorials/snap-api main :: IO () main = quickHttpServe site site :: Snap () site = ifTop (writeBS "hello world") route [ ("foo", writeBS "bar") , ("echo/:echoparam", echoHandler) ] dir "static" (serveDirectory ".") echoHandler :: Snap () echoHandler = do param ----- Rust (with third party library) https://github.com/chris-morgan/rust-http/blob/master/sr…

Since none of your examples are actually doing the same thing, I'm not sure what you're trying to say here. That being said, I've reformatted the code from the original post below (presented without comment):

-----

Haskell (with third party library)

http://snapframework.com/docs/tutorials/snap-api

    main :: IO ()
    main = quickHttpServe site
    
    site :: Snap ()
    site =
        ifTop (writeBS "hello world") 
        route [ ("foo", writeBS "bar")
              , ("echo/:echoparam", echoHandler)
              ] 
        dir "static" (serveDirectory ".")
    
    echoHandler :: Snap ()
    echoHandler = do
        param 
Rust (with third party library)

https://github.com/chris-morgan/rust-http/blob/master/src/ex...

    //! A very simple HTTP server which responds with the plain text "Hello, World!" to every request.
    
    #![crate_id = "hello_world"]
    
    extern crate time;
    extern crate http;
    
    use std::io::net::ip::{SocketAddr, Ipv4Addr};
    use std::io::Writer;
    use http::server::{Config, Server, Request, ResponseWriter};
    use http::headers::content_type::MediaType;
    
    #[deriving(Clone)]
    struct HelloWorldServer;
    
    impl Server for HelloWorldServer { 
        fn get_config(&self) -> Config { 
            Config { 
                bind_address: SocketAddr {
                    ip: Ipv4Addr(127, 0, 0, 1),
                    port: 8001
                }
            }
        }
    
        fn handle_request(&self, _r: Request, w: &mut ResponseWriter) {
            w.headers.date = Some(time::now_utc());
            w.headers.content_length = Some(14);
            w.headers.content_type = Some(MediaType {
                type_: String::from_str("text"),
                subtype: String::from_str("plain"),
                parameters: vec!((String::from_str("charset"), String::from_str("UTF-8")))
            });
            w.headers.server = Some(String::from_str("Example"));
    
            w.write(b"Hello, World!\n").unwrap();
        }
    
    }
    
    fn main() {
        HelloWorldServer.serve_forever();
    }

Go (native)

    package main
    
    import (
        "fmt"
        "net/http"
    )
    
    func handler(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
    }
    
    func main() {
        http.HandleFunc("/", handler)
        http.ListenAndServe(":8080", nil)
    }
    
Yeah, ok.
Post reply on HN