[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 111 KB, 1634x2224, gopher.png [View same] [iqdb] [saucenao] [google] [report]
71537542 No.71537542 [Reply] [Original] [archived.moe] [rbt]

The complexity of C++ (even more complexity has been added in the new C++), and the resulting impact on productivity, is no longer justified. All the hoops that the C++ programmer had to jump through in order to use a C-compatible language make no sense anymore — they're just a waste of time and effort. Now, Go makes much more sense for the class of problems that C++ was originally intended to solve.

>> No.71537560

stfu retard faggot, nobody gives a fuck about your fag language for dumb fags like yourself

>> No.71537563

lol no generics

>> No.71537569

lol no enums

>> No.71537580

lol no sum types

>> No.71537588

lol no immutables

>> No.71537590

Keep crying and screaming, you can't stop it anymore c++ bootlickers

>> No.71537602

lol real memory or type safety

>> No.71537612

lol no error handling

>> No.71537664
File: 62 KB, 645x773, 1524538602457.jpg [View same] [iqdb] [saucenao] [google] [report]

lol samefag

>> No.71537679

Brainlet opinion from a brainlet language user.

>> No.71537688

lol empty interfaces

>> No.71537697


>> No.71537703
File: 208 KB, 720x1520, Screenshot_2019-06-22-16-14-28-473_acr.browser.lightning.jpg [View same] [iqdb] [saucenao] [google] [report]

Good job, retard.

>> No.71537709

Go is C for retards

>> No.71537733

Go is incapable of doing what C is used for. Its role is closer to Python and other one-step-above-scripting languages.

>> No.71537743

lol no namespaces

>> No.71537759

Well, pedo trannies do kill themselves in quite high proportions to other mentally diseased pedos, so I guess its a sit and wait.

>> No.71537804

lol no file scope

>> No.71537816

lol no iterators

>> No.71537825

lol regex is slower than in Python

>> No.71537857
File: 87 KB, 645x773, 1512819759856.png [View same] [iqdb] [saucenao] [google] [report]


>> No.71538723

>all the hoops
extern "C" {
//c code


>> No.71539943

>The complexity of C++ (even more complexity has been added in the new C++), and the resulting impact on productivity, is no longer justified
[Citation Needed]

There is plenty of C++ development happening right now, and they aren't complaining

>> No.71540781

Go is corrupted by google Wirth's Oberon.

>> No.71541020

Shill harder google kyke. Fuck both languages. Python master race.

>> No.71541266


Go is pretty much made by a bunch of old guys who are stuck in their ways but finally got tired of having to fuck around with memory.

Not the worst but can't replace C cuz GC.

Rust is a better C++ replacement. It still has complexity but you get a bit more value for that complexity.

Rust is still too hard tho. Still waiting for someone to make low level shit easier without performance hits or C++ tier complexity.

>> No.71541426

Also python lol. Its one of the worst languages by far. Only straight retards write it because uni forces them to learn it.

Every python program I interact with feels janky.

>> No.71541599

No generics.

>> No.71541751

For those who like Go but miss generics and better error handling, V will see its first release later today:


Similar to Go, but with a couple of important extra features and no GC which means it can be used for high performance tasks.

Has a native compiler but also compiles to C, which allows it to make full use of the advanced optimizations in toolchains like GCC and Clang/LLVM.

>> No.71542261

ziglang does error handling better than V

>> No.71543072

> Impact on productivity
Brainlet detected, if you had any brain in there you'd know golang performes worse than c++
You literally can't use golang for performant tasks, it's twice as slow
C++ is literally the most shittalked language because brainlets can't use their brains to fucking use it

>> No.71543304

Nice shitposting.

>> No.71544215

interface Iterable {
[Symbol.iterator]: () => any

function iterate(iterable: Iterable) {
for (let i of iterable) console.log(i)

const arr = ['a', 'b', 'c']

How come TypeScript can guarantee the received parameter is an array without resorting to generics, but Go can't do the check during compile time?

>> No.71544241

gradual typing
you could have an iterable interface in go but what would it iterate over?

>> No.71544302

shove your garbage collector up your ass

>> No.71544454

A slice you need to sort.

>> No.71545932

One of the goals of Go's development was to keep compile times down, hence the lack of compile time generics. (I think)
Concerning performance Go was meant to replace C/C++ for webservers, where the prime limiting factor is I/O and thread locking, not raw real time performance.

>> No.71547655

compile time generics can be implemented with minimal effect on compilation time. Faster than compiling multiple functions that take different types but do the same task.

>> No.71549018

Finally cracked open Donovan & Kernighan today. Feels comfy man

>> No.71549082
File: 4 KB, 180x146, unknown-11.png [View same] [iqdb] [saucenao] [google] [report]


>> No.71549466


No. C++ has been originally designed by a demagogue and idiot, without studying anything about programming.

This is why the type system is such an unsound abomination.

Now they are claiming that backward compatibility with C was the main concern but in reality he was just an incompetent bullshitter and narcissistic snowflake.

No amount of changes could fix what is deeply flawed in principle.

Go broke the compatibility and fixed all the major flaws. Go is decent, well-researched, small set of complimentary features. It just works and smart people just got their shit done.

C++ is the constant struggle with inherited idiocy of the past.


>> No.71549480

You can still write simple Rust and do wonders with it.

>> No.71549725

>when i'm alone, i cry at night because c++ and rust (languages i consider trannylangs) have generics and golang does not...
the hard life of a go programmer

>> No.71549760

just don't use the latest standard lmao

>> No.71549771

Unsound? Can you elaborate?

>> No.71549779

Golang is dead.

t. Sundar Pichai

>> No.71550116

>The complexity of C++ (even more complexity has been added in the new C++)
t. literal retard

C++11 and onward is actually simpler than before.

>> No.71550125

>implying you need them
just design your interfaces properly poojeet

>> No.71550233


implicit coersions

also ints are not objects, etc.

>> No.71550235

wtf i love golang now
thank you, anon

>> No.71550881

>compile time generics can be implemented with minimal effect on compilation time. Faster than compiling multiple functions that take different types but do the same task.

>> No.71550914

Java had interfaces but it still needed generics dumbfuck

>> No.71550931

Neither of those have anything to do with soundness retard.

>> No.71550940

What part of this do you not understand?

>> No.71550941

Good when C not necessary.
Rob Pike - plan9.

imagine needing generics lul.

>> No.71550974

>can't even tell parallelism from concurrency

the absolute state of Go devs

>> No.71551969

Google shill

>> No.71552657


just fuck off

implicit coersions have everything to do with unsoundness. it does not even amount to strong typing, leave alone soundness, which means proof-like guarantees.

fuck you Ivan. don't try to look smart, fucking nigger

>> No.71552683

no u

>> No.71553285

The way generics are implemented at compile time is literally by compiling multiple functions for each type. It's impossible to be faster than compiling multiple functions by definition.

>> No.71553476

The solution to this kind of problem is not yet another programming language than misses most of the commonly used libraries.
The solution most likely lies between OS and userspace.

>> No.71553899

Simpler would mean having less features, which C++11 does not. I mean, C++ grammar is so convoluted it's undecidable. Yet it still has no idiomatic interface definition, thus making OOP more of a shore than anything.

>> No.71554933

Too many butthurt faggots in this thread. Go just works.

> muh generics

Stop relying on then or write your own. Plenty of libraries are available.

> muh immutable

const doesn't allow for variable change

> garbage collection

It's nice not needing to worry about memory when on deadline. Faggots and NEETs won't understand.

> error handling

Literally three lines are needed to write an error handling function and can be automated with snippets if you actually know how to use your text editor.

Go is the future.

>> No.71555069
File: 15 KB, 200x226, DIqsaH1V4AASXcV.jpg [View same] [iqdb] [saucenao] [google] [report]

found a guy without a job :)

>> No.71555758


I can and I do. C++ is an abomination so no real choices but C or Rust.

That said, if I sit down and try to write stuff in the most performant way possible or am dealing with an inherently complex problem domain. I'm going to end up with 4 lifetimes and 6 trait bounds on a function. Throw some concurrency, weird memory allocation, or macros into the mix and the level of complexity is getting up there. I can put it all behind a type alias but that is really just hiding the problem.

Also tokio is one of the worst async frameworks by far and unfortunately a lot of the rust ecosystem is reliant on it. Guy who made it came over from java and pretty much grabbed some of the worst ideas from java frp frameworks and threw lifetimes on top of it. I'll write out a future in the most compact way possible and the shit still looks nuts. That said if you are using higher level frameworks built on top of if, you won't feel most of that pain.

Still I can't help but feel there's gotta be a better way to do a lot of this shit.

>> No.71555791

<empty line>
<empty line>

>> No.71556604

> Stop relying on then or write your own

If the only option to create generic data structures is code generation or rewriting it for every new data type, in a language made in the 21st century, it's a sign of a bad language.

> const doesn't allow for variable change

Struct types can't be const, only primitives.

>Literally three lines are needed to write an error handling function and can be automated with snippets if you actually know how to use your text editor.

Once again, the fact that you basically rely on code generation for basic language features that other languages solved decades ago is the sign of a bad language

Go is retarded

>> No.71556794

That's only one possible implementation. It's not even a popular one, the only languages I can think of which have this baked into the semantics are Rust and C++.

>> No.71558304

>Go is retarded

Go is comfy. What would you use instead?

"Anything else" is not a good answer.

>> No.71558785


>> No.71559402


C is far superior to both.

>> No.71559766

for brainlets perhaps

>> No.71560284

void* and memcpy

>> No.71560344

>I don't understand what generics are

>> No.71560421

>I understand perfectly what generics are and implement them without the aid of a typechecker using functions already available to me.

>> No.71560434

generics are a feature of the type system you retard, if the type checker isn't involved then it isn't generics.

>> No.71560493

>storing arbitrary data irrespective of type
>not generic

>> No.71560501

>Rust is a better C++ replacement
no it's not

>> No.71560508

The only way to implement generics in C is by heavy macro usage. Every other approach requires some sort of discriminated union, which is polymorphic but not generic because you need to write out the specific code for operations on each type explicitly.

>> No.71560527

Generics has a specific meaning in PLT. To be specific it's a layman's term for parameteric polymorphism. Something isn't generic in the programming sense just because it's generic in the casual sense.

>> No.71560570

Generics are about generic operations on data, not there storage. Generics mean you can use the same operator or function to add two integers, or floats, or intervals, or complex numbers, or whatever user defined type you need.

>> No.71560577

>parameteric polymorphism
the parameters are void* and size_t

>> No.71560607

How do you know what the type of the object pointed to by void* is?

>> No.71560663

the parameters are type parameters you absolute dumbass. if the parameters aren't types it's not parametric polymorphism
is this what C does to people?

>> No.71560732

you don't need to. You only need to know how big it is for moving it in and out of memory locations.
If you want to use functions on stuff, wrap the function in another that takes pointers instead.
void apply(void* a, void* b, void (*fn)(void*, void*)){
fn(a, b);

void set (int* x, int* y){
*y = *x;

int main (void){
int a = 9, b;

apply(&a, &b, set);
assert(a == b);

>> No.71560764

in my example, apply only has a rough idea of the data it is applying a function to. The rest of the type information is filled in by set. You could extend this to work over larger widths of void* to implement "generic" dynamic arrays in C.

>> No.71560772

Ok so, for setting ints I need one function, but I would also need a function for setting floats, or cstrings, or different types of structs.
If I need to provide the operation definition for each type then how can you call it generic?

>> No.71560783

but it's polymorphism and it has parameters. What's so hard to understand?

>> No.71560785

Following all of these void pointers is horrific for performance btw. You are essentially creating a bunch of vtables which the compiler cannot optimize away.

>> No.71560795
File: 87 KB, 853x621, uriel1.png [View same] [iqdb] [saucenao] [google] [report]

>muh gomblexity

>> No.71560826

>how can you call it generic
Because a data structure taking this approach (void* with number of bytes allocated) can store any as just different width areas of bytes. The code for wrapping your actual function in another function can be taken care of with macros and only needs to be done temporarily where you use them on that data structure.

>> No.71560842

isn't this what muh generics use for dispatching method calls anyways?

>> No.71560875

That's stupid.

>> No.71560876

What's so hard for you to understand that certain terminology has well defined meaning in its respective context beyond just combining unspecific component terms?

Depends on the particular implementation.

>> No.71560980

>well defined term
>but no, not this way of defining generic implementations of datatypes and functions, that's wrong because the compiler needs to do it for you.

>> No.71561071

Generics as in C++ templates use compile-time monomorphism, generics as in C++ inheritance use dynamic dispatch through vtables.

>> No.71561084

You still don't get it do you? It's not about being "generic" in any vague or imprecisely defined sense of the word. It's about one specific feature which everyone who discusses programming language design understands the terms generics and parametric polymorphism denote.

>> No.71561102

Seems like a huge amount of effort for no reason. It would be much faster just to copy paste the code and change the types than jump through all of those hoops for no reason.

>> No.71561116

>muh terminology

>> No.71561141

Believe it or not, you have to understand what the words you use mean in order to add to a discussion. Otherwise you talk shit and contribute nothing.

>> No.71561149
File: 61 KB, 812x1024, 897A419B-584B-4E8C-9748-739FA6D74FA4.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.71561178

>/g/ is serious business
You're right anon. I'm sorry.

>> No.71561181

That would appear faster and simpler at first.
However when you actually make a program that has to be maintained, improved etc. you will find that it's actually less than ideal and becomes a spaghetti nightmare.

>> No.71561271

I doubt it. Pointer chasing is way worse for maintainability than redundancy in my experience.
The example still requires defining a set function for each type, which hardly qualifies as generic. In a generic function I should be able to write a single set functions which is capable of overloading a plus-equals operator or method to do what I want for that type, without me needing to know anything about the type beyond it supporting a few operations.

>> No.71561452

#define addEquals(x, y)\
int: x+y,\
myType: somefunction,\

>> No.71561486

closed type switches aren't generics either chump

>> No.71561579

>not generic

>> No.71561592

We've been discussing this all thread.

>> No.71561609

Generics are bad anyway. Operator overloading obfuscates the meaning of code.

>> No.71561662

Operator 'overloading' should only be allowed in certain contexts, like with haskell typeclasses

>> No.71561696

ah yes, because intvec3add(x, intvec3mul(y, 9)) is so much clearer than x + y * 9

Your C compiler already overloads int addition, float addition and pointer arithmetic. You don't dislike operator overloading, you just dislike it when it stops being compiler magic.

>> No.71561763

>names with types in are less clear than operators with no additional information.

>> No.71561784

>even more complexity has been added in the new C++
Nobody is forcing you to use it, you know?

>> No.71561785

>I don't understand abstraction

>> No.71561802

>>I don't understand needless obfuscation

>> No.71561824

guess C is obfuscated because I can't tell whether x + y is adding ints or floats :/

>> No.71561834

that's why you use casts brainlet

>> No.71561850

on every single arithmetic operation?

>> No.71561882

>heavy macro usage
No different than templated types.

>> No.71561893


>> No.71561948

Wrong for a host of reasons.
>automatic name mangling
>inline (automatically applied to implicitly instantiated templates) has a different and more useful meaning in C++
Templates are much better suited to the purpose of code generation than macros.

>> No.71561967

just use macros to mangle the names bruh

>> No.71562287


You must be retarded.

>> No.71562330

Everyone shitting on Go.

OK, geniuses. What is a better general-purpose alternative that isn't Rust or C++, both of which are garbage, and you all know it.

>> No.71562417


>> No.71562431


>> No.71562538


only debt-ridden researchers and NEETs use haskell.

C is all you need.

>> No.71562548


Pajeet languages don't count.

>> No.71562708

>The complexity of C++ (even more complexity has been added in the new C++)

If you don't want to use new C++ features, do not use them you fucking retard idiot.

>> No.71562761

0 out of 10 larp, pedo tranny.

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.