Thoughts?

Thoughts?

Other urls found in this thread:

golang.org/doc/code.html#Organization
youtube.com/watch?v=ak97oH0D6fI)
github.com/fatih/vim-go-tutorial
raw.githubusercontent.com/oniichaNj/go-dwmstatus/master/dwmstatus.go
arxiv.org/pdf/1302.6946.pdf
stackoverflow.com/questions/44965/what-is-a-monad
twitter.com/NSFWRedditImage

when will the google meme die
fuck man, need to have some more restrictions on ad content so fucking google and kikebook can die

Probably a pretty good language but Java works for me m8

...

Easy to use, fast, makes concurrency a breeze, hard to write illegible code.
Main problems are
1) People who are trying to use it OOP, when it's literally not an OOP language (WAAAH GENERICS WAAAAAH)
2) The development environment is all kinds of fucking retarded

I love the development environment.
It's one of the best things for me about the language..

I'm just learning go now. Is it normal to have a structure like
/gopath
/bin
/src
/project1
/project2

and then the binaries from compiled projects go into the bin folder? or is this something goclipse (ya using ecilpse ide lul) is forcing on me?

/gopath
/gopath/bin
/gopath/src
/gopath/src/project1
/gopath/src/project2

fucking whitespace

Why not just google this shit?
Also stop using eclipse like some retarded faggot, and start using acme, the editor the creators of the language use.

I like the logo.

only tinkered... made a couple apps in it.

> programming languages are tools... why use a buzzsaw when you need a knife (via some cool teacher in my CS class one day)

first and foremost... what are you working on?

if you're making a blog, Go is probably way overkill these days. Go projects should never be treated like a Ruby/JS project... but that's my opinion. the reason Ruby/JS exist is to make blogs and bloated phone apps.

> JS is the best language for your browser to use (joke my other CS teacher said... since its the only one)

if you're making a little integration for your monolith app that literally GETs, parses and returns some JSON... sure.

readable. folks from higher level languages have been using it to get more into static typed languages (that's a different debate).

reminded me of Kotlin when I first started using it

no "downside" really, to me. but i haven't had to delve into concurrency at all... which is supposed to be a neat thing. Packages are fun.

> google: go at dropbox gopherfest

You can do generic programming without objects though

I like the way you interface with C (that's the first thing I look in a new language). I have yet to learn more about it though.

Go back.

Peace of shit without any tasks.
No Generics.

>generics are an OOP-exclusive concept
wew

I usually advocate for Go, will try to switch a standpoint for this post.

Go is slow and employs a lot of costly abstractions for the sake of simplistic interface. E.g. hashing packages in std lib have native versions next to hand-optimized assembly (not sure if decides on runtime or compile time which will be used). The natives run pretty slowly (1/4 of the assembly version). There isn't much you can do to actually speed it up (except allocations and GC, that's pretty tunable). Interfaces are dynamically dispatched. Go will never be as fast as C++ and will be patching the critical parts with assembly forever. On the other hard it beats Python's speed hacks nearly every time.
No compiler warnings is plain stupid. I can get the unused imports because they actually run init procedures of the package (thus have side effect) and can be easily handled with goimport plugin. But unused variables? Come on.
CSP doesn't fit the problems with bazillion small tasks with spawning goroutine per each. You still have to make workers or merge the tasks to bulks. This is usually handled by some divide and conquer approach but that's pain in Go because goroutines only return through channels and it brings tons of boilerplate.
No tail call optimization.

...it's usually longer when I list the parts I like.

Mainly using c++, is actually only needed for some very specific functions/hot paths. Lots of code just doesn't need the speed and trading for a less error-prone, more readable and maintainable code seems like a good idea.

Super practical. I have used it during my day job to write small daemons and pull requests from less experienced developers are kind of idiot proofed and easy to review.

As a software dev turned sysadmin (doing meme devops work, basically) it is a pretty nice tool that I use occasionally.

convince me to switch to go from C

golang.org/doc/code.html#Organization

That font is comfy, which is it?

Having hash tables, bignums, utf-8, serialization, templating, hashing and crypto in standard library is comfy. It's better implementation that I could write by myself (e.g. hash tables with string keys use AES hardware acceleration) and you don't have to hunt through dozens of 3rd party implementations.
Namespaces, robust type aliasing, methods, interfaces over passing void ptr and size, and slices clean the code a little.
GC and dynamically sized data structures. But also not everything is on heap (search "escape analysis").
Code is portable across OSs and architectures (unless using C bindings and raw syscalls). The toolchain is also ported to everything.
Excelent editor support. You can check vim-go tutorial and keep in mind that all of it is handled by tools Go provide and only binded to an editor, thus every main editor can provide you the same. Notable tool is Guru (youtube.com/watch?v=ak97oH0D6fI)
github.com/fatih/vim-go-tutorial
But different name-type order, no semicolons and no parenthesis around conditionals will destroy your muscle memory for C.

this is helpful, thank you

garbage

i disagree

...

...

or you could just use c++

why would I ever do this to myself?

I gave it a shot and I hated it. Every part of it. From the horrible type system to the retarded community.

best language ever created so far.

t.
>first and main language C
>also knows x86 assembly, Python, Go

i still recommend learning C as the first language. but i think Go is the best language so far.

>2) The development environment is all kinds of fucking retarded
>i am not used to it, therefore it must be retarted
it's one of the best part of Go.

the only thing i hate about it is the fucking mascot. it's too retarded. even G*U have a fucking bull.

The statement on his paper is reasonable.
BUT WHY DID HE DRESS UP?
Fucking creeps

The C integration seems pretty neat

raw.githubusercontent.com/oniichaNj/go-dwmstatus/master/dwmstatus.go

It was made by a professional artist, who happens to be Pike's wife.

what a fucking coincidence

illegible code.
having the error handling inside the code makes it illegible and full of stupid ifs statements

>Her work is characterized by her "obsessive-looking and highly unsettling visual style."
checks

>muh exceptions
exceptions are exceptionally bad idea. literal bullshit.

>what is a monad
Keep writing if err != nil { return nil, err }, dumb gopher.

>null
wow so much context about what happened, even exceptions are more handful than that

>professional
That just means she takes money for her work.

>1) People who are trying to use it OOP, when it's literally not an OOP language (WAAAH GENERICS WAAAAAH)

Generics are a patch on OOP languages, real OOP will use interfaces or dynamic type instead of generics.

Not much to gain over Java.

So you only know brainlet languages?

>real OOP will use means that render the type system useless for no good reason

>java
>not utter brainlet language

Like the creators of sitcoms or junk food or package tours, Java’s designers were consciously designing a product for people not as smart as them. – Paul Graham

It feels wrong to use. I'm not able to pin point exactly what feels wrong but i hate making stuff in it.

Exactly. The same applies to golang.
Apart from a minimally easier deployment there is no advantage over Java.

Name a language that supports generics without also supporting other OOP paradigms (that isnt pattern based shit like Haskell)

I find it a fucking nightmare to work with because I can't just open a temp folder somewhere as a scratch project, no no, I HAVE to put it under the /src/ folder in GOHOME, and I HAVE to include it under some git handle, and GOD FORBID I don't want to actually upload it anywhere and still want to split it into multiple library files.

It's easier to read error checking after each function return than it is to wrap a big blob of shit inside of a try/catch and spend an hour debugging which part is causing it to error out

>what is a monad
Something that doesn't exist in imperative-only languages, brainlet.

Go was not created for other people to use. The creators created it for themselves out of the frustration of C++.

The greatest living computer scientist Ken Thompson is one of the creators and it follows the unix philosophy.

It's a pragmatic language and you can see "worse is better" approach everywhere.

It solves every problem i have with C, namely lack of strings, memory safety, resource management etc.

You can hate it, but for the fucks sake don't compare it with fucking java.

>dwm patch rewritten in Go
>Taking something that should only compile to a few KB and running it through a language notorious for fuckhuge binary blobs
Disgusting

>patch
It just a status updater, got that link straight from dwm's homepage.
>my huge binaries
suckless loves static linking

>I find it a fucking nightmare to work with because I can't just open a temp folder somewhere as a scratch project, no no, I HAVE to put it under the /src/ folder in GOHOME,

you can use a makefile or compile/link manually but i don't know why would you want that.

go tool compile foo.go
go tool link -o foo.exe foo.o

also you can use any folder for binary projects, i use a folder in my desktop.

>I can't just open a temp folder somewhere as a scratch project, no no, I HAVE to put it under the /src/ folder in GOHOME
you can change GOPATH, it's just environment variable
>I HAVE to include it under some git handle
no you don't have to
>split it into multiple library files
library needs to have it's own directory, but it can be nested in other project

It's good and it MUST replace nodejs on backend before it's too late.

No generics, no good versioning system, some dumb design choices. Used best if you have a group of people and want to shit out a complete project fast

>you can change GOPATH, it's just environment variable
I know but my point is that I don't want to have to go under that specific path for every single little thing I might write, regardless of where it is.

>Go was not created for other people to use.
He shouldn't have published it then.
>The creators created it for themselves out of the frustration of C++.
It's a noble goal but it's like he didn't know the point of C++.
>The greatest living computer scientist Ken Thompson
he sure can kode
> is one of the creators and it follows the unix philosophy.
That's why it's trash.
>It's a pragmatic language
By your ill-definition of "pragmatic".
>and you can see "worse is better" approach everywhere.
And it continues ruining computing. And I'm not even a lispfag.
>It solves every problem i have with C, namely lack of strings, memory safety, resource management etc.
That's a low bar. Also, "solving".
>You can hate it, but for the fucks sake don't compare it with fucking java.
It's basically Java 1.0 all over again.

Monad is just abstraction action
Monad = something happen

Monad could be computation,error,concurrency,IO.

Monads will build easy way hander exceptions,memory,concurrency,null values on programming language.

But asshole haskell need make you believe monads are PhD magic and need thousand tutorial about endomorphics burrito monadics.

>point of C++
implement everything programming can offer?

>It's bad because I say it's bad

No, have zero cost abtractions.

>It's good because I say it's good.
>t. butthurt K&R fuccboi

>Give multiple reasons why its good
>NO DURR ITS BAD CAUSE DURR

that's indeed not a goal Go settled to

>endless compile times
>muh zero cost abstractions

C++ is the goto language for cpu/gpu programming/profiling/debugging during conception, same for anything 3D-related.
These peope are highly qualified and know what they're doing.
Whenever something is complex, you will most likely find C/C++/asm.

Rust supports OOP on about the same level as Go and it has generics.
Go is actually a bit more flexible because of how embedding works.

Go is imperative-only because the lack of generics prevents other styles. Plain generics and a simple macro are enough to emulate proper error handling but Go has neither.

>proper error handling
Go has perfectly fine error handling, it's no more obtuse than C's null checking.

You didn't give reasons why it is good in .

>those two are linked

ML was the first language to implement generic programming in the 70s and it's a functional language.
Haskell generics count as generic programming whether they fit your limited idea of generics or not.

>it's not bad because there's this other thing that's just as bad

>mixing code and error handling is bad

but that pic proves it's bad... you can't tell if it read full file to database or not

it's an argument of exception lovers that error handling with if is bad because it mixes code and error handling.

whenever i have to write some shit in Java the code becomes pic related, at least i don't have to type that shit, eclipse does it for you.

C's and Go's error handling is superior to exceptions. /discussion.

>someone wrote a bad code in language X, therefor language X is bad
that's a terrible argument

what's the good code of pic related. you either handle it in the function or you define method as "throws fuckingException".

Nobody was arguing in favor of exceptions here.

there is nothing bad about throwing the exception to caller
firstly I wouldn't open the file there but accept it as argument nor opening the database inside (wtf? is that supposed to be connection to database, transaction or what?). Body would just be the loop without any try-catch block
2nd function could wrap the openings and specific file path, openings and calling ^ in try, catching blocks, and closing in finally
there you have it, split error handling and logic

No generics.
The rest is OK. Some good ideas, like interfaces.

Exceptions are shit because they make code unpredictable.
void foo()
{
bar();
baz();
}
Will baz ever get executed? Is this code correct?
Who knows! If your language doesn't do exception checking you can't even look at the signature of bar to find out whether or not it will do what you expect. Then you're at the mercy of the docs.
int foo()
{
int err;
err = bar();
if (err)
return err;
err = baz();
if (err)
return err;

return 0;
}

It's very explicit what the control flow is in this code. Unfortunately it's very boilerplatey. Which is why I like the Rust way.
fn foo() -> Result
{
foo()?;
bar()?;
Ok(())
}
This is concise while also being expressive.

the 2 no-exception examples did not solve the issue you proposed

>Something that doesn't exist in imperative-only languages, brainlet.
C++ and Java both have that monad in their standard libraries.

That's not what a monad is. IO can be represented with monads, but monads don't have anything to do with IO in particular.

My only complaint is that it uses a string to initialize a record object. It should call a static function to parse the line and return a record object.

What if the computer melts itself while executing bar()? baz() would never run but it's not clear while reading the code.
What monad would one use to express that concisely in code?

>Will baz ever get executed?
You can never know this.

Sure, maybe bar gets stuck in an infinite loop or the thread panics or something else. But those are abnormal behaviors and not to be expected as part of the function interface.

Monad is just abstraction of action.
Page 69

Most easy explain monads from PhD math.

These 2 pages are better any monad tutorial.

arxiv.org/pdf/1302.6946.pdf

>A common way to interpret phenomena we see around us is to say that agents are acting on objects. For example, in a computer drawing program, the user acts on the canvas in certain prescribed ways. Choices of actions from an available list can be performed in sequence to transform one image into another. As another example, one might investigate the notion that time acts on the position of hands on a clock in a prescribed way. A first rule for actions is this: the performance of a sequence of several actions is itself the performance of an action—a more complex action, but an action nonetheless.

>Mathematical objects called monoids and groups are tasked with encoding the agent’s perspective in all this, i.e. what the agent can do, and what happens when different actions are done in succession. A monoid can be construed as a set of actions, together with a formula that encodes how a sequence of actions is itself considered an action. A group is the same as a monoid, except that every action is required to be reversible. In this section we concentrate on monoids;

The only reasons why exceptions aren't written as part of the function signature and catch blocks aren't statically required is because of the "worse is better" philosophy.

I still remember my algebraic structures and know what monoids, groups, fields, etc. are but this is a just a confusing awful explanation.

Oh nevermind then, I'm retarded.

...

... average explain on monads ...

stackoverflow.com/questions/44965/what-is-a-monad

Monads are not from category theory, not abstract algebra.
You don't need to know category theory to understand how they are used in programming languages, though. Wadler's early papers on monads explain them very well.

You might be confusing me with the other guy.
I never said anything about Monads.

And I'm guessing a monoid is still a monoid, since they're very abstract already in algebra. Just a set, an operation on that set, and a netural element from the set. (and it has to satisfy some simple rules that I can't remember)