[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: ISO_C++_Logo.svg.png (74 KB, 1280x1441)
74 KB
74 KB PNG
you took over the C++ committee and now you can do whatever you want, how would you change this language?
>>
>>108487424
Copy Odin, Delete C++, and Paste Odin.
>>
>>108487424
>C++ + -- = C
>>
Tell people to use Rust.
>>
>>108487424
I would add a compiler option to make the const the default for everything. You should write mutable if you want to change something.
I would also add a command to compile constexpr result strings as C++ code.
>>
File: fugg.png (173 KB, 822x1020)
173 KB
173 KB PNG
I would create a C== language that fixes what C had missing as a transpilation target, and reintroduce Cfront.

C== should be the ultimate transpilation target, with the machine-level awareness and syntax of C while not being Assembly, but with only all the features you would need to compile Rust or C++ or anything to it.

C== compiler could be as simple as in the end of 80s, You could make a high-level C++ or Rust program and compile it into C== and the code would still look understandable and workable. You could see what the high-level concepts like object or monads reduce to.

And then in few years when an AI can build a C== compiler from scratch the possibilities are endless for building own computers and operating systems.
>>
>>108487677
C==3 would be a better name.
>>
>>108487692
If A == 1 then this is true.... wtf??
>>
>>108487424
Turn it until Rust 2.0
>>
>>108487424
Replace it with Haskell, obviously
>>
>>108487424
More a change in philosophy. Instead of creating endless over-engineered near useless features. Instead focus on small but highly generic and composable features. Also, move the standard library into a separate standard. C++ should focus just on native language features.

Some specific changes I have made in my own fork of clang.
Enable implicit cast from void* (like C)
Allow void pointer arithmetic
Introduce non-null terminated string literals, using the 'N' prefix
Support automatic generation of const/non-const methods to cut down on boilerplate. I introduced the new syntax 'const!' adding an exclamation mark to const in a method declaration causes the compiler to emit the method twice for const and non-const.
Cursed feature: allow umatched out-of-line methods. This fixes one of the biggest pain points in c++ being forced to declare private methods in the public class definition.

Some possible features.
Enhance templates such that they are a true replacement for macros. We would introduce a new template argument type that accepts a sequence of tokens.
>>
>>108487807
Most of these are really good ideas.
>>
>>108487424
>plant a bomb in the meeting room
>invite all of the committee members
>lie that I need to drive my child to school, so I don't attend
>kill them all
>blame it on Omara Bin Bosen
>invade and destroy Rustistan
>>
i would add designated initializers from c99, allow implicit pointer casts, and make global consts externally linked like in c. in theory i would like to remove the protected keyword so all derived classes can access private members. i always felt it was kind of a headache when i would refactor code. i really think that references are a horrible design and rvalue overloads are a headache, and overload resolution with template <typename T> void f(T&& t) {} then having to std::remove_reference_t<T> aids is terrible too. i really dont have a solution to this.
>>
File: chad nazi.png (183 KB, 612x430)
183 KB
183 KB PNG
>>108487424
Implement C# syntax + standard libraries + naming conventions
>>
>>108487424
Force templates for everything
>>
>>108487496
>[error] paste failed: 'odin' depends on external resource 'C++' which no longer exists
>>108487545
not enough. abolish the committee and release EVERYTHING. NO REDACTIONS. pre-announce that if the recordings from any single meeting is missing, then there is definitely a cover up taking place.
>>
File: fufufu.jpg (60 KB, 1360x768)
60 KB
60 KB JPG
Make a proper Java/C#-style batteries included standard library.
Make Clang the only official distro and compiler, make GCC niggers and MSVC fags all commit suicide
Ban headers and macros
Fix the retarded annotation syntax to be @Annotation instead of [[=RetardedGayNigger]]
Push for pattern matching, force anything that may fail use monadic operations (Expected<T, E> or Optional<T>)
Only exceptions are checked exceptions that have to be declared in signature like Java
Remove snake_case nonsense, only Java-style conventions
Make all variables const by default, and have to mark as mutable as opt-in
Add Rust-style lifetimes and ownership semantics
Remove _t nonsense
Remove C style pointer nonsense like int *a, *b and make int* a, b mean a and b are int*
Also make Gosling and Alexandrescu the new spiritual heads of the language and make Bjarne, Stepanov, Zverovich, Lavavej, and other GNUniggers all have public executions like in North Korea

Honestly? Turn it into Rust but with Java syntax.
>>
>>108488653
The committee is the worst thing to ever happen to C++
Even Fortran which is an equally boomer dominated language at least has open development where you do not have to PAY REAL MONEY to access the standard
>>
Make it into Rust.
>>
>>108487424
I would sacrifice it.
>>
>>108487424
>force compiler implementers to break ABI when it stands in the way of new optimizations
>mark all classes in stdlib final, so that retard at work stops inheriting from std::vector
>>108487807
>Support automatic generation of const/non-const methods to cut down on boilerplate
https://en.cppreference.com/w/cpp/language/member_functions.html#Explicit_object_member_functions
>>
I wouldn't change it.
C++ is good at being C++.
I would add typedefs of primitives in i32 i64 etc. format to the default language.
>>
>>108488882
Whats wrong with inheriting from vector?
>>
>>108487424
Age verification. You cannot write C++ code unless you are 38 years old.
>>
>>108487424
I would fire everyone, delete everything after C++17, and then quit. C++ is finished, there's no point to adding anything else.
>>
>>108489063
why would you? every single reason to do so is bad. just use non-member functions to operate on a vector.
>>
>>108489153
>delete everything after C++17
yeah, but concepts are good though
>>
File: file.png (71 KB, 1021x360)
71 KB
71 KB PNG
>>108487496
>Delete C++
Who's getting deleted!? Who's getting deleted, bitch!?
>>
c++ is fine, modules are getting there, vcpkg is great, and we have reflection on the horizon
>>
>>108488664
So I wasn't completely wrong in guessing that C++ was fucking boomerized?
On that note, [assuming that's a fault with C++ and not simply because it was designed by committee], allowing boomers anywhere near computing let alone dominating how computing would be advanced, was one of the biggest mistakes mankind ever made. Boomers should never have been allowed dominion over anything.
>>
nothing i would. it is what it is. ill better rule C committee

why nothing? because i belive in explicit runtimes, there, objects could simplify execution. in an implicit runtime, object complicate execution. substitue comprehension to execution, same.
>>
modern C

i see at: https://github.com/skullchap/chadstr
and what i get: _Generic is new keyword
https://en.cppreference.com/w/c/language/generic

but hidden polymorphism no in C style also i hate how C macros become FP style langrage a want PHP+C hybrid, where C compiler grant to PHP the _Generic function to get type of expression in current context of course it is 2 pass C compiler
----------------
new keyword PHPmacro: PHPmacro phpFuncName(args) ---translates-to--->
---------------------
I NEED IN C:
1. REMOVE RULE OF PRE DEFINATION, I LIKE TO DEFFINE DATATYPES LAST
2. AUTO CREATION *.h FILES FOR EVERY *.obj AND *.lib
3. NAMESPASES (JUST FOR FUN)
ALSO MULTIPLE VARIABLES RETURN FROM "GO" CAN BE NICE

I GET: C++
>>
>>108487662
Problem is that the compiler errors for const/mutable mismatches are genuinely insane. There is one place in the language that is const by default (lambda captures), and it trips me up regularly.
>>
>>108487424
rename free to new and new to free
>>
>>108489345
wait im a retarded cnile, free is actually delete
>>
File: 1769820329152901.mp4 (2.01 MB, 480x960)
2.01 MB
2.01 MB MP4
>>108489300
>i see at: https://github.com/skullchap/chadstr

macrolang is disease of retardation. heres another CHAD cosplay.
>>
>>108487807
>Support automatic generation of const/non-const methods
already somewhat fixed by "deducing this" in C++23
though you would still need to explicitly instantiate the overloads that you want to use

>Cursed feature: allow umatched out-of-line methods. This fixes one of the biggest pain points in c++ being forced to declare private methods in the public class definition.
i like trying to solve this pain point, but this solution seems weird
how about allowing to declare private methods in a separate header? data members would need to go into the main header, since those are needed by API users for determining struct size
maybe even enforce putting sth like 'friend private class ImplementationClass;' into the public header once, so not just anyone can modify the class's private bits

>replacement for macros
would this really work? this sounds like it would not replace macros, but reinvent them, along with their biggest pain point, expansion of token sequences into arbitrary contexts and the surprising behaviours that this can have
>>
>>108489403
>would this really work?
come to think of it again, it probably would
because templates would be able to expand the token sequence into the syntax tree instead of pasting verbatim like macros
>>
>>108487966
>i really think that references are a horrible design and rvalue overloads are a headache
cannot be fixed without two breaking changes:
1. no more implicit dereferencing/referencing
2. replace implicit copy with implicit move. copy would then be a move of an object created in place by .copy(), so there is no more need to distinguish value types from rvalue reference types

incidentally, both points were done right by rust
>>
>>108487424
Deprecate it and declare that all our efforts should go towards Rust and converting existing code to Rust.

The seething would be incredible
>>
>>108489403
Allowing out of line declarations does allow you to define methods in a different header. You can define methods anywhere. This makes it possible to mirror the c pattern of using static functions in the implementation. My code uses my custom feature along with
#define STATIC __attribute__((internal_linkage))
to exactly replicate the C style static function but for methods.

As for the specifics. My implementation of this feature is incomplete and hackish. I just commented out a single line of code in the compiler that forbids the declaration of methods outside of the class body. This feature as I have it implemented totally side steps public/private, since these methods default to public. To you can defeat private using these methods.

A more reasonable and serious implementation would have such methods be private. Which preserves the public/private system, since even though you could still declare such methods anywhere, you could not call them.
>>
>>108487424
>how would you change this language?
I'd remove inheritance. It sucks and it makes ugly, hard to read codebases.
>>
>>108489509
Ah, I thought that by unmatched definitions you meant that the type in the header and the implementation would not need to match, so you would basically just be declaring names

A different trick to a similar goal that I have seen for test code is:
#ifndef PRIVATE
#define PRIVATE private:
#endif

And then, in the implementation just:
#define PRIVATE

So the class is completely public just in the implementation file
>>
>>108487424
I would go back to C++11 and never change anything from there.
>>
>>108487424
Remove the std::initializer_list hackery that allowed curly braces to be used directly alongside a type name for construction.
Type t{}; # this should NEVER call the std:: initializer_list constructor


That would allow curly braces to be used unconditionally for actual "uniform" initialization, no exceptions.
>>
>>108489300
>new keyword PHPmacro: PHPmacro phpFuncName(args) ---translates-to---> <?PHP phpFuncName([argNames],[argTypes]) ?>
>>
>>108487424
it's already perfect
>>
>>108489028
>C++ is good the way it is
You're not a developer.
>>
File: stare.jpg (3 KB, 125x118)
3 KB
3 KB JPG
>>108487807
> allow unmatched out-of-line methods.
Skill issue. Learn how to use the language before adding even more retarded shit.
>>
>>108487424
Deprecate everything after C++0x.
>>
>>108490691
>>108489665
Nah, only retarded shit like modules, coroutines, and all the crap in ranges slowing down the compilation of everything else.
Also writing const should be enough, auto const is too verbose.
>>
>>108488656
Based
snake_case is literal nigger aids
>>
File: pointerjeet.gif (426 KB, 254x360)
426 KB
426 KB GIF
>>108490711
>headers le good
Fuck off cnile faggot, you are the reason C++ looks so hideous with everyone fully qualifying every type because they are scared to use using imports which LITERALLY EVERY OTHER LANGUAGE USES and no one needs you nigger macro leakage like your neovagina leakage
>>
>>108490840
modules are garbage, there is not one language in which modules are any good. Also, all the issues with c++ are nothing to do with headers. And all the problems could be fixed without switching to some brain damaged dead on arrival module system.
>>
>>108490840
The problem is what C++ calls modules, is really bad and still has to interop with cpp which is still a massive problem. It was a bad addition to the language.
>>
>>108487807
>Support automatic generation of const/non-const methods to cut down on boilerplate

it already exists, it's called deducing this:
template<class Self>
decltype(auto) get_stuff(this Self&& self) { return (self.stuff); }

>Enhance templates such that they are a true replacement for macros. We would introduce a new template argument type that accepts a sequence of tokens.
I like this idea, but all languages that have this feature basically can't support more than one implementation (rust, python), because that forces implementations to adopt standardized tokens and probably also forces some kind of parsing.
The problem is that if you get the tokens wrong, then your language might simply be non parsable, or require a turing machine to parse, as c++ currently does
>>
>>108491670
>I like this idea, but all languages that have this feature basically can't support more than one implementation (rust, python),
Why? gcc-rs is being developed despite Rust having procedural macros. It's not like it's so difficult to just provide token tree implementation in a custom compiler, it's literally just a list of tokens with parenthesis making a subtree. It's as simple as it gets.
>>
>>108491701
yeah, but rust has actual tokenization. in c++ tokenization happens AFTER name resolution, meaning it's impossible to create new symbols at this point. You'd need to redesign the entire language from scratch, which might be a bad idea since C++ is one of the only language whose parsing is already turing complete.
>>
>>108491670
> because that forces implementations to adopt standardized tokens
It doesn't. But they are pretty standard anyway, tokens are generated by the c preprocessor, and what constitutes a token is specified by the standard.

Also, C++ already has delayed token parsing in other places. class method bodies are delayed parse, which means a token stream is collected and played back later.
>>
>>108491775
> in c++ tokenization happens AFTER name resolution
The only tokens in c++ are the ones that come from the preprocessor. Processor tokens are fed straight into the parser to build the AST. Preprocessor tokens do no resolve name/type, all names are just identifiers at this stage. So any token based templating system would happen before parsing.
>>
>>108491882
What I meant by that, is that you can't infer what a sequence of identifiers means during tokenization. Tokenization cannot detect if `foo bar;` means bar of type foo, or 2 variables separated by a space. Meaning that procedural macro passes wouldn't be able to work out what happens here. Stuff like that happens everywhere, like whether >> closes two templates, or if it's operator>>, or of `T::x * y` means multiplication, or pointer variable declaration.
>>
File: poptart.png (5 KB, 370x397)
5 KB
5 KB PNG
>>108490840
If the only reason that header files are good is filtering out fags like you, it'd be the only justification for it being superior.
You will never be a real language.
>>
>>108487424
max heap
>>
>>108487692
Doesn't this look like a cock
>>
>>108491935
I don't know anything about rust or procedural macros. But my idea for native macros in c++ would be based on collecting token sequences and inserting them in the right places. The core of the idea is collecting brace balanced sequences of tokens which can be inserted elsewhere.

Here is one example, a template that accepts tokens.

template <tokens x>
void test()
{
x;
}

test<{ printf("Hello") }>()

-----------------------------------

One could also define scoped macros

void test()
{
__macro fred(x, y) { printf("%d, %d", x, y); }

fred(10, 20);
fred(30, 40);
}

This would compile to

void test()
{
printf("%d, %d", 10, 20);
printf("%d, %d", 30, 40);
}
>>
>>108489203
lmao
the odin tard was COPING just the other month when asked why the language wasn't self hosted instead of being implemented in......C++ lol
(would be even sadder if there is more than one odin tard here considering a world population of <10)
>>
>>108488653
actually, i just thought of a much funnier move.
since accelerationism is all the rage nowadays, ACCELERATE C++ and take it faster near its retarded (non)conclusion. double the language size in one go by adding as many incoherent "features" as possible to the standard. ALL AT ONCE.
this wouldn't even raise an eyebrow among "the faithful". au contraire, you will have an endless barrage of blogposts wax lyrically celebrating random features that will never get implemented. watch retarded "believers" do this non-stop for the next three years lmao.
>>
File: cnile.png (103 KB, 662x900)
103 KB
103 KB PNG
>>108491599
>modules are garbage, there is not one language in which modules are any good.
cnile sour grapes level: off the charts
>>
>>108492154
Its not sour grapes, I have tried other languages, and have never found their module systems compelling. Also, modules really don't fit well with c/c++, in c/c++ its common to stitch together unrelated code in different libraries. Modules don't work as well for that kind of thing.
>>
>>108492037
this is certainly doable, but when implementing your macro logic, there isn't much you can parse because you'd need name resolution at this point.

that would work if you plan to use your macro on something else then c++ code/decls, but if, say you want to be able parse a struct definition in order to serialize it, then you need name resolution
>>
File: chasetower.jpg (43 KB, 384x640)
43 KB
43 KB JPG
>Memory safety profiles, they're retarded for not doing this
>Compiler flag which defaults all variables to const by default
>Compiler flag which disables copy ellision of returned stack variables, requiring manual handling of moves/copies out of the stack (this handle an issue where deleted move constructors silently change the behavior of a method)
>unique_ptr allows custom allocator object like shared_ptr does
>remove operator overloading


There's probably more but I haven't touched C++ in a couple months
>>
>>108494212
Reflection is a completely different thing to macros.
>>
>>108494248
>operator overloading le bad
Why?
Even Rust has it through std::ops
>>
>>108494248
>Memory safety profiles, they're retarded for not doing this
Profiles are underspecified and garbage.
>Compiler flag which defaults all variables to const by default
>Compiler flag which disables copy ellision of returned stack variables, requiring manual handling of moves/copies out of the stack (this handle an issue where deleted move constructors silently change the behavior of a method)
This is a compiler issue, not a standards issue, however the standard probably should mandate attributes that suppress copy elision and require copy elision so it's clear when such a thing is happening.
>unique_ptr allows custom allocator object like shared_ptr does
Agree 100%.
>remove operator overloading
Why? If you dislike operator overloading in your codebase just forbid it. It's too useful to remove.
>>
File: QXL0a1X.gif (651 KB, 480x360)
651 KB
651 KB GIF
>>108494406
it obfuscates behavior that should be behind an explicitly named function instead. The behavior and meaning of code should be completely obvious without having to follow an IDE's references to know that the author is using an overridden `==` operator. Almost all of C++'s worst features are a result of developers trying to type like 6 or 7 fewer characters per line
>>
>>108494406
there is no OVERloading in rust just like there is no sub-classing and inheritance. your brain is OOPtarded to the point of unsalvageability
>>
>>108490711
Based AF.
>>
>>108487424
super classes
>>
>>108489332
Skill issue. You are eager to blame somebody else but yourself.
>>
>>108494658
What do you want to do?
Either you don't have a complete understanding of the language, or you don't like the syntax candy flavor.
>>
File: 1994933.gif (1.34 MB, 640x360)
1.34 MB
1.34 MB GIF
>>108494579
OOP is aryan and hating it is a sign of being a cuckjeet cnile who hates anything that breaks from the cuckjeet imperative paradigm
>>
>>108494466
>it obfuscates behavior that should be behind an explicitly named function instead.
Wow, just like anything else named .add() ?
>>
>>108494903
>i'm aryan saar
>i even call others jeets saar see
>i studied imperative vs oop the only two paradigms saar
>those jeets saar only know imperative languages saar like c# java js and all that jeet shit saar
>>
>>108487424
I'd make conversions to bool only ever happen explicitly.
>>
File: 1745612673804922.gif (344 KB, 500x491)
344 KB
344 KB GIF
>>108495070
Holy cope, you will never be a functionalchad, not even Rust rejected OOP entirely or operator overloading, you just demonstrated to the whole world your clear lack of knowledge which comes from being educated by Durgasoft-adjacent diploma mills from the slums of Mumbai.
Do us all a favour and stand in front of a train Pranjesh.
>>
>>108491939
Nocoder detected
>bloating compile times by recompiling the same header hundreds of times actually good
>>
>>108488656
>public executions like in North Korea
Think Romania and the Ceaușescus.
>>
>>108488656
>Fix the retarded annotation syntax to be @Annotation instead of [[=RetardedGayNigger]]
The worst part? The annotation syntax looks like this
class [[=Serialized]] Document {
// contents
};

instead of just
[[=Serialized]]
class Document {
// contents
};

This makes it ridiculous to try and compose multiple annotations, you get tremendously ugly syntax like
class
[[=Serializable]]
[[=Formatted<Debug>]]
[[=Flag]]
[[=Target<OperatingSystem>{OperatingSystem::UNIX}]]
[[=Retention{RetentionPolicy::RUNTIME}]]
Document {
// contents
};

Whoever came up with the placement of attributes and annotations in C++ should be shot.
>>
>>108495162
>/g/eet still trying to bait when she doesn't even know what the OVER in OVERloading means despite it being CAPPED for her
>>
>>108487424
Cange all instances of "undefined behavior" to "implementation-defined behavior". Add a catch-all phrase at the end saying that anything that could possibly be considered "undefined behavior" should, in fact, be read as "implementation-defined".
>>
>>108487424
Remove classes and oop
>>
Replace it with Java.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.