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

MuhCamelCaseSlice = append(MuhCamelCaseSlice, MuhCamelCaseItem)

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: 20
Thread images: 1

File: e55.png (155KB, 800x800px) Image search: [Google]
e55.png
155KB, 800x800px
MuhCamelCaseSlice = append(MuhCamelCaseSlice, MuhCamelCaseItem)


is there any more retarded language than Golang?
>>
>>61440782
no.
I'd rather write Perl than Go
>>
C, where half a century after its creation, elder god tier developers like Linus Torvalds still have arguments about how to copy a simple fucking string without introducing security vulnerabilities.
>>
I've never really had an issue with the if err != nil thing

Go has a lot of problems, but that's not really one of them.
>>
>>61440851
In C (designed in 1969), you can append an item to a list of data structure without returning anything

list = append(list, item) is simply retarded
>>
>>61440782
>is there any more retarded language than Golang?

No. Unfortunately, it's going to be incredibly popular because it has a very good and comprehensive standard library, a very good implementation, compiles to static binaries and is backed by Google.

Hopefully Facebook can make something of ReasonML or Reflex (not public yet) or we're going to be stuck with this shit.
>>
>>61440885
I am talking here about the retarded append function
>>
>>61440782
no
>>
>>61440923
If you understood what a slice value is, you would understand why append is the way it is.
>>
>>61440923
I don't see what's wrong with append either. What's your problem with it?
>>
>>61441004

why does it return anything?
why can't I just do slice.append(item) like in any other language?
>>
>>61440885
>>61441004
>no need for generics goy
>why do you need sensible error handling?
>syntax highlighting? we are not kids anymore
>>
>>61441044
Because you are creating a new slice when you append something, not modifying the slice. IIRC you can't change the length of a slice.
>>
>>61441134
So that's why GO is so fucking slow, it's all immutable shit.
>>
>>61441134
slice itself is a data structure, it golang wants to assign a new address for the slice after appending an item, it can just simply change the start address without returning anything
>>
>>61441044
>why can't I just do slice.append(item) like in any other language?
It works exactly the same. Is your complaint just that go isn't a literal clone of other languages you're used to?

>>61441073
Generics is an actual problem with Go. The error handling is fine.

>>61441134
Go internally handles slice operations and hides what happens. It allocates some extra space with the slice and appends don't actually create new slices unless it uses up all the extra slots. Once it runs out of space in the slice, it allocates a new one. This is how lists work internally in basically every language.

>>61441166
You have no idea what you're talking about
>>
>>61440905
what if you have to reallocate?
>>
At least it has unified error handling pattern. One just have to adore C error handling in comparison.
>>
>>61442296
that's what I am talking about, even if you want to relocate the address of the array you can do it without returning anything, the slice is a data structure the contains the start address of its array
>>
That's literally what you would write in a paper algorithm pseudolanguage, OP.
Thread posts: 20
Thread images: 1


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