[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Go is fucking retarded. Let's look at the code to check

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 183
Thread images: 6

File: golang.sh-600x600.png (69KB, 600x600px) Image search: [Google]
golang.sh-600x600.png
69KB, 600x600px
Go is fucking retarded.

Let's look at the code to check if a list contains an item.

Java:
myList.contains("My string");


Python:
'My string' in my_list


Go:
func contains(s []int, e int) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}

and repeated for every type you want to use it for

>b-but performance!!
Since the convenience battle is already lost we might as well compete on speed, eh?

reverse-complement
Go 0.48
C gcc 0.42
pidigits
Go 2.04
C gcc 1.73
regex-dna
Go 3.28
C gcc 2.43
fasta
Go 1.98
C gcc 1.36
fannkuch-redux
Go 15.84
C gcc 9.07
spectral-norm
Go 3.95
C gcc 1.98
n-body
Go 21.52
C gcc 9.56
k-nucleotide
Go 17.36
C gcc 6.46
mandelbrot
Go 5.64
C gcc 1.64
binary-trees
Go 39.68
C gcc 3.28


>O-oh, but what about C++?

reverse-complement
Go 0.48
C++ g++ 0.59
regex-dna
Go 3.28
C++ g++ 3.89
mandelbrot
Go 5.64
C++ g++ 5.82
pidigits
Go 2.04
C++ g++ 1.89
fannkuch-redux
Go 15.84
C++ g++ 13.17
fasta
Go 1.98
C++ g++ 1.47
spectral-norm
Go 3.95
C++ g++ 2.01
n-body
Go 21.52
C++ g++9.30
k-nucleotide
Go 17.36
C++ g++ 7.15
binary-trees
Go 39.68
C++ g++ 7.23


Wow, it actually won! on 3/10 tests and by microseconds each time.
Also, the binaries are fuck huge (2MB for fucking hello world, C version is 10KB).

There is literally NO reason to use this pile of garbage. Do yourself a favor and use something that can actually compete, like Rust.
>>
>>59205255
Is the C and C++ compiled with optimizations on?
>>
does go use retarded curlybraces and semicolons too?
>>
>Go is fucking retarded.

Thanks for pointing that out, Captain Obvious.
>>
>>59205255
>example code from Java, Python
>performance compared with C, C++
the fuck man?
>>
>>59205255
Ruby:
for_you = Array.new
for_you << 'Big Guy'

>filesize: 4.47MB
>>
>>59205255

Go bashing thread?
Go bashing thread!


Let's look at Quicksort.

First in Ruby:
def quicksort(*ary)
return [] if ary.empty?
pivot = ary.delete_at(rand(ary.size))
left, right = ary.partition(&pivot.method(:>))
return *quicksort(*left), pivot, *quicksort(*right)
end



Whoa, that was short, but hey, performance is EVERYTHING, right?

So let's look at C:

void swap(int *a, int *b) {
int tmp = *a;
*a = *b;
*b = tmp;
}

void quicksort(int *begin, int *end) {
int *ptr, *split;
if (end - begin <= 1)
return;
ptr = begin;
split = begin + 1;
while (++ptr <= end) {
if (*ptr < *begin) {
swap(ptr, split);
++split;
}
}
swap(begin, split - 1);
quicksort(begin, split - 1);
quicksort(split, end);
}



Not super funky, but pretty much to the point.


Now *ba-dumm* it's time for Golang:

import "math/rand"

func QuickSort(slice []int) []int {
length := len(slice)
if length <= 1 {
sliceCopy := make([]int, length)
copy(sliceCopy, slice)
return sliceCopy
}

m := slice[rand.Intn(length)]
less := make([]int, 0, length)
middle := make([]int, 0, length)
more := make([]int, 0, length)

for _, item := range slice {
switch {
case item < m:
less = append(less, item)
case item == m:
middle = append(middle, item)
case item > m:
more = append(more, item)
}
}

less, more = QuickSort(less), QuickSort(more)
less = append(less, middle...)
less = append(less, more...)
return less
}



It's not really longer than the C version, but does it look simpler or clearer? Not really.
>>
>>59205443
C++:
std::find(vec.begin(), vec.end(), "My string") != vec.end()

Maybe not the clearest but still one line.

Rust:
vec.contains("My string")
>>
import "strings"

string := "string"

strings.Contains(string, "t")
>>
No major systems language has emerged in over a decade, but over that time the computing landscape has changed tremendously. There are several trends:

Computers are enormously quicker but software development is not faster.
Dependency management is a big part of software development today but the “header files” of languages in the C tradition are antithetical to clean dependency analysis—and fast compilation.
There is a growing rebellion against cumbersome type systems like those of Java and C++, pushing people towards dynamically typed languages such as Python and JavaScript.
Some fundamental concepts such as garbage collection and parallel computation are not well supported by popular systems languages.
The emergence of multicore computers has generated worry and confusion.

We believe it's worth trying again with a new language, a concurrent, garbage-collected language with fast compilation. Regarding the points above:

It is possible to compile a large Go program in a few seconds on a single computer.
Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
Go's type system has no hierarchy, so no time is spent defining the relationships between types. Also, although Go has static types the language attempts to make types feel lighter weight than in typical OO languages.
Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
By its design, Go proposes an approach for the construction of system software on multicore machines.

A much more expansive answer to this question is available in the article, Go at Google: Language Design in the Service of Software Engineering.
>>
Go was born out of frustration with existing languages and environments for systems programming. Programming had become too difficult and the choice of languages was partly to blame. One had to choose either efficient compilation, efficient execution, or ease of programming; all three were not available in the same mainstream language. Programmers who could were choosing ease over safety and efficiency by moving to dynamically typed languages such as Python and JavaScript rather than C++ or, to a lesser extent, Java.

Go is an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language. It also aims to be modern, with support for networked and multicore computing. Finally, working with Go is intended to be fast: it should take at most a few seconds to build a large executable on a single computer. To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools; a new language was called for.
>>
Programming today involves too much bookkeeping, repetition, and clerical work. As Dick Gabriel says, “Old programs read like quiet conversations between a well-spoken research worker and a well-studied mechanical colleague, not as a debate with a compiler. Who'd have guessed sophistication bought such noise?” The sophistication is worthwhile—no one wants to go back to the old languages—but can it be more quietly achieved?

Go attempts to reduce the amount of typing in both senses of the word. Throughout its design, we have tried to reduce clutter and complexity. There are no forward declarations and no header files; everything is declared exactly once. Initialization is expressive, automatic, and easy to use. Syntax is clean and light on keywords. Stuttering (foo.Foo* myFoo = new(foo.Foo)) is reduced by simple type derivation using the := declare-and-initialize construct. And perhaps most radically, there is no type hierarchy: types just are, they don't have to announce their relationships. These simplifications allow Go to be expressive yet comprehensible without sacrificing, well, sophistication.

Another important principle is to keep the concepts orthogonal. Methods can be implemented for any type; structures represent data while interfaces represent abstraction; and so on. Orthogonality makes it easier to understand what happens when things combine.
>>
>>59205905
These are lists not strings
>>
>>59205932
>>59205966
>>59205987
If this doesn't make your dick hard you aren't a profesional programmer, and if you are, you're probably a pajeet who learned Java or C++ at a bootcamp and are strongly afraid of change because it means you might lose your job (And you're too stupid to learn another language).
>>
ITT brainlets
>>
>>59205354
>python fag
>>
>>59205596
Multiple function returns are comfy. Glad Rust has it
>>
>>59206041
Kill yourself, shit for brains.
>>
>>59206028
It's literally useless. If you can tolerate a GC, then there's already C#, Java, Haskell, Scala, and Ocaml. Maybe even Python, Ruby, or Bash depending on what you're doing and your performance requirements. And for things that actually need to be as fast as possible, Go is already out of the running.
>>
>>59206028
>tl;dr: I love you Google please hire me!!
>>
>>59206198
>>59206211
>I've never been employed

Go beats Java and C++ in most benchmarks

https://benchmarksgame.alioth.debian.org/u64q/go.html

https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=go&lang2=gpp

>scala

It has all the over head of Java

>Haskell

Literal hobbyist language

>Ocaml

Not worth the effort when compared to Go

>python, ruby, bash

Are you retarded? Go out performs all of them and has a more simple and safer syntax, there is absolutely no reason to choose an interpreted language over Go.
>>
>>59206293
>Go beats ... C++ in most benchmarks
Are you blind?
>>
>>59205255
>contains
So just write a fucking library for it and make a pull request jesus ffs
>>
>>59206293
Why not use pure asm then?
>>
>>59205255
maybe you should compare the performance of some real applications, not 5 lines of code.
>>
>>59206293
Also, Go has only been around for less than a decade and it's already about to surpass the performance of Java/C++ in most categories, which says a lot about those languages.

C++ has had 17 versions and over two decades to get things right, yet everyone still hates using it.


Choosing to use C++ or Java over Golang is masochism. The few areas where C++ and Java excel are single threaded operations that can't be paralleled.

The only reason to use C is if you have to have the performance, and in many cases safety is more important than performance.
>>
>>59206352
See:

>>59205932
>>59205966
>>59205987
>>
>>59206378
So deluded.
>>
I like Go, just wish it had generics so retarded faggots like OP couldn't make these threads that cherry pick examples.

Go excels in developing projects of large size with multiple developers. If you're a professional fizzbuzzer I recommend an interpreted language instead.
>>
>>59206293

What the hell are you smoking?

Go doesn't beat C++ and it beat Java only in tiny tasks where Java has the disadvantage of JVM startup time.


Go is slightly faster than Python, Ruby or Bash (or at least until we see the next version of them) but is nowhere close when it comes to frameworks or functionality. And theres no way you can think this..

import "fmt"

func fib() func() int {
a, b := 0, 1
return func() int {
a, b = b, a+b
return a
}
}

func main() {
f := fib()
fmt.Println(f(), f(), f(), f(), f())
}



..is more readable that Python..

def fib(n):
if n < 2:
return n
return fib(n-2) + fib(n-1)


..or Ruby:

f = ->(x) { x < 2 ? x : f[x-1] + f[x-2] }

puts f[10]



As the other anon said, Go is a weird middle ground. It's to verbose to give you the productivity of Python or Ruby and too powerless to compete with Java or C#.
>>
>>59205255

Turning expensive O(n) operations into one-liners make the code harder to reason about.

Go was designed by people involved in multi-million lines C/C++ and Java projects.
>>
>>59205932
>>59205966
>>59205987


>No major systems language has emerged in over a decade..

..and with "systems language" we mean "programming language", not really "systems language"..
:^)

>..but the “header files” of languages in the C tradition..

Because all languages use header files? WTF?

>There is a growing rebellion against cumbersome type systems like those of Java and C++, pushing people towards dynamically typed languages such as Python and JavaScript.

There's a growing rebellion against cars, pushing people to use bicycles and planes.

>We believe it's worth trying again with a new language, a concurrent, garbage-collected language with fast compilation.

You mean Erlang?

Ah no, I see. Go is so concurrent, especially the """great idea""" of concurrency with a shared state. :^)

>Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.

That's cool - if Go really was a systems language and as fast as C.
(Protip: it's not.)

>Go was born out of frustration with existing languages and environments for systems programming.

"Programming is too hard."
- t. Pajeet

>Programmers who could were choosing ease over safety and efficiency by moving to dynamically typed languages such as Python and JavaScript rather than C++ or, to a lesser extent, Java.

Yes!
I hate it when I have to chose between knife, spoon and fork. Let's all use the spork!!! :DDD

>Programming today involves too much bookkeeping, repetition, and clerical work.

LMFAO.
Go is all about writing boilerplate code, because a simple map/reduce is "too complicated". Is this bait?

>Another important principle is to keep the concepts orthogonal.

What is he even trying to say here? That "+" and "*" is the same in other languages?
>>
>>59206378
>C++ has had 17 versions
My sides are in orbit

>Choosing to use C++ or Java over Golang is masochism
Choosing to use Go is masochism. It's on par with Java in terms of boilerplate. if err { ... } if err { ... } if err { ... } etc. Oh sorry I forgot, you can't say "if err", it's "if err != nil".
>>
>>59205255
but then in Go, you just use your contains function that you defined, in a single line.
In Java, it was just included for you.
>>
>>59206378
>C++ has had 17 versions

...
>>
>>59206591
>Go was designed by people involved in multi-million lines C/C++ and Java
go was designed because google couldn't find enough pajeets and they need a lang retarded enough so it could be used by a monkey
>>
>>59207101
>in Go, you just use your contains function that you defined, in a single line

No, stop drinking the DRY kool-aid.

The designers of Go knew very well that putting expensive O(n) operations into one-liners is an anti-pattern in long-lived multi-million line software projects.
>>
>>59207160

This is funny because it is true:

>http://nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/
>>
>>59207207

>multi-million line software projects

..and with Go you are quickly at this size, huehuehue..
>>
>>59207207
>The designers of Go knew very well that putting expensive O(n) operations into one-liners is an anti-pattern
Once you've written that O(n) `contains` function, calling it is a one-liner. Even in Go.
>>
>>59207207
>No, stop drinking the DRY kool-aid.

The most stupid thing I have heard today.
>>
>>59207249
"I'm to intelligent for go!!11"

The blog post
>>
>>59207374
>i'm a low self-esteem down-to-earth yeat another snowflake and everyone should be the same
The /g/ post
>>
>>59207346
>Once you've written that separate O(n) `contains` function for every type you're using
FTFY
>>
>>59205255
If go is so shit, why does /g/ recommend programs written with it?
>>
>>59207444
Sure, but that's a totally separate issue.

>>59207459
>it's impossible to write good software in a bad language
>>
>>59206551

Go is not "slightly faster" than ruby and python, it is orders of magnitudes faster and often beats out Java and C# in terms of performance despite being a much younger and immature language.

Also that ruby example is fucking hard to understand. I prefer the python one.
>>
>>59207478
>good software
How do you know that it's good? Just because you find if useful doesn't make it good.
>>
I like Go because I picked it up quickly and it lets me deploy statically linked binary blobs. Decent performance is a nice bonus.
>>
>>59207481
If you care about speed that much, use c/cpp
python is used because its comfy to write, fast enough, general purpose and ecosystem is large and mature
Go is a dick meme google is forcing on its hamsters and you fall on it
>>
>>59207564
And just because it's written in Go doesn't make it shit. Don't be retarded.
>>
>>59207593
If it's written in Go, it has the crippling weakness of not being written in C.
>>
It's just C but protected from google's army of pajeets.
>>
>>59205932
>garbage-collected language
>systems languages
Dropped.

Also why do they say systems languages like it's plural? C is the only systems language.
>>
>>59207593
>doesn't make it shit
It does, because it sets the precedent for what kind of developer(s) are behind it.
>>
>>59207593
Go is a google meme that they will get bored of and stop supporting. It's stupid to use it
>>
>>59207634
C is harmful and unfortunately java is super widespread as a systems language so there are more of them.

Rust will show them all. Even google engineers like it.
>>
>>59206293
>Go beats Java and C++ in most benchmarks
Who the fuck cares? If it's supposed to be a systems language it's competing against C.
>>
>>59207668
>Rust
Please, anon. The adults are discussing systems programming.
>>
>>59207668
>Rust will show them all
>Rust

Do you mean the language made by former Ruby on Rails and Ember.js contributors?
>>
>>59207613
For the vast majority of programs, it doesn't actually matter.

>>59207636
That's a weak correlation at best. Maybe if you had literally no other information to go on, it would be helpful, but that seems like an unlikely scenario.

>>59207662
It's a meme and stupid to use, but I doubt Google will drop it. Assuming, of course, that it's actually getting significant internal usage like the Go devs claim.

>>59207683
>The adults are discussing systems programming.
No, we're discussing Go.
>>
>>59207582
>fast enough
kek
>>
>>59207707
Which of these six people are Ruby/Ember contributors?
https://www.rust-lang.org/en-US/team.html#Language-design-team
>>
>>59207746

Just a quick look shows that Steve Klabnik and (((Yehuda Katz))) make up 1/4th of the core team.

They are both web developers.
>>
>>59207746
>all those fucking numales
Holy shit
>>
>>59207813
Steve does docs and wycats does Cargo. As far as I know all the people working on the language design and the compiler are actually competent.
>>
>>59207746
>>59207857

(((REFUGEES WELCOME))) INTENSIFIES
>>
>>59207746
Most of them have stuff like Rails forks on their Github pages. Why are you pretending not to know about this?
>>
The only people who don't like Golang are brainlets.

"herp derp Go is too easy so it's for stupid people I'm going to hinder my self with C++ and fear new languages because I had a hard enough time learning C++"
>>
>>59207634
>what is object pascal
>what is oberon
>what is ada
>what is burroughs algol
>>
>>59207668
>C is harmful
programlet spotted
>>
>>59207911
Who, specifically, has major contributions to Rails or other webdev projects?

Remember I'm only talking about the language and compiler teams here. The rest can shit up the stdlib and cargo (>implying it's not already shit) all they want, those parts are easy to replace.
>>
The only languages that have an ISO are relevant.
You can shit on C or C++ whatever you want but nobody is going to change to meme languages for critical stuff because those meme languages are not mature yet.
>>
Alright Go/Rust shills. Name 1 reason automatically picking the latest releases of a package from a repo without letting users pick previous versions is a good idea.
>>
>>59207962
None of those are bare metal you fucking moron.
>>
>>59207953
>herp derp i am going to shit on Go in /g/ until i die so jedi younglings won't fall for yet another coy
also, fuck googel and recaptcha
>>
>>59207953
It's not too easy. It's too simple.
I bet you like BASIC too.
>>
>>59208016
Sorry you're stuck with UNIX, kid.
>>
>>59208011
It's not. Rust is a good language but cargo is trash (just like all other language-specific package managers/build systems). And also, cargo doesn't actually have the problem you're talking about. You can put version constraints on your dependencies and it will pick a version that satisfies those constraints.
>>
>>59208078
>Rust is a good language but cargo is trash
You need Cargo to compile Rust.
>>
>>59208078
Nothing inherently wrong with a language package manager and it's not even mandatory.
>>
>>59208104
To build rustc + libstd? Maybe. You can probably still put it together with manual `rustc` invocations on src/lib*/lib.rs in the right order, but I haven't tried.
>>
Relevant to this thread, maybe
https://github.com/Microsoft/vscode/issues/19983#issuecomment-283714789
I don't have an account so I can't chime in on this to tell them to avoid using Rust
>>
File: 1396818956352.gif (856KB, 300x169px) Image search: [Google]
1396818956352.gif
856KB, 300x169px
Judging only from the conceptual and the syntax I've seen in various examples over time I'd say Go seems like a language which does a lot of things right/better than many of it's predecessors. However, it's C-isms to me are still too apparent. I'm just not at all fond of languages that even *try* to be C. C is not that perfect of a language that one should even borrow from it. Of course you can now go ahead and say
"You don't expect language designers to throw everything overboard and design a language that is completely alien to everyone?"
Which is 100% fair, but I'd say that the main problem with this line of reasoning is that we are reaching a point where trying to be too familiar just leaves you with a language that has been done before. I consider C and everything related to it pretty much done at this point. It's time to start fresh, be ridiculous, try out crazy things. Design, to me, is a bit like nonlinear fitting: if your initial guesses are too similar, you'll forever be stuck in the same local minimum. I want to see something exotic again

As someone who found C syntax revolting from the get-go and wouldn't touch system programming with a 5 kilometer pole I don't expect to (and honestly hope not to) be taken fully seriously on the matter, since it's not my area of competence.
>>
File: 10656375.jpg (18KB, 400x400px) Image search: [Google]
10656375.jpg
18KB, 400x400px
>>59208195

Why are we programmers so ugly?
>>
>>59208239
New languages should be familiar enough for an experienced programmer to learn in a day and use in production in a week.
>>
>>59208239
What exactly are you complaining about? Are you hoping for higher-level abstractions than pointers, or do you just really hate curly braces for some reason?
>>
>>59208239
>tfw no loyal dog who playfully bites me
>>
I don't get what go even solves desu.

I'd rather use java, at least java has lambdas and proper OO and some basic generics.

it also has the same "single binary - run everywhere" meme and even more so since it actually does run everywhere, including different CPU archs and OSes
>>
>>59208240
>have big forehead
>lower your eyebrows and take picture from an angle that makes it look even bigger
>>
>>59208240
If we weren't we'd have chosen a respectable profession not bred out of a solitary youth
>>
>>59205932
>>59205966
>>59205987
delet this
>>
>>59208283
it's not the curly braces alone. It's not the tendency to entropy-encode everything into ascii special characters alone. It's certain abstract structures. But of course also elements; a void here, a * there, ;s all over the place. It's hard to put into words but when you look at the cornucopia of languages out there you just see it. You see how languages like fortran77 or algol68 are just .. in many ways different from C. Not better, but different. And then you have your Ds and Gos and heck even perls.

>>59208265
it's a fair argument. Reasonable, practical. The main issue I have is that familiar doesn't necessarily mean similar. The human brain is a wondrous thing which can find analogy in seemingly polar opposites. Being similar to another language is a crutch, an easy way out. Everything else takes much, much more work. But, ultimately, this work should be done. Or at the very least tried! Lisp is a good example of what I mean. No matter the opinion one might have of it, it is a very alien language. A person that has some good experience with, say, python for example should easily be able to program in lisp within a week. Not because the languages are similar, but because in some abstract sense the workflow of both languages has it's parallels.
>>
>>59206840
>using the smiley with a carat nose
>>
>>59205987
>>59205966
>>59205932
This is insane. Being retarded to that level should be a criminal offense.
>>
>>59207582
Python isn't "fast enough". It's literally as slow as can be. It's impossible to be slower than python without writing the interpreter in a language slower than C, basically. Anything even remotely non-retarded compiles to bytecode on-the-fly before being interpreted, which gives the opportunity to optimize, which in turn allows running orders of magnitude faster -- when including the compile time.
>>
>>59208182
Cargo does nothing special on the compiling/linking end, so yes you can.
>>
>>59209105
>Anything even remotely non-retarded compiles to bytecode on-the-fly before being interpreted
You mean like what CPython does?
>>
>>59209163
That's literally what it doesn't do.
>>
>>59209196
https://docs.python.org/3/library/dis.html
>The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode.h and used by the compiler and the interpreter.
>>
>>59205536
>filesize: 4.47MB
Are you completely fucking retarded? Ruby is stored just a text file (.rb) which contains your array. That contains only a few bytes of text so in what world does that equate to 4.47MB? Ruby doesn't compile even it's interpreted.
>>
File: portrait.jpg (19KB, 500x335px) Image search: [Google]
portrait.jpg
19KB, 500x335px
>>59205255
>tfw google turned rob pike into a faggot
>>
>>59209236
Go read Include/opcode.h and then come back.
>>
>>59205255
Lua:
string.find(my_list, "My String")
>>
>>59206551
>comparing a minimal as fuck python function with no function call to a function that returns a function/closure with a main function

package main
import "fmt"

func fib(n int) int {
if n < 2 {
return n
}
return fib(n-2) + fib(n-1)
}

func main() {
fmt.Println(fib(10))
}


def fib(n):
if n < 2:
return n
return fib(n-2) + fib(n-1)

print(fib(10))


oh wow so hard to read. literally the same function

is multiple assignment too hard for you pajeets? because python and others do this too
 
a, b = 10, 3
a, b, = b, a //swap
>>
>>59209291
How many times did you ROB rob pike's PIKE, faggot?
>>
>>59209323
not an argument
>>
>>59209353
Neither is your post.
>>
File: soon-maximum-compression.jpg (33KB, 570x339px) Image search: [Google]
soon-maximum-compression.jpg
33KB, 570x339px
>>59205255
http://crystal-lang.org/
>>
>>59209660
>http://garbage-lang.org/
What did he mean by this?
>>
>>59205672
>but still one line
lol
>>
>>59209709
Probably that it's better than Go. Not that that means much.
>>
>>59209827
We already have shitloads of languages better than Go, though. I mean every single lisp dialect's implementations count, let alone more mainstream languages, or hell, even the languages that "inspired" go.
>>
>>59206437
Generics are baby tier when you consider Go generate. People have been metaprogramming in C forever and Go is the first language I've seen (probably not he first language to do so) that has tools to support this built in to the standard distribution. To me this kind of power is much more useful, I'm sick of seeing generic functions that aren't actually generic in C++, they take a subset of types and handle them, in this regard interfaces are no different, instead of overloading operators just make an interface and methods for it for each type, exactly as you do for the ops of each type. For truly generic functions go generate solves this problem and more, you have the ability to easily make a tool that looks at any type and automatically generate methods to fit an interface which retains safety at pre-compile and compile time, which to me seems much nicer than going "lol I'll accept anything, with specific exceptions", even if you did want that you can always resort to interface{} if you're too stubborn; despite the fact the community is against many bad practices Go still gives you the ability to do things like this for cases where you need them, just like in C and C++. And generics are not the only thing you can do with go generate, you could do anything, it's the same as taking control of the pre-compilation phase in C and C++, which in those languages is typically defines, macros, special warnings, etc. which seems much better, both in terms of enforcing things on the program but also in giving developers utility.
>>
>>59208011
It forces people to create and maintain a stable API before they burden the public with their bullshit.
>>
>>59209978
not disagreeing with anything you said, but something like sbcl is less directly comparable with go than crystal is. like go, crystal is a statically typed language, builds statically linked executables and has a large standard library and "friendly" modern tooling. also like go, it appears to have a company behind it that wants to market the language.
>>
>>59210032
Are you clinically retarded? Or did you take pike's pike to the head?
>>
>>59210162
Except for the marketing aspect, every other criteria also applies to sbcl though.
>>
>>59208011
Works on Google's machines!

Seriously, it's that simple.
>>
>>59208011
Rust does not have that problem.
>>
>>59205255
Dishonest fag, you know very well it's doable in just one line.
>>
>>59210239
And what line is this pray tell?
>>
>>59210239
100 chars isn't one line, bruh
>>
>>59210184
not really. the biggest difference between sbcl and a statically typed language is that sbcl's type assertions are advisory. they are hints to the compiler, not law. violating one results in only a warning. the standard library is large, true, but is full of legacy crap and doesn't have the web-centric stuff go's does like a json parser. i also wouldn't call the tooling friendly, but i guess that's subjective.
>>
>>59210300
In sbcl, everything is statically typed and inferred. When type declarations are made, type violations invoke the debugger. Type checking is done at runtime. This can optionally be disabled but that is the default behavior.

I don't see how it's possible to design more friendly tooling than a lisp's, giving the ability of live reloading and arbitrary experimentation along with god-tier documentation. Plus, emacs is particularly suited to lisp development and probably better than any ide for any other language, for example. Plus, the debugger, which allows recursive debugging and live patching at debug time, is something not seen anywhere else.
>>
File: 1486255460355.png (880KB, 1895x1181px) Image search: [Google]
1486255460355.png
880KB, 1895x1181px
>tfw make 6 figures and use both go and rust
its not a hard concept to understand, they arent mutually exclusive languages and dont require a membership.
>>
>>59210413
>type violations invoke the debugger
that's at runtime, which by definition isn't static typing. type violations inferred at compile time generate warnings.

by "friendly" i meant beginner friendly or easy to get started with. common lisp has some of the best tooling available (though i consider smalltalk's better), but it isn't easy to get started with it. emacs alone is beyond what the average programmer is willing to learn.

all of this points to why go exists in the first place and why there is an opportunity for a new language to challenge it.
>>
>>59210607
>that's at runtime, which by definition isn't static typing.
You have no clue what static typing means then. Which was obvious since you keep confusing user-ruled type enforcement with static typing anyway.
>>
>>59210655
feel free to explain my mistake to me.
>>
>>59210674
Static typing means:
- The memory representation cannot be changed (though the compiler can do so as an optimization)
- Definitions specialize on type.
The latter point means that you can't cons a string. Compare to javascript where you can add a string and a number and get a number. Not to be confused with operator overloading.

SQL, sh and javascript are examples of non-statically typed languages.

Common lisp is an example of weakly typed, statically typed language.
>>
>>59209196
>>59209274
>what is pypy
>>
>>59210177
Not an argument.
>>
>>59206551
I can't read ruby or bash so I don't agree with you at all
>>
>>59210857
Pypy is "C with python syntax". It's not really python and it doesn't really compile python code.
>>
>>59211030
how is a drop-in replacement for python not python
>>
>>59210786
>The memory representation cannot be changed
type systems say nothing about the memory representation. static typing is simply assuring a lack of type errors based on the source code alone, without running the program. if you can't tell there will be no type errors without running the program, your language isn't statically typed.
>Compare to javascript where you can add a string and a number
that's coercion.
>Common lisp is an example of weakly typed, statically typed language.
your definition of static typing is your own and not standard. what you call "weakly typed, statically typed" is simply "dynamically typed (with limited static checks)" by the common definition. but then again, you are right per https://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages.
>>
>>59211064
Sorry, I was thinking of Cython. You are right about pypy.
>>
>>59211143
>type systems say nothing about the memory representation.
Neither did I.
>static typing is simply assuring a lack of type errors based on the source code alone
False.
>if you can't tell there will be no type errors without running the program, your language isn't statically typed.
>Compare to javascript where you can add a string and a number
Even more false.
>your definition of static typing is your own and not standard.
You could at least have the decency to google it before displaying the full breath of your ignorance in such confidence.
>>
>>59205255

I love how this thread is people writing retarded code in Go and then claiming Go is retarded based on the example they just made up.

It's not a great language, but this thread is full of idiots and I would love Go to become more common in the niche currently occupied by C++ and Java monstrosities.
>>
>>59211271
>calls C++ and Java "monstrosities"
>defends go
You're a bit special in the head ain't you?
>>
>>59205443
C:
int contains(char **arr, size_t arr_length) {
for (size_t i = 0; i < arr_length; ++i) {
if (!strcmp(arr[i], "My String"))
return 1;
}

return 0;
}
>>
>>59211181
>Neither did I.
when you said
>The memory representation cannot be changed
the only reasonable interpretation is that you meant that a type corresponds to an arbitrary, but fixed, memory representation of data. if you meant something else, say what it was.
>You could at least have the decency to google it
from the first page when you google the definition of static typing:
>http://courses.cs.washington.edu/courses/cse341/04wi/lectures/13-dynamic-vs-static-types.html
>[A static type system is a] tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute.
i.e., source code analysis.
>>
>>59211300
>>calls C++ and Java "monstrosities"

You don't understand English.
>>
>>59211356
That's not even C99, and you're making the dumbest code ever, no wonder it's slower.
If you're trying to find a string, use a hash, posix has them standard.
>>
>>59211356
>>59211517
cont.
Why not sort beforehand the string so you can do a binary search? How do I know the other languages don't do it? Were this javascript, I would know for a fact that it's Objects get optimized into classes with each property as a member with a static integer offset.
>>
>>59211517
Hash would be slower retard.
>>
>>59211769
What? Than comparing each letter in a for loop? Are you retarded?
>>
>>59211380
>have to grasp at straws this hard just to attempt to weasel out and backpedal enough to attempt to not look inbred
>still fails
was that part of your plan?
>>
>>59211788
It doesn't compare each letter imbecile. And you think a hash gets around this?
>>
>>59211922
HAHAHAHAHAHA... OH WOW!
>>
>>59211922
Sorry for my reaction, I don't usually speak with someone who knows so little of what he's so self assured about.

Anyways, search up any implementation of strcmp, you'll find each one compares each letter, there's no magic, it has to.

A hash table is a method of storing data by first converting strings into a representative and unique integer, so the lookup can be done in linear time, instead of depending on how many characters the key has. With an integer key, you just use addition, whilst with strings, you have to either compare each letter with each entry, you could optimize this by doing a binary search, though you would still need to loop through all of the key's letters every time.
>>
>>59212034
Alright buddy. Here is the implementation of strcmp in glibc: https://github.com/zerovm/glibc/blob/master/string/strcmp.c

You'll notice if says
while (c1 == c2);


As for the hash table. You do realize its not magically conjured up before the function is called right?
>>
>>59212133
You do know what a while is, right? I's a loop, and if I have the entries "111111111112", "111111111113", "111111111114" and "111111111115", and I'm trying to find "111111111114", I'll have to make 37 comparisons, while in a hash, I'd make one.

>As for the hash table. You do realize its not magically conjured up before the function is called right?
Indeed, but in most cases where you have to search strings, you'll do it. I have all reason to believe it would be faster in this particular case.
>>
>>59212209
that's an implementation detail not relevant to this thread
>>
>>59212293
Well, not really, if the other languages implemented hash tables for optimization, than it would be unfair for you to compare it to C using a 0 optimization algorithm.
I would never say after a benchmark that a certain language is faster than C when it is just running smarter code, though I understand what you're saying.
>>
>>59206084
I prefer IF/ENDIF desu

curly braces are not a complete disaster, but semicolons are fucking retarded as a default.

continuing lines explicitly is much cleaner
>>
>>59212452
i've seen python code artisans do the #fi and #end thing
>>
>>59212481
yeah it can get a bit cluttered with whitespace dedenting 3-4 levels when you have that.

But so is 4 random curlybraces you have to mentally match to the opening clause.

with endfunction, endif, enddo(for) you sortof know what is closed
>>
>>59210591
so you get paid in pesos, so what
>>
>>59205255
Okay so all you FAGGOTS don't know HoTT, CIC, or ANYTHING that will be relevant in the next 50 years and yet you can't even push a thread up about your stupid fuckery up on this board more than you can push your dick up in your nonexistent partner.
>>
>>59212518
>But so is 4 random curlybraces you have to mentally match to the opening clause.
But if you're not retarded and writing good C code those ending curlies will be directly beneath the opening clause, which makes for very clean and easy to read code.

https://github.com/torvalds/linux/blob/master/Documentation/process/coding-style.rst
>>
>>59212841
it is cleaner than whatever the javapeople think they are doing, but it is still more cognitive, especially for load for longer functions
>>
>>59212870
>especially for load for longer functions
See
https://github.com/torvalds/linux/blob/master/Documentation/process/coding-style.rst#6-functions
>>
>>59212961
what if your functions one thing requires a bit more than just one screenfull?

Should you make your code ravioli and split it up into parts even though the parts are never used separately?
>>
>>59213051
Any decent editor would allow you to jump straight to the declaration of a function no matter where it is. Considering the huge readability improvement that comes from isolating different functions into actual functions instead of reading through 20 lines of code just to realize it performs some operation used later in the function, yes.
>>
>>59213196
But what if the functions are not different and any isolation would just be spreading logic that should be together all over?
>>
>>59205255
Are you really this stupid?

Python just provides an abstraction as a part of the language.

There certainly is a library for rust so that you can just say:
Contains(list, "string")

Python providing more abstractions is a retarded point, because it is obviously true, but it is really completely meaningless.
Python will probably more or less do the same to check if a list contains the string.

The comparison is completely meaningless.
>>
Go is Java 4
>>
>>59213249
It is together, but the point of functions is to encapsulate logical functions into pieces to make larger logical functions more understandable. Linus's rule is well thought out; if you're doing several complicated operations that require several levels of indentation, you should consider rolling them into functions to improve the readability of the longer, main function. If it's not complex it's generally okay to be longer.

If you have function x that does y and z on data w, and y ia large piece of logic, it's probably best to encapsulate it in a function, because you don't really need to know how it works, just that it takes w and does y on it. If you need to understand y then fucking go read y.
>>
>>59209070
pretty funny they'd cite support for parallel computing when OP's example is regarding fucking search.
HEY ASSHOLES YOU KNOW WHAT COUNTS AS CLERICAL WORK
REWRITING FUCKING SEARCH
>>
JavaScript > go
>>
>>59205255
So you are basically bitching about the lack of a library function, right? Learn your libraries, ask in the forum and if the function is not available, make one. Why are you moaning?
canFind(my_array, "or")
>>
>>59207481

>Go is not "slightly faster" than ruby and python, it is orders of magnitudes faster

Depends entirely on the task.
The areas where Ruby ond Python shine, the "raw processing power" is rarely the bottleneck.

If you write a script for pentesting (Ruby: Metasploit, Python: countless software) you won't bother about "muh performance", you will bother about getting shit done fast.

Also when deploying something (Ruby: Chef/ Puppet, Python: Ansible/SaltStack), the actual deployment will take it's time so the few lines of code where you control the processes are not worth writing tons of boilerplate code.

If we talk about scientific coding, using C libraries in Ruby or Python is super easy. Python is huge in the academic field, but for Ruby you also need ONE SINGLE library and you can write native C code. And one more library and you can even include existing C classes. The performance is pretty close to normal C code, but of course you need to know C (or at least get the specific C library).

>https://www.amberbit.com/blog/2014/6/12/calling-c-cpp-from-ruby/


So we've already ruled out a lot of fields where Go just doesn't make any sense. What's left? Right, web development.

And yes, if you want to write a small and fast server Go really has an edge here, I'll give you that. But again we musn't compare apples and oranges:
Rails has an unmatched developing speed, the framwork is super simple, very relible and you can put together a simple CRUD API in no time. And for most "typical" uses it's reasonably fast (read: Ruby won't be the bottleneck), since Ruby/Python only provides the "glue" of various components that are writting in differnt langauges..
Another example: often people use Ruby for rapid prototyping and proofs of concept: hack together a working solution and then rebuild it in something highly performant, i.e. Java Spring.

So while Go has it's uses and really is fast, it is not a replacement for classical scripting langauges like Python or Ruby.
>>
>>59207481

>Also that ruby example is fucking hard to understand.

What part exactly?

f = ->(x) { x < 2 ? x : f[x-1] + f[x-2] }

We define a lambda function f with the argument x. if x < 2 then use x, else use f[x-1] + f[x-2].


OK, you don't like the tenary if-operator? Lambdas are rocket science?
Then write it like this:

def f(x)
if x < 2
return x
else
return f[x-1] + f[x-2]
end
end


Python and Ruby are much better readable than Go and denying that will only make you come off as Go fanboy..
>>
>>59209249
nah he's just canadian
>>
>>59205255
Expressiveness has little to with what makes a programming language good, nor does performance for that matter.
>>
>>59215853
No but if it has neither of those things then there is a good chance it's fucking useless.
>>
>>59215008
>scientific coding
(also >coding)
>using C libraries
Fortran my man
>>
>>59215853
WRONG
>>
>>59216410
It's obviously doing great hence those are non-issues. If you have so much trouble with basic logic no wonder you can't into programming.
>>
>>59215008
>Golang isnt faster than these languages because I decided they're faster to write in
>>
>>59205596
That's not quicksort in go, this is
func quickSort(data Interface, a, b, maxDepth int) {
for b-a > 12 { // Use ShellSort for slices <= 12 elements
if maxDepth == 0 {
heapSort(data, a, b)
return
}
maxDepth--
mlo, mhi := doPivot(data, a, b)
// Avoiding recursion on the larger subproblem guarantees
// a stack depth of at most lg(b-a).
if mlo-a < b-mhi {
quickSort(data, a, mlo, maxDepth)
a = mhi // i.e., quickSort(data, mhi, b)
} else {
quickSort(data, mhi, b, maxDepth)
b = mlo // i.e., quickSort(data, a, mlo)
}
}
if b-a > 1 {
// Do ShellSort pass with gap 6
// It could be written in this simplified form cause b-a <= 12
for i := a + 6; i < b; i++ {
if data.Less(i, i-6) {
data.Swap(i, i-6)
}
}
insertionSort(data, a, b)
}
}
>>
>>59205255
in C:

#include <stdbool.h>

bool isvalueinarray(int val, int *arr, int size){
int i;
for (i=0; i < size; i++) {
if (arr[i] == val)
return true;
}
return false;
}


wow, C must be shit!!!!
Thread posts: 183
Thread images: 6


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.