[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]

Why is Go so elegant?

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: 53
Thread images: 10

File: Golang mashup.sh.png (39KB, 650x650px) Image search: [Google]
Golang mashup.sh.png
39KB, 650x650px
Why is Go the most elegant programming language?
>>
>>60845519
It's not
>>
>>60845519
>elegant
>curly brace cancer
>>
>>60845519
(define most-elegant 'scheme)
>>
File: Rob-pike-oscon.jpg (52KB, 1200x800px) Image search: [Google]
Rob-pike-oscon.jpg
52KB, 1200x800px
>>60845519
Because C was already near perfect, and then Go took it and made it even better.

It's elegance comes from its simplicity.

Speaking of simplicity, I like this talk by Rob Pike: https://www.youtube.com/watch?v=rFejpH_tAHM
>>
>>60845531
/thread
>>
>>60845553
But it added a garbage collector. How is that elegant?
>>
>>60845519
>>
>>60845589
"Setting GOGC=off disables the garbage collector entirely. The runtime/debug package's SetGCPercent function allows changing this percentage at run time." https://golang.org/pkg/runtime/

for when you have a legitimate reason to disable it :)
>>
>>60845641
But does it allow you to free memory manually?
>>
>>60845635
You are one of those fellas who needs to do stuff the hard way pointlessly to feel better about yourself?
>>
>>60845635
>"everyone is a moron but me"
>>
>>60845519
>elegant
if err != nil {
}
>>
>>60845685
vs

try {
} catch (SomeException e) {
} catch (SomeOtherException e) {
}

?

if err != nil yes please.
>>
>>60845641
Doesn't that break packages you use that don't manage the memory themselves?
>>
What's with hipster language shilling on /g/?
>>
does go support GOTOs?
>>
>>60846071
yes it does, with Ken Thompson being the ultimate systems programmer you would kind of expect Go to have it
>>
Here's the opinion of a guy who actually created his own programming language:

http://journal.stuffwithstuff.com/2010/10/21/the-language-i-wish-go-was/

He's right
>>
what
>>
>>60848870
>huur its not like muh sepples
every single Go thread, someone chimes in about no generics, no exceptions
If you want a language that integrates generics and exceptions in its core than use C++, stop complaining that Go is not like C++, Go will never be like C++, if the designers wanted a language like C++ they would have made it like C++, so just fucking use C++ and stop shitting up Go threads with your ignorance
>>
>>60845685
if pointer == NULL {
}

Oh wow C does it too
>>
>>60849348
>go designers fucked up
>stop pointing it out waaahhh

>there are three separate vector types, one for ints, one for strings, and one for interface{}.
>You’ll notice the code for all three is identical except for the types. Indeed:
>// CAUTION: If this file is not vector.go, it was generated
>// automatically from vector.go - DO NOT EDIT in that case!
>I can’t think of a clearer indicator that a feature is missing.
>Actually, I can: map.
>Go has a hashtable collection type which is generic, precisely because it’s built into the language.
>It’s special.
>The rationale I’ve read (“one map is all you need”) feels out of place in Go.
>It’s only in low-level languages like C and C++ that I’ve had strange requirements that prevented me from using standard components.
>I can understand that reasoning in Java or C#, but in a systems language I’d be honestly surprised if one map was all I needed.

defend this go cuck
>>
>>60848870
>I wish Go had tuples, unions, constructors, no Nil, exceptions, generics, some syntax sugar
>I wish Go was Seeples, something it was never designed to take after
>>
>>60849434
>go was designed to be shit

I see...
>>
>>60849389
youre throwing out a lot of bullshit with no explanation, vectors?? Go has slices, I dont get your thing with vectors unless of course youre a sepples shill who somehow thinks Go needs vectors like C++. Your whole post is incoherent autistic screeching that says nothing but:
>go designers fucked up by not copying sepples
>stop trying to stop me frompointing it out waaahhh
>>
>>60849449
>>go was designed to be shit
>I see...
Go is shit cuz its not sepples
waaaah waaaah, its shit, make it like sepples waaaah waaaah
>>
>>60849461
>programmer who actually understands programming language design
>autistic screeching

>>60849501
>literally every modern statically typed language has generics
>this kid keeps screaming about C++

gofags are fucking retarded
>>
>>60849449
Okay, let's take a look then
>tuples
Go is designed around multiple return values in functions, the use case for tuples just dropped to basically nothing.
>unions
GC'd, why would this be a priority in its development?
>constructors
It's not OOP and never will be. Why would it have these?
>No Nil
The author is retarded on this point because his argument is literally "Make it have objects, then we don't have to check for nil stuff all the time!"
>exceptions
if err != nil is no different from big try/catch blocks.
>generics
Not a requirement just because "B-B-BUT ALL THESE LANGUAGES USE IT". Go is designed around C's design philosophy, not the cancerous shitpile that is seeples, C#, and so forth.

The author literally just wants it to be seeples. That's what every one of his arguments boils down to. "C++ does it this way, why doesnt go????"
>>
>>60849531
>>literally every modern statically typed language has generics
>>this kid keeps screaming about C++
waaaah waaaah, Im going to cry like a baby because every compiled language doesnt have generics waaaah, I wont stop my autistic screeching in every Go thread till Go copies C++ waaaaah
>>
>>60845519
You know that you have to show that something actually is true before asking why it is true, right?
>>
>>60849549
>the use case for tuples just dropped to basically nothing.
>multiple returns
>not a tuple

>GC'd

god you're stupid

>Why would it have these?
>didn't bother to read the perfectly good reasons the author wrote

>The author is retarded on this point
>"Make it have objects, then we don't have to check for nil stuff all the time!"
>so out of touch he doesn't know about the single biggest advance in static typing theory

I thought there was an upper bound on your stupidity but you're proving me wrong

>if err != nil is no different from big try/catch blocks.
>conditional that dispatches on value
>no different than conditional that dispatches on type and has additional semantics

>not a requirement

being a good language isn't a requirement either but I guess it's something to strive for

>cancerous shitpile that is seeples, C#, and so forth.

the only cancerous shitpile here is the go community that is made up of idiots who lack understanding and insist on defending this junk
>>
File: 1496866099142.jpg (12KB, 261x223px) Image search: [Google]
1496866099142.jpg
12KB, 261x223px
>>60849634
>YOU'RE DUMB
>I THINK YOU'RE DUMB
>SEE HOW DUMB YOU ARE BY ME SAYING IT
Wanna actually discuss something or are you just gunna shitfling?
>>
>>60849549
Agree with almost everything else, but
>unions
>GC'd, why would this be a priority in its development?
If the person was talking about algebraic data types, then this has nothing to do with GC. "enums" or "sum types" are really for when you want to preserve type safety and describe types that can take multiple forms

>Go is designed around C's design philosophy, not the cancerous shitpile that is seeples, C#, and so forth
This is not an argument for lack of generics. It's designed as a successor to C and it is unquestionably higher-level than C and why it chose to be garbage-collected. Manual copying and pasting code to satisfy the type system is fucking stupid, and it's been factored out for the most part in most modern languages. Code generation is the way C gets around it (with the preprocessor) but Go has several decades of CS research advantage over C, and should've made a smarter choice
>>
>>60849641
m8 you saw the word "union" and thought it meant union in the C memory layout sense

you're beyond retarded
>>
>>60849634
waaaah waaaah, he doesnt like my C++ shill article, Im going to call him a big dummy waaaah waaaah waaaaah waaaaaah
>>
>>60849652
Fair.

>>60849658
>You saw this word and assumed it to mean this context, not MY context!
>>
>>60849681
>look everyone he's wrong!
>that sure convinced them!
>>
File: 1479232378905.jpg (150KB, 600x450px) Image search: [Google]
1479232378905.jpg
150KB, 600x450px
>>60849697
>didn't even understand the article
>>
File: 1496447921734.png (181KB, 625x626px) Image search: [Google]
1496447921734.png
181KB, 625x626px
>>60849729
Still waiting for you to actually dispute anything I've said instead of just say "you're dumb"
>>
File: resf.png (128KB, 419x300px) Image search: [Google]
resf.png
128KB, 419x300px
THIS IS A RUST THREAD NOW
>>
>>60849744
ok since you're so dumb I'll spell it out for you in very simple and easy to understand terms so that your brainlet can understand it

multiple returns are just tuples you can't assign to variables
unions have nothing to do with GC but with static typing; think Object | Null
constructors force people to go through them in order to create objects, functions don't
with modern static typing you can guarantee that if you have an Object it can't be null
exceptions are essentially a big switch that matches on the type of the error rather than it's value, letting you customize the value; they don't leave useless error variables in scope; they usually have "finally" semantics
generics are absolutely required if you want to not be shit language; even Java and C11 have some support for that shit, get real

stay mad
>>
>>60849817
>constructors force people to go through them in order to create objects, functions don't
Why would you want your language to force you to do something?
>>
I dare you to implement this in Go:
use std::ops::Add;

fn add<T: Add + Copy>(a: T, b: T) -> T::Output {
a + b
}

fn main() {
let x = add(1, 2);
let y = add(1.3, 2.5);
println!("integers: {}", x);
println!("floats: {}", y);
}

/*
Output:

integers: 3
floats: 3.8
*/
>>
File: 1492599981663.png (54KB, 250x347px) Image search: [Google]
1492599981663.png
54KB, 250x347px
>>60849842
>allowing users of your type to construct invalid objects
>>
>>60849817
>multiple returns are just tuples you can't assign to variables
So, what is it? Go does or doesnt have tuples?
>constructors force people to go through them in order to create objects, functions don't
Yes and because Go doesn't have objects, it doesn't have constructors.
>with modern static typing you can guarantee that if you have an Object it can't be null
And since Go doesn't have objects...
>exceptions are essentially a big switch that matches on the type of the error rather than it's value, letting you customize the value; they don't leave useless error variables in scope; they usually have "finally" semantics
That doesn't explain why if err != nil is any worse.
>generics are absolutely required if you want to not be shit language
Because why?

>stay mad
I'm not mad, I use Golang for its simple concurrency and am very happy with it, despite the hilariously large binaries. You're the one who took 3 requests of "Provide reasoning instead of shitposting" to try and justify your hatred.
>>
>>60849842
Sane defaults are a huge plus. Also fighting with the compiler so that your types work out can save a shit ton of headaches in the future
>>
>>60849817
[not him, but...]
>multiple returns are just tuples you can't assign to variables
you can in Go, you obviously dont know Go

>unions have nothing to do with GC but with static typing; think Object | Null
>constructors force people to go through them in order to create objects, functions don't
>with modern static typing you can guarantee that if you have an Object it can't be null
Go is not OO dumbass

>exceptions are essentially a big switch that matches on the type of the error rather than it's value, letting you customize the value blah blah
a lot of people who use C++ dont use exception ever, quite a lot of people in fact

youre only reason for liking Go is that its not like C++ and doesnt implement C++ OO and exceptions
>>
>>60845635
>we have to use a language because it's easier to learn
>implying you cant learn any programming language just as easily after learning C, C++ and C#
Let me guess, he doesnt like paying people for the first 5 years, either.
>>
>>60849863
>So, what is it? Go does or doesnt have tuples?

the go implementation does
you as a go programmer will never see them or be able to pass them around
just like functions back in the day

>Yes and because Go doesn't have objects, it doesn't have constructors.
>And since Go doesn't have objects...

i talk about static typing and you think i'm talking about oop
yeah

>That doesn't explain why if err != nil is any worse.

it does if you have IQ > 60

>Because why?

because read the article and the multiple perfectly good posts in this thread you fucking blub programmer

>You're the one who

you didn't even understand 10% of the criticism the author wrote and you still came here to defend your crappy favorite language
you expect me to take you people seriously? you can like a language and at the same time understand it's flaws, and you clearly don't understand shit

>>60849877

>you can in Go, you obviously dont know Go

value, error := MultipleReturnFunc() // ok
tuple := MultipleReturnFunc() // not supported
x, y, z := 1, 2, 3 // ok
tuple := 1, 2, 3 // not supported


self-explanatory

>Go is not OO dumbass

it doesn't fucking matter dumb shit that's not even what I'm talking about
you can literally declare an instance of some type and it will auto-initialize to some "sane" defaults (0 and null)
surely you can see the problem there

>a lot of people who use C++ dont use exception ever, quite a lot of people in fact

that's because C++ exceptions are pure, unadulterated garbage. they're so bad it's not even funny

does that mean exceptions as a concept is irredeemably bad? nope
does that mean I can't understand the essence of exceptions and how they impact language semantics? nope

modern languages have something even better: pattern matching

>youre only reason for liking Go

i don't like go because it willingly ignored advances in programming language theory and then just pretended it didn't need them despite the code being retarded
>>
>>60845684
He's one of the founders of Unix, worked on plan9, developed a bunch of really good software with them, then moved on to working with Google.

I think if anyone could legitimately unironically say that in the software world Rob Pike would be among them.
>>
File: _20170525_103421.jpg (159KB, 1080x1351px) Image search: [Google]
_20170525_103421.jpg
159KB, 1080x1351px
>>60849375
> not if(!pointer)
Novice
>>
>>60845519

Not even elegant at all.

That said, it is a very practical and productive language despite it's repetitive patterns, because the the 'best practice' of how to do just about anything has already emerged and thus you and your coworkers don't spend time trying to be smart with the language, you just churn out working code at a high rate.

Some of it's features, like channels, excellent compilation speed and a pretty good standard library does help, but really it's language simplicity is a great fit for team coding and productivity.
Thread posts: 53
Thread images: 10


[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.