top | item 31407197

(no title)

musabg | 3 years ago

Second one in Go:

    func IsPrime(n int64) bool {
        return big.NewInt(n).ProbablyPrime(0)
    }
Each language has its own pros and cons. Go wants to be explicit and simple to be understood. Java is fully-featured.

This is just anectodal evidence anyways. And these are tools in the and, and no point for a "tool fight".

discuss

order

vips7L|3 years ago

The point of that example wasn't to show if there was a standard library function for it. It was to show the verbosity of writing code that contains if conditions, loops, and generic programming. I obviously could have written:

    new BigInteger(n).isProbablyPrime(0);

bin_bash|3 years ago

My general point is that if you put Ruby up against a nonspecific compiled language it's hard to argue Ruby is better. When you analyze something like Go vs Ruby or Go vs Java then the warts of particular languages come out.