Thread 106001388 - /g/ [Archived: 33 hours ago]

Anonymous
7/23/2025, 8:46:40 PM No.106001388
1000279086
1000279086
md5: 35be27f6ba9d6797e124ce2c5651907f🔍
Brutal.
Rust btfod once again.
Replies: >>106001409 >>106001433 >>106001526 >>106001864 >>106002024 >>106002128 >>106002684 >>106003062 >>106003714 >>106003916
Anonymous
7/23/2025, 8:48:35 PM No.106001409
>>106001388 (OP)
there's two jokes here
- that guy primarily uses OCaml, where types are even more complex than this
- that guy for his current job uses C++ which is... lol...
Anonymous
7/23/2025, 8:50:26 PM No.106001433
>>106001388 (OP)
I know nothing about rust
but if that's idiomatic I imagine it can't be that hard to parse once you know what you're doing
Replies: >>106001468
Anonymous
7/23/2025, 8:53:59 PM No.106001468
>>106001433
>I know nothing about rust
it kinda shows
the problem is not whether something can be read or not
but how easy it is
this is brainfuck. a hello world.
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]
>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++
.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.


and this is the same in C
#include <stdio.h>

int main(void)
{
fprintf("hello world\n);
}


both can and have been written by a human
which one would you rather work with?
Replies: >>106001612 >>106001967 >>106006396
Anonymous
7/23/2025, 8:59:28 PM No.106001526
>>106001388 (OP)
ok, but how often are you trying to implement a function as complicated as try_map? Those are the kinds of functions the library implementers spend weeks on and once they're finished, 100,000 programmers will all use it for decades.
Replies: >>106001568 >>106001576
Anonymous
7/23/2025, 9:03:20 PM No.106001568
>>106001526
>try_map
>complicated
such is the power of rust
creating problems out of thin air
Replies: >>106001576 >>106001585 >>106001603
Anonymous
7/23/2025, 9:04:21 PM No.106001576
>>106001568
>>106001526
which is exactly ops picrel's point btw
the absolute state of crabs
Anonymous
7/23/2025, 9:04:38 PM No.106001585
>>106001568
you're being retarded
Replies: >>106001594
Anonymous
7/23/2025, 9:05:49 PM No.106001594
>>106001585
if you exclude syntactical concerns
and the bells and whistles

tell me what goes on in try_map
i want you to write it / say it out loud so that you understand the enormity of this
Replies: >>106001749
Anonymous
7/23/2025, 9:07:14 PM No.106001603
>>106001568
yes, implementing map in a dynamic language like javascript where you just throw shit at the wall and see what sticks is fucking simple. when you want to have the exact same flexibility as javascript while simultaneously getting provable safety, it requires complication in the type system.
Replies: >>106001610 >>106001617 >>106001648
Anonymous
7/23/2025, 9:08:15 PM No.106001610
>>106001603
it's almost as if having you cake and eating it too isn't trivial
Anonymous
7/23/2025, 9:08:31 PM No.106001612
>>106001468
wow that top one looks really user-friendly, I could have a tiny keyboard and still write code
Anonymous
7/23/2025, 9:09:01 PM No.106001617
>>106001603
>provable safety
which goes only as far as static analysis can go without being an impact on the runtime
if only it was a silver bullet, you would at least have a leg to stand on
Replies: >>106001648
Anonymous
7/23/2025, 9:12:28 PM No.106001648
>>106001603
>>106001617
btw
the more you defend and push rust
the less likely it is that it will be refined into something usable
Anonymous
7/23/2025, 9:20:59 PM No.106001718
wow, this entire thread is one asshat with Rust derangement syndrome.
Anonymous
7/23/2025, 9:24:36 PM No.106001749
>>106001594
Not the guy you're originally responding to, and I suppose "complicated" would not have been his best word choice. But I'll describe what's going on here.

try_map is a method over arrays.
It takes as argument a function f that can fail in some way.
If f fails at all, it returns the first error given by f
Otherwise it returns a new array with f applied to all elements over the original array.

Basically it's just map, but it can fail. The complexity comes from the fact that it's generic. What type of array does it apply over? Arrays of any element (T) and any size (N). What type of function can it take as argument? Anything, even a closure that mutates its closing environment. The function returns type R, which can be any kind of "error" data type. Option, Result, something else... doesn't matter. As long as it implements the Try trait.
Replies: >>106001881
Anonymous
7/23/2025, 9:38:03 PM No.106001864
>>106001388 (OP)
what's up with this type system masturbation?
does optimized rust even beat optimized C/C++ with those extra type analysis?
and I'm ignoring compile times.
Replies: >>106001892 >>106002013
Anonymous
7/23/2025, 9:40:04 PM No.106001881
>>106001749
yeah like i said
its unnecessarily complicated
and the complexity emerges from the language
heres an implementation of try_map in c for comparison
int try_map(void *array, int (*function)(void *), size_t elem_size , size_t size)
{
while (size--)
{
int error;
if (error = function(array)) // if non equal to 0, short circuits
return(error);
array -+ elem_size;
}
}


its not bigger that rusts' synopsis alone by much
as for the generic part theres tricks to be played
like name mangling through macros
or encoding the type with the data so that you support heterogenous arrays
or even adding a parameter for your iterator
which you could keep a pointer to within your structures if you wanna be fancy
possibilities are endless
but the complexity then emerges from the machinery
not from the syntax
as it should be
bc otherwise its the definition of fighting the language
thats why i dont like rust and think its a bad product
they had a complex idea with encoding good practices into the synatx but its doesnt mean its good
they offset the job of static analysis to the memory of the user. which is extremely lazy, as a product
Replies: >>106001906 >>106002076 >>106002083 >>106002150 >>106003932
Anonymous
7/23/2025, 9:41:09 PM No.106001892
>>106001864
>does optimized rust even beat optimized C/C++
theyre on par, you can do raw asm with both
and you cannot do faster than asm
Anonymous
7/23/2025, 9:42:10 PM No.106001906
>>106001881
>as a product
*for a product
Anonymous
7/23/2025, 9:48:09 PM No.106001967
>>106001468
Well, the bottom one won't compile...
Replies: >>106001997 >>106006396
Anonymous
7/23/2025, 9:50:42 PM No.106001997
>>106001967
ah shit
i forgot the closing "
as in
printf("hello world");
and in the other code its
array += elem_size
not
array +- size

im baked, indulge me
also thats why testing often is a good practice
Anonymous
7/23/2025, 9:52:12 PM No.106002013
>>106001864
The ideal with all of this is for a program to work as intended if it compiles. The point isn't to try to squeeze out extra performance.
Both Rust and modern C++ paradigms try to strive for zero cost abstractions, which compile to nearly the same thing in many cases. Rust's compiler uses a lot of LLVM plumbing that was made for C++, so that makes sense.
One advantage Rust has over C++ is zero size types. The minimum size of a struct in C++ is one byte.
Replies: >>106002023
Anonymous
7/23/2025, 9:53:16 PM No.106002023
>>106002013
>One advantage Rust has over C++ is zero size types.
???
how do you use em?
Replies: >>106002030
Anonymous
7/23/2025, 9:53:19 PM No.106002024
>>106001388 (OP)
Rust seems like a language you use to masturbate your own ego, not to get the job done.
Anonymous
7/23/2025, 9:54:24 PM No.106002030
>>106002023
>zero size types
they're basically compile time tags afaik
Replies: >>106002041
Anonymous
7/23/2025, 9:55:32 PM No.106002041
>>106002030
and thats the thing:
tags for what if datasize is 0?
curious
Anonymous
7/23/2025, 9:58:23 PM No.106002076
>>106001881
>look how simple C is when you throw out all the type safety
the inner working of the mind of a cnile.
Replies: >>106002086
Anonymous
7/23/2025, 9:59:27 PM No.106002083
>>106001881
shit like this and retards like you are the reason why congress is working on legislation to make C illegal.
Replies: >>106002093
Anonymous
7/23/2025, 9:59:36 PM No.106002086
crab-knife
crab-knife
md5: bf95d7c9762c40910c8c3da8ee913f10🔍
>>106002076
type safety is between your ears, crab
but if you need childproof, then thats what you get i guess
Anonymous
7/23/2025, 10:00:40 PM No.106002093
crown-prince
crown-prince
md5: 665a4a29e027e0032480a298a839c898🔍
>>106002083
>immediate panic upon seeing void *
autism is a hard handicap
Replies: >>106002197
Anonymous
7/23/2025, 10:03:44 PM No.106002128
>>106001388 (OP)
You mean a language with a strong type system that errs towards static dispatch by genericizing behaviors (like C++) requires significant type information?
I mean, how retarded are people? Legitimately. This isn't dynamic dispatch untyped garbage full of implicit casts and conversions here. What do you expect?
Replies: >>106002139
Anonymous
7/23/2025, 10:05:27 PM No.106002139
laughing_caprio_jesus
laughing_caprio_jesus
md5: fb71be94dd793b297523d5db8528e719🔍
>>106002128
>What do you expect?
for it not to look like someone stepped on it
Anonymous
7/23/2025, 10:06:34 PM No.106002150
>>106001881
Anon, you could have at least shown a C++ comparison. Fucking void* isn't generic, and reliance on it over a proper type system is why std::sort in C++ is faster than qsort in C.
Replies: >>106002203
Anonymous
7/23/2025, 10:11:31 PM No.106002190
Also, your code implies that the error type I want is an int error code. What if I want my error to be a string? What if I want it to be a tagged union that has different object types depending on the type of error it is? try_map isn't just generic over the type of the array and the return type of the function, but also over the type of the error.
Anonymous
7/23/2025, 10:11:51 PM No.106002197
>>106002093
just write it in fucking assembly, cnile. that "code" is completely worthless, with zero utility. but you're just so gosh darn proud of it because it exists at the threshold where your intelect is able to comprehend it somewhat.
Replies: >>106002211 >>106002250
Anonymous
7/23/2025, 10:12:21 PM No.106002203
appo-marketing-n
appo-marketing-n
md5: 9fc1d3843f4ea9f46620bdf85e3c7e77🔍
>>106002150
>qsort
lamao
also im too lazy to look over the code. im sure theres more to it than just types
probably a width thats a parameter in one version when the other does name mangling or has dynamic dispatch with width-specific variants for each case
also also
theres quite a few ways to make void * either type safe
or no-cost generic. where you dont use void * but do macro magic force inlines
or generic but at a cost with function pointers
i know you like your types
but i like simple more than i like types (and dont get me wrong, i like em too. but fuck complexity emergent from the framework. id rather deal with a complex machine)
Replies: >>106002375
Anonymous
7/23/2025, 10:13:23 PM No.106002211
overload
overload
md5: 6e0514a8a84e7bb93534fd42881ebdd1🔍
>>106002197
>total meltdown
ywabj
(you will always be jealous)
Anonymous
7/23/2025, 10:14:32 PM No.106002224
can't you omit a lot of that type bs?
Replies: >>106002261
Anonymous
7/23/2025, 10:17:27 PM No.106002250
>>106002197
>because it exists at the threshold where your intelect is able to comprehend it somewhat
Sums up people who write code in C without a valid reason (of which there aren't any anymore, since we entered the era of python on microcontrollers.)
Replies: >>106002275 >>106002280
Anonymous
7/23/2025, 10:18:31 PM No.106002261
>>106002224
>can't you omit a lot of that type bs?
yeah, by switching to c or javascript. no more scary type safety.
Anonymous
7/23/2025, 10:20:19 PM No.106002275
Screenshot from 2025-07-23 22-19-56
Screenshot from 2025-07-23 22-19-56
md5: 94c896ede67371c5a1c77fc49685823f🔍
>>106002250
>Sums up people who write code in C without a valid reason (of which there aren't any anymore, since we entered the era of python on microcontrollers.)
*wet fart noises*
what do you think gpgpu shit is written in?
>omf but cuda
rly? have you looked at the actual code?
https://github.com/NVIDIA/cuda-samples/blob/master/Samples/5_Domain_Specific/Mandelbrot/Mandelbrot_cuda.cu
Replies: >>106002292 >>106002303
Anonymous
7/23/2025, 10:20:45 PM No.106002280
>>106002250
>when your industrial control system does a mark-and-sweep for half a second
Anonymous
7/23/2025, 10:22:04 PM No.106002292
>>106002275
tl;dr
Replies: >>106002309
Anonymous
7/23/2025, 10:22:44 PM No.106002303
>>106002275
this code doesnt need types whats wrong ywith ou
Replies: >>106002336
Anonymous
7/23/2025, 10:23:41 PM No.106002309
>>106002292
its c
without solid c skills dont even try gpgpu bc its C only now you work with 3 memory pools with different properties each, and everything is asynchronous. kindof, depends on the exact model of your card to make things even more spicy
Replies: >>106002328 >>106002359
Anonymous
7/23/2025, 10:25:52 PM No.106002328
>>106002309
>its c
template <class T>


nigga you dumb as hell.
Replies: >>106002341
Anonymous
7/23/2025, 10:26:22 PM No.106002336
>>106002303
its not abt types its about c
otherwise in prod code you will need to remember what is where because given how it all w orks your data will be interleaved in arrays
and youre gonna have to keep track of everything separetely in your host machine because you communicate with your gpu via buffers
and with interleaved data your returns are gonna be the equivalent of void *'s

in gpgpuland theres no concession towards gay homo concepts like 'type safety'
everything is basically a void *
you better keep your ducks in a row
Anonymous
7/23/2025, 10:27:23 PM No.106002341
>>106002328
i refuse to acknowledge anything that was released after C99
Replies: >>106002755
Anonymous
7/23/2025, 10:29:02 PM No.106002359
>>106002309
tl;dr
Replies: >>106002388
Anonymous
7/23/2025, 10:30:15 PM No.106002375
>>106002203
>i like simple more than i like types
You might like Bash then. Only one data type: string.
Replies: >>106002389 >>106002393 >>106002411 >>106002419
Anonymous
7/23/2025, 10:31:47 PM No.106002388
crab-stew
crab-stew
md5: bd3bc85129997379b1593a9d29764679🔍
>>106002359
no bathrooms for fake women at nvidias
rust is persona non grata
Replies: >>106002395
Anonymous
7/23/2025, 10:31:51 PM No.106002389
>>106002375
string is an unnecessary abstraction over bits
Anonymous
7/23/2025, 10:32:39 PM No.106002393
>>106002375
one might say it's stringly-typed
Replies: >>106002758
Anonymous
7/23/2025, 10:32:51 PM No.106002395
>>106002388
tl;dr
Anonymous
7/23/2025, 10:34:56 PM No.106002411
Screenshot from 2025-07-23 22-34-44
Screenshot from 2025-07-23 22-34-44
md5: c8769e9edd142839ee5f2af99f775445🔍
>>106002375
youre right
i use it and i like it
im not good at it, by no means
but i manage to write whatever i need
rn i run a bash script to control my gpus fans
i needed the functionality of seeing current temp, max temp and to control the fan speed
Anonymous
7/23/2025, 10:35:41 PM No.106002419
>>106002375
cap.
bash has hashmaps, arrays and integers too.
Anonymous
7/23/2025, 11:03:38 PM No.106002684
>>106001388 (OP)
People be talking about C++ being ugly and bloated, then come up with this shit as a replacement?
Yeah nah
Replies: >>106002753
Anonymous
7/23/2025, 11:11:08 PM No.106002753
>>106002684
it's clear that the rust "council" sees C++ as an aesthetic goal. of course C++ is now copying rust, so we're only going to see new heights of autistic nonsense with some of the worst syntax imaginable.
Anonymous
7/23/2025, 11:11:26 PM No.106002755
>>106002341
yes but full compiler support is still limited. 26 years later. you basically get what overlaps with c++ and thats it
Anonymous
7/23/2025, 11:12:18 PM No.106002758
>>106002393
heh
Anonymous
7/23/2025, 11:41:58 PM No.106002983
Rust "people" make me not like or want to use Rust. Simple as.
Anonymous
7/23/2025, 11:49:29 PM No.106003062
67432864328
67432864328
md5: 4d402d4cbb79c963e3540da6aef7871d🔍
>>106001388 (OP)
In C# it's just
Anonymous
7/24/2025, 1:10:24 AM No.106003714
>>106001388 (OP)
disgusting syntax character vomit
i continue to maintain that the only person who knows how to design good programming languages is Anders Hejlsberg
Anonymous
7/24/2025, 1:16:52 AM No.106003762
Bros you're bashing a language when you're barely writing a proper sentence in English. What's wrong with you fucking autists?
Replies: >>106003880 >>106003894
Anonymous
7/24/2025, 1:32:12 AM No.106003880
>>106003762
go back, phoneposting fag
Anonymous
7/24/2025, 1:35:17 AM No.106003894
>>106003762
Rust "bashers" are third worlders that got filtered by the BC. I rarely ever see a pajeet using Rust and it's by design.
Replies: >>106003902 >>106003908 >>106003913
Anonymous
7/24/2025, 1:36:33 AM No.106003902
>>106003894
real languages dont have symbols in types
Anonymous
7/24/2025, 1:37:19 AM No.106003908
>>106003894
Not a jeet but I hate rust because only the faggiest of faggots seem to heavily endorse and advocate for it. I would rather use D. I don't even care if rust is good or not; but I do know that only faggots seem to endorse it.
Anonymous
7/24/2025, 1:37:56 AM No.106003913
>>106003894
nah. we still have our dicks. makes a big difference apparently
Anonymous
7/24/2025, 1:38:11 AM No.106003916
>>106001388 (OP)
What i hate about modern languages is that they all focus on how code shouldn't interact with other code rather than how it should.
Anonymous
7/24/2025, 1:39:44 AM No.106003932
>>106001881
> array -+ elem_size;
>-+
what the fuck is that?
Replies: >>106003996
Anonymous
7/24/2025, 1:47:31 AM No.106003996
>>106003932
NOP
Anonymous
7/24/2025, 7:22:51 AM No.106006396
>>106001468
>>106001967
>this is so clear, it can be written and read by a human
>it's incorrect though
AHHAHAHAHAHAHAHAHAHA
NICE ONE FAGGOT