[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: 1736983214939414.png (60 KB, 1138x416)
60 KB
60 KB PNG
here's your programming language bro
>>
>>106448121
what's the problem?
>>
>>106448121
I hate niggers that write unreadable garbage like this, rife with shorthand and non-descriptive variable names. If your code looks like minified JS then you should kys.
>>
>>106448121
Stop using ligatures you web shitting vibe coder pajeet
>>
Unironically better than C++ btw
>>
>>106448391
One must be retarded to be unable to read this code.
>>
>>106448433
I'm not opening 10 fucking documentation pages to learn what ' or ? or &[<'_>] or -> or => mean and how much match syntax differs from normal code. i would rather stay retarded than be deranged
>captcha: rrgrr
>>
>>106448121
>
&[Sel<'_>]

jfc
>>
>>106448471
>what the fuck I can't understand a language I don't know, so it's "unreadable"
You are fucking retarded
>>
>>106448471
If you don't understand what 'a, ? or &[] means you don't even understand the absolute basics. What a stupid complaint.
>>
>>106448433
I CAN read shitty, obtuse code. It just takes longer than it does to read well-written code. It's retarded to write something that needs to be deciphered before it becomes intelligible, when there is no benefit to doing so.

(You) aren't smarter than the compiler. It's going to optimize the code anyways. The only thing you're doing with shit like this is making your code harder to read and making your code files literal bytes smaller.
>>
>>106448508
>any other sane language
>can be read, the meaning of instructions is clear and laconic
>rust
>if you dont know X Y Z you cant know whats going on!
>wdym this is unreadable? this is readable! just learn you fucking retard, subhuman, idiot nigger ass
>>
>>106448580
I’m assuming this is rust?
It’s always funny seeing what language developers come up with being ignorant of 50 years of computer language development and notation.
It’s like trying to communicate with a child raised by wolves for 10 years.
>>
>>106448655
You can write unreadable code in any language. C and C++ function pointers are unreadable gibberish no matter how you write them, many languages would let you write everything on a single line.
>>
>>106448580
The absolute basics of rust-specific "features", you mean? Then op's thread is directed at you who write rust, which he should've specified. It's sheer delusion to think that only fellow rustfags're gonna answer otherwise
>>
>>106448655
>>106448688
> doesn't understand lifetimes
> doesn't understand references
> why is this unreadable?
>>
>>106448401
Ligatures are based nignog fagboy
>>
>>106448121
wtf does K and I do? some type cast? I can't fucking read this
>>
>>106448722
it cur gets k?,, anon
>>
>>106448722
K and I are variants of the Sel enum.
>>
>>106448715
Sure they are Rapejesh, now go back to vibe coding your fifth Go project saar
>>
>>106448121
this makes cppreference.com look like plain english.
>>
>>106448737
don't you have to do Sel::K and Sel::I? I've literally had Rust yell at me in the past when trying to directly reference members
>>
>>106448618
People who use one character variable names that aren’t for X and Y coordinates and similar should be shot. The only exception is for maths heavy code where it’s all maths variables that represent abstract shit anyway.

Even if you’re wanting to stick to the 80 column limit for readability, there’s a ton of ways to nicely format shit. It’s mostly a hold over from punchcards and terminals that couldn’t scroll
>>
>>106448759
You can import the variant names (with use) so you can access them directly.
>>
sepplesfags be like
>rust is le unreadable!!!
meanwhile sepples:
template <std::__poo_in_the_loo _T, gnu::_retarded_snake_case_spam _XzzT> 
requires India<>() && nigger_t;
[[gnu::autism]]
[[=gnu::IndiansWroteThisCode]]
constexpr consteval constinit const noexcept void std::type_info() operator[](void*& a, boost::benchod::india_t^^ reflexpr _T b) noexcept throw(std::bad_alloc) new delete stackalloc^^ {
if [[likely]] constexpr (std::same_as_t<b, 135, _XzzT>(b)) {
b = new gnu::getopt::Program<>();
delete a;
} else [[unlikely]] [[clang::msvc::_MicrosoftWindowsReactStartMenu<>()]] {
#ifndef DURGASOFT_H
#define DURGASOFT_H
export poo.in.the.loo.durgajeet;
import java.util.ArrayList;
import java.io.*;
std::io::IOException e = { 2.718 };
throw panic!^^(@poop);
delete op_post;
}
return nigger_language == std::_internal::nlohnann::json();
}
>>
>>106448121
this is STILL better than c++
>>
>>106448802
>[[likely]]
cool
https://doc.rust-lang.org/beta/std/hint/fn.likely.html
>>
>>106448802
holy shit anon
lmao
thanks i laughed, saving this one
>>
>>106448802
>constexpr consteval constinit const
I love that C++ has like 18 const variants and still nothing will actually be const.
>>
>>106448471
All these symbols are commonly used in programming, it doesn't take a genius to understand them. The only fairy unique syntax here is 'a but considering that Rust is known for explicit lifetimes and that this notation is used next to reference symbol, it should be very simple to deduce its meaning.

tl;dr skill issue
>>
File: 1711100977090717.png (418 KB, 568x568)
418 KB
418 KB PNG
>>106448802
>import java.io.*;
holy ROFL
>>
>he doesn't use `Box<[T]>` rather than `Vec<T>` when interacting with data that is contiguouss and never re-sized
>>
>>106448740
Go is also based fagboy
>>
>>106449175
>has a HTTP server in stdlib
>no sets
lmao
>>
>>106448765
How about i, j and k for counting?
>>
section .data
null dq 0

section .text
global at_opt
at_opt:
push rbp
mov rbp, rsp
mov r12, rdi ; v (first arg: value)
mov r13, rsi ; path (second arg: array of selectors)
mov r14, rdx ; path_len (third arg: length of path)
mov r15, r12 ; cur = v

.loop:
cmp r14, 0
je .done
cmp r15, 0
je .return_none
mov rax, [r13] ; load current selector
cmp byte [rax], 0 ; type check (0 for K, 1 for I)
je .key_case
; index case (I)
mov rsi, [rax + 1] ; get index
call [r15 + 8] ; call cur->get with index
jmp .next
.key_case:
; key case (K)
mov rsi, [rax + 1] ; get key string
call [r15 + 8] ; call cur->get with key
.next:
mov r15, rax ; update cur
add r13, 8 ; move to next selector
dec r14 ; decrement path length
jmp .loop

.done:
cmp r15, 0
je .return_none
mov rax, r15 ; return Some(cur)
leave
ret

.return_none:
xor rax, rax ; return None (null)
leave
ret
>>
>>106448121
fn at_opt<'a>(v: &'a Value, path: &[Sel<'_>]) -> Option<&'a Value> {
path.iter().try_fold(v, |cur, s| match s {
K(k) => cur.get(k),
I(i) => cur.get(*i),
})
}
>>
>>106448121
Can someone post this code with non-retarded variables and function names that actually tell you what they are supposed to be?
>>
>>106449354
thats just how rust works
>>
Just because everyone has dealt with annoying syntax doesn’t mean that we should continue to consume this garbage
It’s like Rust is designed by ultimate autismos, just because you care to deal with annoying shit doesn’t make you more intelligent
It makes you a curmudgeon and a retard unable to cope with sensible changes
It’s being a luddite and again socially blunted and again RETARDED
All these concepts can be handled and parsed with less terse syntax
If I am having constantly to hold the shift key you have failed to move this shit forward into a sensible direction

I also not here to do this job for you I don’t need this language and will definitely be less interested in this shit going forward if it becomes adopted by you losers
>>
your all gay and retarded
>>
>>106449210
i, j, k, l and so on are based for loop iterators.
>>
>>106448121
no clue what i'm looking at, thankfully i can ask chat gpt to write everything verbose and with commentary
>>
>>106449366
I get that, and it looks horrible, but maybe if the freetard who wrote the code didn't use 1 letter variable and function names, I could at least understand what it's supposed to do and appreciate the part that's Rust's retardation
>>
How would you write that in your language?
>>
>>106449354
Not that hard when you know the syntax. It's basically a program that controls the intensity of a vibrator based on the amount of fecal matter present in the bussy.
>>
>>106449438
The sooner the LLMs kill this stupid proffession filled with social mongoloids the better
All this shit just brings sukdeep and chang to america fuck off turn the whole internet off fuck it
>>
>>106449467
>URMMM AKSHUALLLY..
this is what I am talking about
jump off a bridge you cunt
>>
>>106448802
sepplestrannies seething but this is unironically what any standard library function implementation looks like lmao
>>
File: zero.png (15 KB, 653x475)
15 KB
15 KB PNG
>>106448508
Any code should be readable to the point that you can at least estimate what's going on. That's the fucking point of using languages consisting of English words.
Unless you're writing in an esoteric language that's supposed to be unreadable if you don't know the principles.
>>
>>106448802
Kek
Still looks nicer than Rust
>>
I know literally nothing about the Rust syntax, what the fuck is this doing?
The best I can figure out based on my limited monkey brain is that cur is set to the value member of a and from there it is trying to match some part of a path variable to get k and i before doing some other thing with Some(cur)?
>>
>>106448121
honestly i'm a fan. nice ligatures btw.
>>
>>106448802
Nobody said you had to use templates homo
Instead of making this thread stick a dildo up your ass you queerboy
>>
>>106448802
still more readable than your soilanguage
>>
everybody know rust is and forever will be associated with insane unstable disgusting trannies
i would rather program in javascript
>>
>>106448121
Looks like the grammar for my schizo autistic brother's imaginary autism language
>>
>>106448121
Fuck this garbage.....
>>
>>106448401
Das rite, fuck this stupid & shit, real coders write et.
>>
>>106448121
This is even worse than JavaScript slop C++ will never go away kek
>>
>let
>>
>>106448121
Eww wtf is this? This can't be a real language, what are those runes?
>>
>>106449544
Yeas, and people just don't get it. They don't want this quality it seems and instead decide to throw nigerppp as a comparison. Lol, even rustshit is better than modern nigerppp.
>>
>>106448618
This. 100% unequivocally this.
Couldn't have said it better.
>>
>>106449544
>every language should bend over backwards to help my lazy ass
No, fuck off. Take any 10+ lines C function, go outside, and start asking random non-programmers what it does. English keywords won't help them.
The target audience of a programming language is not anyone that knows english, it's programmers who can sit their ADHD ass down and learn it.
you are a lazy nigger
>>
>>106448674
>I'm a dumb nigger who expended all of his brain plasticity on learning C, so refusing to limit the language to what I already know is "ignoring 50 years of computer language development and notation"
>>
File: images(1).png (17 KB, 351x143)
17 KB
17 KB PNG
>>106448655
Is this readable for you?
>>
>>106450984
Should've shown latin
>>
>>106449563
'a is a generic lifetime, not a value
First it sets cur (current value) to v.
Then it iterates over path which is a slice (known size array in memory) of Sel (-ection, I assume). For each Sel s it matches whether it is a K(-ey) or I(-ndex). If it's K it binds it's contents to variable k (presumably some string type), then calls cur.get(k), if it fsils the whole function returns None. Analogous thing is done for I, with i being some index type.
If whichever path was taken got a value from get then cur is set to that value.
After the loop ends cur is wrapped in Some because the function returns an Option, which can either be None, could be returned earlier to indicate failure, or Some, which is used now to indicate success. Function returns the last statement

In short it takes some Value and a path and tries to navigate to a sub Value at it
>>
>>106451110
That makes sense, thanks anon.
>>
>>106449259
unironically most readable in the thread
>>
>>106451179
i concur
if a high level language is less readable than fucking asm then its a mission succesfully failed
>>
>>106448802
KEK
>>
>>106450940
>moving the goalposts to non-programmers
you're an idiot, anyone with a brain can grasp that having verbosity is a detriment to proper programming, regardless of their skill level. the whole point of a language is to abstract away the core constraints that the machine architecture of a computer demands so that you can focus on defining the underlying behaviour you're trying to make it achieve. anything that impedes that is bad design. it's not up for debate. just because you're willing to jump through hoops because you want to seem like smart little script kiddie is irrelevant.
>>
>>106448121
Language should have low mental burden on reading. Words are easier to read. I can read regex, but it's faster to parse a sentence then scanning character at a time. If you are not illiterate you can read 3 to 5 words at a time. It's more efficient and effortless in comparison to scanning character by character without spaces. There is a reason why we make spaces between words, use interpunction and form words instead of using continuous series of pictograms. Chinese is an exception, but they encapsulate meaning into a single symbol or in a sequence of them, but they don't overload these symbols I guess. It still looks harder to read.

I prefer languages that have fucking words for syntax and sensible operators that don't overload much. Abbreviations like fn for function are good though. C is a the sweet spot between explicit syntax and low verbosity. Rust and C++ looks tiring af to read with all of these symbols and brackets. Ironicaly I like Perl, but I write it mostly like C so only the sigils are extra which don't make it as busy as C++.
>>
>>106448121
I can read it, but like if I was in a prod team and this was how they wanted their codebase to look, I would not work there very long.
>>
>>106448121
Jesus
HolyC is more readable than rustanistan
>>
File: 1736234131077944.png (797 KB, 869x1776)
797 KB
797 KB PNG
>>106448391
this is you
>>
>>106451641
>Implying that wanting code to not be niggerlicious means it has to be non-functional bullshit
>>
>>106448121
In Perl this is just
sub at_opt{my($v,$p)=@;my$c=$v;for(@$p){ref&&return undef;ref$c eq'HASH'&&exists$c->{$}?$c=$c->{$}:ref$c eq'ARRAY'&&/^\d+$/&&$<@$c?$c=$c->[$_]:return undef}$c}
>>
>>106449042
>>106448433
Rust should just use Perl for its Turing-Complete Type system at this point.
>>
>>106451791
How would you incorporate Perl into Rust exactly? They are very different languages
>>
>>106448802
Truer words have never been spoken.
>>
>>106448771
you can but you really shouldn't, especially when the base enum is just a short name like Sel anyways
if you do this and the enum you're using ever gets a member removed then the member name you have written will become a valid identifier and implicitly and silently match everything which will skip execution for subsequent match statements
it's explicitly called out in the api best practices book and i think is even a clippy lint
>>
>>106451277
>Any code should be readable to the point that you can at least estimate what's going on. That's the fucking point of using languages consisting of English words.
I don't see "by people who know programming" anywhere there. The point of using english words is that you can estimate what's going on. Well, C uses english words. They know english. They should be able to estimate what a C function does. No cheating with comments or function names.

>the whole point of a language is to abstract away the core constraints that the machine architecture of a computer demands so that you can focus on defining the underlying behaviour
Defining how? In english words? Only in things YOU already understand? World ain't about you faggot. Code in op has 12 non-whitespace characters that don't define the behaviour of the function. Just because YOU can't understand something because you don't know the fucking language doesn't mean it's too verbose or unreadable.
I don't give a fuck about a blind person's opinion on how good a graph conveys information and I don't care about an illiterate niggers opinion on how good code conveys information
>>
>>106451641
This is all the illiterate niggers ITT
>>
File: file.png (562 KB, 775x1500)
562 KB
562 KB PNG
>>106448802
Kek
>>
>>106448121
Retarded variable naming aside
Surely there's a way to implement these features in a way that doesn't read like inline brainfuck
>>
>>106451952
If you don't value ensuring there's zero confusion or ambiguity, then you are a liability and will never be given any real responsibility on a large-scale project involving more people than your sorry ass
>I don't give a fuck
World ain't about you faggot. take your own advice.
>>
>>106448471
Besides the shit naming, there's barely anything going on in this code.
<'a>, <'_> is the normal Rust lifetime autism. It's the ONE novel feature of Rust. If learning syntax for one feature is too much, just stick to assembly, I guess, but don't complain.
& is a reference, just like in C++.
[ ] are arrays/slices like in a million other languages.
The match syntax is just a slightly less awful switch/case.
>>
>>106448802
Missing #endif for #ifdef DURGASOFT_H
>>
>>106449259
Well-commented assembly is easier to read than any compiled language lacking comments.
>>
>>106452091
Denoting lifetimes with apostrophes is a major design flaw by the way.
Anyone coming from other languages (e.g. Lisp) would assume its some kind of deferred evaluation quoting syntax.
>>
>>106452179
Suggest a better syntax
>>
>>106452209
https://smallcultfollowing.com/babysteps/blog/2024/03/04/borrow-checking-without-lifetimes/
>>
>>106452217
So what syntax are you suggesting?
>>
>>106452209
In C style, it should be a colon postfix, as when expanded, lifetimes look a lot like goto labels.
Maybe that also shows why Rust type annotation is quite bad, copying Python/TypeScript was a mistake.
Either use C's approach, or go full Haskell.
>>
>>106452280
Give an example of what you have in mind
>>
>>106451641
>shalom ayash
>>
>>106452063
The code above has no ambiguities. The only confusions are in your head, about how being understandable to you without any extra learning is a requirement for good syntax
>>
>>106452091
Wow, so you're saying all the stupid retards that learned programming to make videogames or to be a le epic haxxor and barely managed to learn almost all keywords in C should just pack it up and fuck off just because you can't be programmer with a brain that can't fit more than two tweets' worth of information?
>>
>>106452484
>the slowdown in productivity wasn't due to my verbosity because...uh....it's just in your head!
put the fries in the bag
>>
>>106452063
>confusion or ambiguity
NTA, but Rusty is very explicit. It doesn't even have implicit type conversions like C.

>>106452622
Being more formal and explicit is trading momentary productivity to boost long run productivity. The more things you express explicitly, including semantics and valid use of your interfaces/abstractions, the less things you will have to memorize or teach to your coworkers. On a small project it might seem redundant, but as the project size increases, things very quickly spiral out of control and you find yourself afraid to touch any part sufficient old because only god knows what kind of unwritten constraints and invariants hide there.
>>
>>106448121
In C++ this is just:
template<typename Value>
const Value* at_opt(const Value* v, const std::vector<std::variant<std::string, int>>& path) {
const Value* current = v;
for (const auto& selector : path) {
if (!current) break;

const Value* next = nullptr;
std::visit(
[&](const auto& sel) {
if constexpr (std::is_same_v<std::decay_t<decltype(sel)>, std::string>) {
// Handle string key case
next = current->get(std::get<std::string>(sel));
} else {
// Handle integer index case
next = current->get(std::get<int>(sel));
}
},
selector
);

if (!next) break;
current = next;
}

return current;
}
>>
>>106452901
>sepplestrannies cannot into modules
>so they write fully qualified symbols everywhere because they are scared of using
>>
>>106452222
there shouldnt be syntax for this
>>
>>106452901
Somebody already posted idiomatic C++ here >>106448802
>>
>>106453405
So your problem is not syntax but semantics.
>>
>>106448471
based
>>
>>106452901
>std::visit
I heckin' love variants
>>
>>106451772
kek
>>
>>106448121
this is quite easy to understand whats the problem? If you want to show hard code show multibody physics simulation code thats a piece of shit.
>>
>>106448121
looks like the cat walked over the keyboard while you were writing the function signature, might want to clean that up
>>
>>106455684
wow you must be so smart, anon. how does it feel bragging about being smart on /g/?
>>
>>106448121
>2025
>nocoders are still coping over Rust
>>
>>106455717
>2025
>nocopers still coding in rust
>>
File: jobs-rust.png (73 KB, 463x968)
73 KB
73 KB PNG
>>106455717
>the "cope"
you sure you know what that word means, anon?
>>
>>106455872
705000 jobs and you are still unemployed. Whats your excuse?
>>
File: laugh rlm.jpg (113 KB, 1028x1128)
113 KB
113 KB JPG
>>106448802
I'm still not using Rust btw.
>>
File: cornflakes.jpg (75 KB, 645x500)
75 KB
75 KB JPG
>>106448408
c++ you can legally "override" the "override" keyword.......
>>
>>106452022
To me the declaration line looks like fresh Befunge
>>
>>106448737
What is the actual definition of the Sel enum? What are the type constraints on what can be inside K and I that make it worth having them in this context? (You might think this is obvious, but I don't and nor does a web search.)
>>
>>106455906
im "self employed"
aka made enough money a while ago to now shitpost on 4 keks without restriction

and whats your excuse to still be wageslaving and earning one penny on each dollar you make, like a cuck?
>>
>>106448765
>It’s mostly a hold over from punchcards
REAL PUNCHCARD USERS DIDN'T INDENT AND DIDN'T USE LOWER CASE LETTERS
Used to work with one of them long ago. Only person I've ever known who could make a good error-correcting parser.
>>
>>106456036
>self employed
Nice gymnastics anon.
>>
>>106451277
different languages seek different outcomes in different contexts. programming is a diverse field that covers a lot of domains, each with their own values and priorities.
>>
>>106456094
whatever floats your boat
the gist is that i live from my bank account, not social (to which i dont even have a right)
>>
File: cover.jpg (787 KB, 3000x3000)
787 KB
787 KB JPG
>>106448121
> &[Sel<'_>]

Good album
>>
>>106452177
comments don't increase readability, they have nothing to do with it.
>>
rust code be like:
>,[]_+-}}"'][]\.?<>?/.,./1[['''"""]]][&*@#^
>>
>>106456122
I believe you, anon. You are a retired multi millionaire who happens to be very passionate about teaching /g/ the importance of C in your free time :)
Very kind and wise.
>>
>>106451952
>I don't care about an illiterate niggers opinion
> still argues

>>106452519
nigger what is a good reason to learn programming then(its gonna be some stupid autistic answer isnt it)
>>
>>106448121
>{:#?}
>>
>>106456309
Who are you quoting?
>>
>>106456314
the Rust programming language
>>
>>106456319
Where did the Rust programming language say {:#?} ?
>>
>>106456337
https://doc.rust-lang.org/std/fmt/
>>
>>106456424
And why are you quoting OP then?
>>
>>106456252
im not teaching anyone
im just swinging my humongous dick around bc i have nothing better to do
oh, and youre very disagreeable people so you deserve to be cut down to size
>>
>>106456512
Good luck, anon. I'm sure you are "cutting down" Rust people one 4chan post at a time :)
>>
>>106456566
I mean he seems to have gotten your goat desu
>>
>>106456579
Oh absolutely, how can I ever recover!
>>
>>106456238
Literal seppletranny projection lmao
See >>106448802 or literally any standard library header implementation
>>
>>106456309
>>106456337
>>{:#?}
Cool, literally exists in C++ std::format.
>>
>>106456441
because he is talking about unreadable rust code
>>
>>106456769
Which part is unreadable
>>
>>106448802
The code snippet you've provided appears to be a mix of C++ and other programming languages, with some identifiers and syntax that are not standard or are fictional. Let's break down the issues and provide a more sane and standard C++ version, focusing on correcting the syntax and identifiers.

### Issues with the Provided Code:

1. **Non-standard Identifiers and Syntax**: Identifiers like ```std::__poo_in_the_loo```, ```gnu::_retarded_snake_case_spam```, and ```nigger_t``` are not standard and seem to be used provocatively. Similarly, ```[[gnu::autism]]``` and ```[[=gnu::IndiansWroteThisCode]]``` are not valid C++ attributes.

2. **Mixing Languages**: The code mixes C++ with elements that seem to belong to other languages (e.g., ```export poo.in.the.loo.durgajeet;```, ```import java.util.ArrayList;```, ```throw panic!^^(@poop);```). C++ does not support this kind of inter-language syntax directly.

3. **Incorrect Use of C++ Keywords and Syntax**:
- ```constexpr consteval constinit const noexcept void std::type_info() operator[](void*& a, boost::benchod::india_t^^ reflexpr _T b)```: This line misuses several C++ keywords and concepts. ```std::type_info``` is a class, not a function you define. ```operator[]``` is a special member function that cannot be defined as you've shown.
- ```throw(std::bad_alloc) new delete stackalloc^^```: This is not valid C++ syntax.

4. **Attribute Syntax**: Attributes like ```[[likely]]```, ```[[unlikely]]``` are used correctly in terms of syntax, but their placement and the conditions they are used with should be scrutinized.

### A More Standard C++ Version:

Let's assume you're trying to define a function that performs some operations based on a condition and handles memory. Here's a simplified, corrected version:
>>
>>106456807
> ```export poo.in.the.loo.durgajeet;```, ```import java.util.ArrayList;```
desu you probably could put this in c++ if you named a module java.util.ArrayList
>>
10 CLS
20 FOR I=0 TO 100
30 PRINT "UR MOM STINKS!";
40 NEXT I
50 PLAY "CDEFGAB"
60 NEW
>>
>>106448802
>Gives up and just starts writing Java mid way through
ok anon you win.
>>
>>106456889

```cpp
#include <iostream>
#include <type_traits>
#include <stdexcept>

template <typename T, typename X>
constexpr void process(void*& a, X b) noexcept(false) {
if constexpr (std::is_same_v<T, X>) {
if (b == 135) {
// Assuming gnu::getopt::Program is a valid type or class
// For demonstration, using a simple new expression
b = new int(135);
delete static_cast<int*>(a);
a = nullptr; // Prevent dangling pointer
} else {
// Handle the else condition
throw std::runtime_error("Some error message");
}
} else {
// Handle type mismatch
throw std::invalid_argument("Type mismatch");
}
}

int main() {
int* a = new int(10);
int b = 135;

try {
process<int>(a, b);
} catch (const std::exception& e) {
std::cerr << "Caught exception: " << e.what() << '\n';
}

return 0;
}
```

### Key Changes:

- Replaced non-standard identifiers with standard C++ types and names.
- Removed inter-language syntax and focused on C++.
- Corrected the use of C++ keywords and syntax.
- Simplified the example to focus on a basic conditional operation and memory handling.

This example is a basic representation and might need adjustments based on your actual requirements and the context in which you're using this code.
>>
>>106456807
>>106457058
Go back
>>
File: C-gigachad-123.jpg (341 KB, 817x1100)
341 KB
341 KB JPG
>>106456566
thats exactly what i do
extremely efficiently if i do say so myself
for instance, this picrel
despite having been used only once or twice
causes untold amounts of seethe among crabs
>>
>>106457239
lmao no one takes c seriously
you dont even have generics or namespaces or modules
you will never be an embedded developer, you are a cs50 skid larping online
>>
>>106457251
>lmao no one takes c seriously
you know whats taken even less seriously?
gregarity fukken arguments lamao
>>
>>106452901
>Value wasn't generic in rust version
>taking v by pointer for some reason when the function is useless when it's not a valid value
>vector& needs an extra deref for no reason (use span)
>checking current every iteration when it's completely superfluous after the first
>typing const auto& instead of just auto&&
>type traits instead of concepts
>still returns a value when one of path elements fail
I rate it C-
That last one is the worst because for avalue v and a path of ["x", 0, "z"] you have no fucking clue if the return is v, v.get("x"), v.get("x").get(0) or v.get("x").get(0).get("y")
>>
>>106448121
Let me guess, you need more?
>>
>>106453394
None of the editors support "tab complete this and put using above in the file" the way they do for rust. Or even rightclick turn into using. Sepples also doesn't have the nice some_namespace::{first_thing, second_thing} notation rust
>>
>>106457346
>Think to myself "C- might be a funny programming language"
>Found out it already exists
Heh.
>>
>>106448121
this is why c++ jobs outnumber rust jobs 50 to 1, and always will
>>
>>106449210
I generally prefer clear names, but I don’t really have a huge issue with them, it’s normally pretty clear what’s going on if it’s being used for iterating indexes or numbers in general. Caveat would be that in languages that let you iterate over list values directly (i.e. for value in list), just use a sensible name.
>>
File: 1751780442947603.jpg (78 KB, 885x498)
78 KB
78 KB JPG
>>106448121
What's wrong with it?
>>
>>106448433
Shit like
>not having a semicolon on last like makes it an implicit return
is just there as a pointless knowledge check, anon
It doesn't make for a good programming language, it doesn't solve any problems yet requires you to know more
>>
>>106460067
It's not pointless, it makes perfect sense. Rust is an expression based language, and the last expression within a block gets returned always.
This is true for if/else blocks, match blocks and also functions.
>>
>>106448315
There is more syntax than logic.
This is just not good language design.
>>
>>106448802
What's funny is that every 3 years the committee adds more syntax, and the committee is literally just boomer language lawyers at this point, all the practitioners have left a long time ago.
>>
>>106457251
>lmao no one takes c seriously

Except for almost all the important software being written in it.
>>
>>106460509
>We've always done it this way!!!
ok babyduck, time to retire
>>
>>106460482
Which parts do you think are not logic
>>
>>106460705
Rust will kill C and C++ just like clojure killed java and common lisp.
OH WAIT



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