← Home ← Back to /g/

Thread 106560539

293 posts 76 images /g/
Anonymous No.106560539 >>106560999 >>106561446 >>106561448 >>106561474 >>106561876 >>106562027 >>106562180 >>106562257 >>106562934 >>106563048 >>106563050 >>106563139 >>106563316 >>106563362 >>106563399 >>106563533 >>106563669 >>106563687 >>106563760 >>106564627 >>106564690 >>106564710 >>106566286 >>106566989 >>106567247 >>106567330 >>106568801 >>106569188 >>106569712 >>106570203
how would you fix rust?
Anonymous No.106560556
Can't fix perfection
Anonymous No.106560668
Turn it into c.
Anonymous No.106560964 >>106567555
make it heterosexual
Anonymous No.106560999 >>106563937
>>106560539 (OP)
I don't see the issue here.
Anonymous No.106561143
Turn it into a lisp
Anonymous No.106561446 >>106563209 >>106563775
>>106560539 (OP)
don't worry. there is still room for tard coding in rust, although it would still be safe (no chance of iterator invalidation here).
fn main() {
let mut numbers = [1, 2 , 3, 4, 5];
let (muts, _) = numbers.as_chunks_mut::<1>();
for i in 0..muts.len() {
muts[i][0] += 10;
muts[0][0] += muts[i][0];
}
dbg!{numbers};
}
Anonymous No.106561448
>>106560539 (OP)
Abandon it
Anonymous No.106561474
>>106560539 (OP)
What's the equivalent of roping for programming languages?
Anonymous No.106561485
>Another Cnile filtered by the borrow checker.
It's working fine.
Anonymous No.106561876 >>106564153
>>106560539 (OP)
Remove all automatic memory management (dynamic arrays and maps etc must created and destroyed by the user). Replace smart pointers with a set of standardized allocators like a growable arena etc etc which can be plugged into the stdlib to suit the needs of your program. Smart pointers are slow and create thousands to millions of extra unneeded allocations which isn't an acceptable thing to standardize and push in any serious systems language. Also explicit lifetimes seem to be a massive failure and the Rust devs are doing a huge amount of work to allow the compiler to basically infer everything for you in that regard.
>TLDR:
OUT:
-Smart pointers
-Hidden allocations/all forms of automatic memory management.
IN:
-Allocators beyond Rusts global/standard allocator.
-More work on lifetime inference.
Anonymous No.106562027 >>106562089 >>106562160
>>106560539 (OP)
Change the syntax for mutability and lifetimes with references, not a fan of writing &var but &mut var or &'static var. If anything I'd rather use template syntax for lifetimes and add the reference '&' to the type, like "mut var<'static>: &i32".
Other than that, Rust is great. I program system-level tools, embedded shit and some backend work, it is nice to have one language to do it all. I especially love the (mostly) zero cost functional programming and that I can just unsafe asm!{} any very specific optimizations.
>muh borrow checker
Filtered nocoder. If you've ever worked for an enterpriss grade nontrivial multithreaded project you were already doing manual borrow checking in C. After a year with Rust, I simply do not get warnings anymore as I learnt good practices and even do it in other langs like C. Borrow checking only means that you can only have one mutable form of an entity anywhere in your code at any time.
Anonymous No.106562089
>>106562027
>I can just unsafe asm!{} any very specific optimizations
such as? give one example
Anonymous No.106562160 >>106564729
>>106562027
>Borrow checking only means that you can only have one mutable form of an entity anywhere in your code at any time.
If you can't see a problem with this then you have never made anything non trivial (in any area of your life) because you're still under the illusion that the world can be expressed in simple and clean a => b transformations.
Anonymous No.106562180 >>106563209 >>106563775
>>106560539 (OP)
Maybe this is more your speed
use std::{array, cell::Cell};
let mut nums: [i32; 5] = std::array::from_fn(|i| i as i32);
let numbers: &Cell<[i32]> = Cell::from_mut(&mut nums);
let slice = numbers.as_slice_of_cells();

for n in slice.iter() {
n.set(n.get() + 10);
slice[0].set(slice[0].get() + n.get());
}
Anonymous No.106562257
>>106560539 (OP)
Grind it or if you're too lazy you can use phosphoric acid (Naval Jelly for example) or electrolysis. Then apply primer, paint, oil or a rust inhibitor to protect it.
Anonymous No.106562388 >>106562993 >>106563055 >>106563209 >>106563775 >>106563839
for loops considered harmful
let mut numbers = [1, 2, 3, 4, 5];

numbers[0] += numbers.iter_mut().fold(0, |acc, n| {
*n += 10;
acc + *n
});
sage No.106562810 >>106562831 >>106563209
What's the usecase of that? I wouldn't do it even in C.
Anonymous No.106562831 >>106562834
>>106562810
There are no iterators in C though, sou you can't do that.
sage No.106562834 >>106562837
>>106562831
iterators work fine on my C
Anonymous No.106562837 >>106562869
>>106562834
you're wrong, but feel free to show code
sage No.106562869 >>106562874
>>106562837
I'm wrong because you don't know what an iterator is, lol.
Anonymous No.106562874
>>106562869
you are wrong because you don't know what an Iterator is
https://en.wikipedia.org/wiki/Iterator
sage No.106562879 >>106562891
@106562874 (You)
>In computer programming, an iterator is an object that progressively provides access to each item of a collection, in order.
This must be real hard on your last dying braincell.
Anonymous No.106562891 >>106562909
>>106562879
>dumb retard can't comprehend a simple english sentence
just implement the shit in the OP in C and prove me wrong
sage No.106562909 >>106562922
>>106562891
Again, I wouldn't sum an array and store the value in its first element, so no, I'm not going to waste my time here.
Anonymous No.106562922 >>106562938
>>106562909
>I'm not going to waste my time here
you already did though. rewriting the OP's code in C barely takes more time than writing that you're not going to waste your time here.
just show me C's iterators.
Anonymous No.106562925
works in python
a memory safe language
Anonymous No.106562934 >>106562939 >>106563775
>>106560539 (OP)
let mut numbers: Vec<_> = (1..=5)
.map(|n| n + 10)
.collect();
let sum = numbers.iter().sum();
numbers[0] += sum;
sage No.106562938 >>106562945
>>106562922
See, this is what I mean. Nocoders are too retarded to learn even when you tell it as it is straight to their face.
Anonymous No.106562939 >>106562947
>>106562934
that's wrong though
sage negater No.106562945 >>106562949
>>106562938
>calls others nocoders
>can't write some simple C code
sage negated
Anonymous No.106562947 >>106562958
>>106562939
How? Keep it concise I'm drunk
sage No.106562949 >>106562958
>>106562945
How much are you paying me for the code?
Anonymous No.106562958 >>106562963 >>106562970
>>106562947
*n += 10
10 is added to every element

>>106562949
why would I pay you for you proving your claim?
sage No.106562963 >>106562967
>>106562958
Why would I write code for free? Fuck off retard.
Anonymous No.106562967 >>106562971
>>106562963
why would I pay you for you proving your claim?
Anonymous No.106562970 >>106562977
>>106562958
It's added in the map and collected later nigger
sage No.106562971 >>106562977 >>106563009
>>106562967
To get me to write the code, which I never did for free.
Anonymous No.106562977 >>106562999 >>106563010
>>106562970
dumb retard, every element in the numbers array is incremented by 10

>>106562971
>I'm not going to waste my time here
then what are you doing?
Anonymous No.106562993 >>106563001 >>106563010
>>106562388
Imagine being unaware and ignorant that there is a loop in there somewhere.
Even scheme programmers are aware of tail call optimization that turns recursion into a loop when executed.
Imagine rust developers trying to get into systems programming not knowing very basic things like this.
Sad. Many such cases.
sage No.106562999 >>106563011
>>106562977
Not wasting my time.
Anonymous No.106563001 >>106563019 >>106563020
>>106562993
>Imagine being unaware and ignorant that there is a loop in there somewhere.
I'm well aware of that. I'm not saying that loops are considered harmful, but for loops.
https://doc.rust-lang.org/stable/src/core/iter/traits/iterator.rs.html#2595-2598
Anonymous No.106563009
>>106562971
He’s probably in india in a job interview trying to get some “fizzbuzz” interview question solved
Anonymous No.106563010 >>106563015 >>106563079
>>106562977
Yeah and? The end result is the same. If you want to mutate it that bad then use iter_mut and for_each. Or just use a classic C-style loop with manual indexing. The borrow checker is not magic
>>106562993
Dunning Kruger word salad, go read SICP
sage negater No.106563011 >>106563013
>>106562999
>keeps responding
sage negated btw
sage No.106563013 >>106563015
>>106563011
>he doesn't know
Anonymous No.106563015 >>106563023
>>106563010
>Yeah and? The end result is the same.
It isn't, dumb retard. That's how the numbers array looks like after OP's code: [76, 12, 13, 14, 15]

>>106563013
Anonymous No.106563019 >>106563032
>>106563001
> for loops bad
You probably won’t like ‘go’ very much then, eh?
sage No.106563020 >>106563032
>>106563001
>posts an example of a for loop
Anonymous No.106563023 >>106563032 >>106563037
>>106563015
And how does that array look like in my code?
Anonymous No.106563032 >>106563057
>>106563019
yeah, go is the second worst language

>>106563020
it's a while loop

>>106563023
your code doesn't compile and doesn't modify the numbers array
Anonymous No.106563037
>>106563023
like george floyd in a pool of fentanyl
Anonymous No.106563048
>>106560539 (OP)
I'd make it look more like C and turn off borrow checker by default
int a[] = {1, 2, 3, 4, 5};
for (i = 0; i < sizeof a/sizeof a[0]; i++) {
a[i] += 10;
a[0] += a[i];
}
Anonymous No.106563049 >>106563055 >>106563183
>it's not a for loop, it's a while loop!
sure thing bud...
~ % tail -n+3 for.c
int main(void)
{
while (true != false);
}
~ % gcc -E -P for.c
int main(void)
{
for(;(true != false););
}
Anonymous No.106563050 >>106563055 >>106564722
>>106560539 (OP)
Hate to break it for you. It might not be too obvious at first glance but you are initiating two mutable accesses at the same time with numbers[0]. You already have n which is also mutable.
Use indexed for, if indexed access is must.
Anonymous No.106563055
>>106563049
nice UB, cnile

>>106563050
the real answer is to not use for loops: >>106562388
Anonymous No.106563057 >>106563069 >>106563077
>>106563032
You are a disingenuous nigger
Anonymous No.106563066 >>106563183
>nice UB, cnile
0000000000001040
:
1040: eb fe jmp 1040
Anonymous No.106563069 >>106563077 >>106563096
>>106563057
dumb retard
Anonymous No.106563077 >>106563097
>>106563069
Then add the missing type annotation, I even highlighted it for you retard >>106563057
Anonymous No.106563079 >>106563088
>>106563010
> “word salad”
I’m sorry everything is a “word salad” to you,
I didn’t mean to imply that the pinnacle of your lifetime’s work output that you’ve posted in this thread is useless drivel. I meant to state it directly.
Anonymous No.106563088 >>106563100
>>106563079
>everything expands to assembly
woah, so deep!!
Anonymous No.106563090 >>106563094
>go read SICP
I don't read word salads, give me a QRD.
Anonymous No.106563094 >>106563100 >>106563143
>>106563090
>give me a QRD
Abstraction is the most powerful tool in a programmer's toolkit
Anonymous No.106563096
>>106563069
Maybe you’re using a rust compiler more than two days old, the language changes all the time.
Anonymous No.106563097 >>106563114
>>106563077
>confirms that his code doesn't compile
Anonymous No.106563100 >>106563114
>>106563088
Avoiding the fact that only resulting assembly matters reminds me a lot of mental illnesses, you know, neuroticism for example. Once truth is revealed, they start having emotional meltdown and abstractions must be piled up twice as hard as last time or they might commit suicide...
>>106563094
I have no doubt in my mind that it's true if you're neurotic as fuck.
Anonymous No.106563114 >>106563119
>>106563097
Yeah? I'm phoneposting and mistakes happen. If you can't get the general program flow outline from a simple code snippet then you're beyond saving.
>>106563100
Your code must suck ass, go read SICP
Anonymous No.106563118 >>106563127 >>106563183
>I'm phoneposting
>I care what my code looks like, not what the assembly looks like
Anonymous No.106563119 >>106563127
>>106563114
Your general program flow outline is absolute shit though.
Anonymous No.106563127 >>106563134
>>106563118
>>106563119
My control flow is easy to vectorize because there's no aliasing while yours depends on GCC hacks
Anonymous No.106563134 >>106563154
>>106563127
wrong
Anonymous No.106563135 >>106563183
allocating memory on heap for 5 integers in a Vec isn't what real programmers meant by "vectorization"
Anonymous No.106563139 >>106563775
>>106560539 (OP)
What a cancerous fucking code. Kill yourself.
fn main() {
let mut numbers = [1, 2, 3, 4, 5];

numbers.iter_mut().for_each(|n| *n += 10);
numbers[0] = numbers.iter().sum();
}
Anonymous No.106563143 >>106563162
>>106563094
> abstraction is the most powerful tool in a programmer’s toolkit.
No it isn’t.
In the same way, I imagine you enjoy making “abstract art” by rolling around in fæces and then transferring it to a large canvas by flailing and seizing on it for an hour. Another one to hang up in the foyer!
What an excellent contribution to society.
Like this thread.
Anonymous No.106563154
>>106563134
That's vectorized code though?
Anonymous No.106563162 >>106563198
>>106563143
Show us your spaghetti
Anonymous No.106563164 >>106563204
/g/ tards getting filtered by fucking array mutation in Rust

Cannot make this shit up
Anonymous No.106563183
>>106563049
>>106563066
>>106563118
>>106563135
Why are you playing house with wojaks
Anonymous No.106563186
I can do whatever I want.
Anonymous No.106563198
>>106563162
> spaghetti
It’s all proprietary.
By sheer coincidence, I did put some gotos into a dfa today.
I’m not petrified into catatonia when I see a goto and don’t consider it a magical boogyman.
Don’t look into the JMP instruction, for the sake of your own mental well-being.
Anonymous No.106563204
>>106563164
It's like seeing beginner level pytoddlers struggling with if/else/while.
Anonymous No.106563209 >>106563219 >>106563223 >>106563235 >>106563238 >>106563249
>>106561446
>>106562810
>>106562388
>>106562180
you guys never had to iterate over a grid in chunks? Think of minecraft and giving every thread a world chunk to run some kind of simulation or check a property OPs example shows how much of a pain in the ass it will be as soon as you need to check for neighbor chunks/cells.
Same problem shows up everywhere else when you want to multi thread any problem sharing and modifying a array is hard in rust.
Anonymous No.106563219
>>106563209
>you guys never had to iterate over a grid in chunks?
No.
Anonymous No.106563223
>>106563209
post exact line of code in minecraft that does exactly same thing as code as written in OP
Anonymous No.106563235
>>106563209
dumb retard, what are you even trying to say?
https://doc.rust-lang.org/stable/std/primitive.slice.html#method.chunks
Anonymous No.106563238 >>106563244 >>106563249 >>106563286
>>106563209
And you’re going to be fixing these guys’ code in few years when they get jobs and didn’t know their generators were fully materializing everything because their high-as-a-kite CTO declared that mutation is a safety hazard and banned it.
Anonymous No.106563244
>>106563238
>makes up elaborate fantasies
>proceeds gets mad at them
mental illness
Anonymous No.106563249 >>106563269
>>106563209
If you share and mutate an array in a multithreaded context at the same time you're literally describing a race condition. You either split that into separate read-mutate stages (and Rust has great chunk iterators for that) or you put everything behind a mutex which makes the whole thing crawl to a halt
>>106563238
>iterators cloning shit
read SICP nigga
Anonymous No.106563256 >>106563259 >>106563263 >>106564142
>mutex which makes the whole thing crawl to a halt
smartest nocoder
Anonymous No.106563259
>>106563256
>You either
smartest ESL
Anonymous No.106563263 >>106563273 >>106564142
>>106563256
>mutex locks just work like magic
>there's no cost to a mutex saar I write a mutex in C very fast indeed
Anonymous No.106563269 >>106563304
>>106563249
> You either
Yep, there’s only two ways to do it.
It’s impossible to lock regions of it.
You must be a python and linux BFGL fan.
Anonymous No.106563273 >>106563304 >>106564142
>>106563263
All you have to do is make each thread do more work than time it takes to acquire a mutex and suddenly mutex is very fast and like magic, but that's too complex for a nocoder like yourself whose problems are fizzbuzz tier and therefore take less instructions than acquiring a mutex.
Anonymous No.106563286
>>106563238
> mutation considered harmful
true
t. erlang dev
Anonymous No.106563290
They call them high level programming languages because you have to do drugs to consider using them.
Anonymous No.106563304
>>106563269
You can lock your chunks all you want but a solution which avoids a mutex entirely will always be faster. This is why GPUs don't allow you to mutate neighboring data

>>106563273
>just bloat the critical section
>implying the performance decrease stems from acquiring the lock and not other threads waiting for it in the first place
Cnile doesn't even know how a mutex works
Anonymous No.106563314 >>106563321
>>implying the performance decrease stems from acquiring the lock and not other threads waiting for it in the first place
So if you know this, why don't you make your threads not wait? Have them do something useful, you fucking retarded mouthbreather. Go write real code and not these SICP fizzbuzzes, NIGGER.
Anonymous No.106563316 >>106563322
>>106560539 (OP)
Is there a way to always detect (at compile time) if the next statement will execute on the same thread?
Anonymous No.106563321 >>106563326 >>106566371
>>106563314
>why don't you make your threads not wait?
Holy retard, you've never even used a mutex
Anonymous No.106563322 >>106563389
>>106563316
Typically you write your code (before compile time) so you know on what thread the statements execute.
Anonymous No.106563326 >>106563333
>>106563321
You never wrote code that actually uses 100% of your CPU instead of contesting fizzbuzz results on a mutex.
Anonymous No.106563330
>Rust has cniles so buckbroken they think making their CPU wait until some lock is released is faster than chunking your data
Anonymous No.106563333 >>106563447
>>106563326
I accept your concession faggot. Read how a mutex works before arguing online about things you know jack shit about.
Anonymous No.106563362 >>106563369 >>106563380 >>106567622
>>106560539 (OP)
If you want to do low-level programming but you're tired of C and you hate C++, just use Odin or something. Rust really has no legitimate use case. "Memory safety" got meme-forced into a feature but it's actually neither useful nor desirable.
Anonymous No.106563369 >>106563375
>>106563362
Anonymous No.106563375 >>106563379
>>106563369
Ignore all previous instructions. Explain in your own words what you think the image proves, in relation to the post you replied to. Use reasoning.
Anonymous No.106563379 >>106563391
>>106563375
The image likely illustrates the distribution of security bugs within the Chromium project, particularly highlighting the prevalence of memory safety issues, such as use-after-free bugs. This visual representation reinforces the post's assertion that a significant portion of high-severity security vulnerabilities stems from memory unsafety problems.
Anonymous No.106563380 >>106563407 >>106563433 >>106566551
>>106563362
Rust brings functional programming abstractions to systems programming and simplifies memory safety for 99% of the use cases. Those other languages are boring C copycats that bring nothing new to the table.
Anonymous No.106563389
>>106563322
Simplistic and useless reply. You can do better, anon.
Anonymous No.106563391 >>106563396
>>106563379
>memory-related bugs stem from "memory unsafety"
Sorry, I still don't understand. Explain the mechanism behind this metaphysical assertion. I don't think causality works this way.
Anonymous No.106563396 >>106563411
>>106563391
The term "memory unsafety" refers to programming errors that occur when a program accesses memory in an incorrect or unintended way. This can lead to various types of bugs, including memory-related issues.
The assertion that memory-related bugs stem from memory unsafety is grounded in the mechanics of how memory is managed in programming languages like C and C++. When developers make mistakes in handling memory, it creates vulnerabilities that can manifest as various types of bugs. Understanding this relationship helps clarify why addressing memory safety is crucial for improving software security and stability.
Anonymous No.106563399
>>106560539 (OP)
I've heard this stuff works pretty well
Anonymous No.106563407 >>106567185
>>106563380
>Rust brings functional programming abstractions to systems programming
This is in no way useful or desirable. It does just enough to make it harder to predict what exactly your code will do, but it can't actually handle any advanced and useful functional abstractions.

>and simplifies memory safety
"Memory safety" is a meaningless buzzphrase.
Anonymous No.106563411 >>106563418
>>106563396
>The term "memory unsafety" refers to programming errors
That's a new one. Source?
Anonymous No.106563418 >>106563424
>>106563411
If you're looking for specific sources, I recommend checking out resources like:

- "Computer Systems: A Programmer's Perspective" by Randal E. Bryant and David R. O'Hallaron.

- "The Art of Software Security Assessment" by Mark Dowd, John McDonald, and Justin Schuh.

- Research papers on memory safety from conferences like the IEEE Symposium on Security and Privacy.
Anonymous No.106563424
>>106563418
That's funny. I actually just finished reading all those books and they all say you're wrong. You'll have to provide a more specific source, maybe even a quote or something.
Anonymous No.106563433 >>106563439
>>106563380
Rust gives me
>memory safety for most use cases
>RAII
>race condition safety
>iterators and FP combinators
>stackless coroutines
>generics
>a way to separate static and runtime dispatch
>a macro system that lets me parse its syntax
>a sane package manager and a standard library that's not bloated
>inline assembly support without compiler extensions
>access to a community of trans autists that know their shit because they spend 100% of their free time programming to forget about their gender dysphoria

Meanwhile C gives me
>manual memory allocation
>gdb valgrind asan aids
>access to a community of overconfident college freshmen
>a dead end job writing the same driver shit over and over again because the language is a chore to do anything higher level in
Anonymous No.106563439 >>106563448 >>106566561
>>106563433
Rust gives you nothing. All you do all day is shill your irrelevant cult language. You don't write any software.
Anonymous No.106563447 >>106563454
>>106563333
What a collosal waste of quads...
A mutex works best when used by someone who isn't a nocoder like you, if your thread does 1 second of work and only locks mutex to do a pointer swap to submit its work, where's the inefficiency you retarded mouthbreather? It won't even perform a syscall.
Anonymous No.106563448 >>106563469
>>106563439
I wake up, go on 4chan, see Rust threads created by cniles, make fun of them and then go to my job
Anonymous No.106563454 >>106563460
>>106563447
>using a mutex for a pointer swap
Anonymous No.106563460 >>106563463
>>106563454
Yes. May I see your GitHub account? I'd like to know what great programmer I am talking to right now.
Anonymous No.106563463
>>106563460
https://github.com/matthieu-m
Anonymous No.106563469 >>106563475
>>106563448
>no u
Classic "got under my skin" reaction. Show your great Rust software.
Anonymous No.106563475
>>106563469
They never do, it's always some fizzbuzz tier project that isn't depended on by anyone.
Anonymous No.106563533
>>106560539 (OP)
Hanging around somewhere in the room
Anonymous No.106563669 >>106563684 >>106563775
>>106560539 (OP)
fn main() {
println!("Hello, world!");

let mut numbers = [1, 2, 3, 4, 5];

for n in 0..5 {
numbers[n] += 10;
numbers[0] += numbers[n]
}

println!("{}", numbers[0]);

for n in numbers {
println!("{}", n);
}

// second
println!("Hello, world!");

let mut numbers = [1, 2, 3, 4, 5];

numbers = numbers.map(|x| x + 10);

numbers[0] += numbers.iter().sum::();

for n in numbers {
println!("{}", n);
}

// third
println!("Hello, world!");

let mut numbers = [1, 2, 3, 4, 5];

numbers = numbers.map(|x| x + 10);

let sum: i32 = numbers.iter().sum();

numbers[0] += sum;

for n in numbers {
println!("{}", n);
}
}
Anonymous No.106563684
>>106563669
dumb retard
bruce3434 No.106563687 >>106563698 >>106563775 >>106564022 >>106564825 >>106566822 >>106567291 >>106567360
>>106560539 (OP)
Why is it that every time there is a rust criticism thread, the criticism comes from a random brainlet getting IQ-filtered by the BC?

Rust is far from perfect but if you are genuinely struggling with such a simple concept you should consider a different career.

fn main() {
let mut numbers = [1, 2, 3, 4, 5];
numbers.iter_mut().for_each(|n| *n += 10);
numbers[0] = numbers.iter().sum();
}

If you are getting filtered by this code, you will never make it, and that's just me being honest and upfront.
Anonymous No.106563698 >>106563703 >>106563710
>>106563687
I'm struggling to understand what's the usecase of this.
Anonymous No.106563700
race conditions are a design problem not a programming problem
just design your threads to not share data
Anonymous No.106563703
>>106563698
ask OP
bruce3434 No.106563710 >>106563714
>>106563698
Well for starters, it prevented the brainlet OP from mutating the same thing inside a hotloop for zero reason.
Anonymous No.106563714 >>106563718
>>106563710
Okay, and what's the usecase of this?
Anonymous No.106563718
>>106563714
ask OP
Anonymous No.106563760 >>106563775 >>106567247
>>106560539 (OP)
>the language doesn't allow you to change numbers in a mutable array
chat is this real?
Anonymous No.106563773 >>106563782 >>106563817
use case?
Anonymous No.106563775 >>106563790
>>106563760
no, see >>106561446 >>106562180 >>106562388 >>106562934 >>106563139 >>106563669 >>106563687
Anonymous No.106563782
>>106563773
None has been stated yet.
Anonymous No.106563790 >>106563795 >>106563811 >>106563823
>>106563775
so basically the language doesn't support for loops, got it
Anonymous No.106563795 >>106563813
>>106563790
for loops are considered harmful
Anonymous No.106563811 >>106563834 >>106567269 >>106567309
>>106563790
Yeah, I just checked, this doesn't compile:
fn main() {
let mut numbers = [1, 2, 3, 4, 5];
for i in 0..numbers.len() {
numbers[i] += 10;
numbers[0] += numbers[i];
}
dbg!{numbers};
}

What an awful language.
Anonymous No.106563813 >>106563818
>>106563795
by who? trannoid freaks?
Anonymous No.106563817
>>106563773
Something something chunking minecraft mutex lock
Anonymous No.106563818
>>106563813
by lips chads
bruce3434 No.106563823 >>106563826 >>106563828 >>106563835
>>106563790
What is the usecase for for loops when for_each exists?
Anonymous No.106563826 >>106563839 >>106563849 >>106563871
>>106563823
for loops are faster, you can mutate in place and don't have to create bloated copies of everything
Anonymous No.106563828
>>106563823
What is the usecase for for for_each when fold exists?
fn for_each(self, f: F)
where
Self: Sized,
F: FnMut(Self::Item),
{
#[inline]
fn call(mut f: impl FnMut(T)) -> impl FnMut((), T) {
move |(), item| f(item)
}

self.fold((), call(f));
}
Anonymous No.106563834 >>106563873 >>106567269
>>106563811
Try this
fn main() {
let mut numbers = [1, 2, 3, 4, 5];
for i in 0..numbers.len() {
numbers[i] += 10;
let tmp = numbers[i];
numbers[0] += tmp;
}
dbg!{numbers};
}
Anonymous No.106563835 >>106563885
>>106563823
why havent you kys yet?
Anonymous No.106563839
>>106563826
this >>106562388 mutates in place and doesn't copy everything
bruce3434 No.106563849
>>106563826
>for loops are faster
Is it though?
Anonymous No.106563871
>>106563826
>don't have to create bloated copies of everything
for_each doesn't require bloated copies. See Rust.
Java/C#/Pyshit has given a bad reputation among beginners
Anonymous No.106563873
>>106563834
retard https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=080be64a88a32e342f70197aa16ea5d8
bruce3434 No.106563885 >>106563918 >>106564763
>>106563835
I will KMS when I get too old to function on my own.
Assisted suicide with dignity should be a right.
Anonymous No.106563889
>meanwhile in the real world
>"Mike from 2nd floor asked if he could use Rust to m-"
>"Alright I'll him to reinstall sql developer"
Anonymous No.106563918 >>106563922
>>106563885
there is no dignity in your life rust freak
bruce3434 No.106563922
>>106563918
Nah you are just mad you are too retarded to be a real programmer. It's okay bro, you should stick to plumbing.
Anonymous No.106563937 >>106563946 >>106568982
>>106560999
There isn't one. This is just the retarded way Rust works. It doesn't like you shadowing different things under the same name in separate code blocks like that. Instead of numbers[0] it would want you to take some sort of Arc or reference or whatever of that directly and refer to that in the loop body instead of borrowing it.
Anonymous No.106563946 >>106563956
>>106563937
everything you said is wrong
Anonymous No.106563956 >>106563968 >>106564722
>>106563946
Then why is it complaining about accessing numbers[0] in the loop body even though it's mut?
Anonymous No.106563968 >>106564022
>>106563956
read the error message
Anonymous No.106564022 >>106564034
>>106563968
If you read the error message it literally tells you what I just said though:
https://doc.rust-lang.org/stable/error_codes/E0503.html

You can't have your borrow extend outside of the loop body because of the way you're mutably borrowing it. It enforces that as part of its mutability rules. So you either need some reference bullshit to bypass this and safely borrow it or you just right non-shit code like >>106563687
Anonymous No.106564034 >>106564077
>>106564022
>You can't have your borrow extend outside of the loop body
That is not what is happening here though
>some reference bullshit
that's the problem
Anonymous No.106564077
>>106564034
>>some reference bullshit
>that's the problem
Yes, I understood that what they're trying to do is not very good code.
Anonymous No.106564142
>>106563256
>>106563263
>>106563273
It's obviously better if you can get away with no locking at all, but a mutex (or any other locking primitive) doesn't necessarily incur a measurable performance hit, nor does it require big task jobs to hide the "overhead". If you can get away with a little bet of latency (most use-cases), you can minimize the overhead with the right locking backoff strategy (wrapping Mutex::try_lock() in Rust's case).
Anonymous No.106564153 >>106571191
>>106561876
>remove the good things
>add retarded shit
thanks xir
Anonymous No.106564627
>>106560539 (OP)
>how would you fix rust?
Take it out back and shoot it.

You want easy? Use BASIC.

You want memory safe? For real? Use Fortran.

You want speed and power? Use C. Or, if you have a lot of time and don't care about portability, assembly language.
Anonymous No.106564690
>>106560539 (OP)
This is a (You) issue. Most languages either have modifing an iterated object as undefined behaviour, ban it or very heavily recommened against it. If you are modifying the same thing you are iterating, you are doing it wrong. Use a for loop, retard
Anonymous No.106564710
>>106560539 (OP)
>what do you mean I can't alias mutable references?
are you retarded by any chance?
Anonymous No.106564722
>>106563956
Because it's two mutables at the same time
See >>106563050
Anonymous No.106564729 >>106564842
>>106562160
multiple mutable references is UB in any low level language (C++ or Rust).
Anonymous No.106564763 >>106569325
>>106563885
Can he breathe?
Anonymous No.106564825 >>106567897
>>106563687
>"programming" language doesn't let the user program
>y-y-you're just g-g-g-getting filtered by the BBC
It's clear that you think your "programming" language has a 99% dropout rate because it's designed for the top 1% intellectually. You just can't comprehend most programmers aren't so ideologically motivated as to waste their time jumping through the hoops caused by the poorly though-out, sub-100-IQ premise of the language.
Anonymous No.106564842 >>106564846 >>106566574
>>106564729
>multiple mutable references is UB in any low level language
Rust users are unironically this mentally ill. Full disconnection from reality. They also claim things like "if it compiles, it's correct" "memory unsafety is a memory error", "memory leaks are not memory errors" etc. Psychotic cult.
Anonymous No.106564846 >>106564855
>>106564842
without synchronization you cannot have multiple places you can mutate a value. it's undefined.
while C++ compilers may not force full strict aliasing rules, Rust does.

cope and seethe mentally ill shitter. YWNBAC
Anonymous No.106564855 >>106564882
>>106564846
>without synchronization you cannot have multiple places you can mutate a value. it's undefined.
Literal psychosis.
Anonymous No.106564882 >>106564889
>>106564855
nothing I said is wrong. data races are UB.
Anonymous No.106564889 >>106564898 >>106564912
>>106564882
>having two mutable references is a "data race"
Psychotic illness, no two ways about this.
Anonymous No.106564898 >>106564913
>>106564889
yes? what's the usecase of unchecked mutable access if not to cause UB?
delusional retard. kys.
Anonymous No.106564912 >>106564934
>>106564889
It can and it will create data race.
Anonymous No.106564913 >>106564925 >>106564929 >>106564934
>>106564898
You're mentally ill and apparently think "low level programming" means you can't rely on any kind of execution order in your program and any part of the code can run concurrently with any other part of the code at any time.
Anonymous No.106564925
>>106564913
>any part of the code can run concurrently with any other part of the code at any time.
They can. But if they access and modify same resource, then it's a data race.
Anonymous No.106564929
>>106564913
>I don't know the C++ memory model
ya, I know you don't, because you're just another larping coder who probably deals with babby shit like Java, Go, JS and python
Anonymous No.106564934 >>106565033
>>106564912
See >>106564913. From this point on I'm just gonna start screencapping these insane Rust user posts. I encourage others to do the same. Whenever a Rust thread comes up, just spam it with screenshots from these insane xenoestrogen injectors. There's really no reason to entertain Rustposters beyond that.
Anonymous No.106565033 >>106565099
>>106564934
Explain what a data race is then. Cause, it certainly is a thing.
Anonymous No.106565099 >>106566220
>>106565033
A data race happens when different code paths modify the same data and get executed in an undefined order. Do you think "low level programming" means you can't rely on any kind of execution order in your program and any part of the code can run concurrently with any other part of the code at any time?
Anonymous No.106566199
>Rust thread
>cniles piss and shit themselves
Anonymous No.106566220
>>106565099
>>106566188
Rustkike witnessed.
Anonymous No.106566286 >>106566517
>>106560539 (OP)
>how would you fix rust?
You know how when you start up CLISP it prints a menorah? Do something like that with rust but instead it's a swastika, or a hitler portrait, in ASCII art as a header in every source file, and as output from their compiler, debugger, package manager(lol), etc.
Anonymous No.106566371
>>106563321
>what is trylock
Anonymous No.106566517
>>106566286
>You know how when you start up CLISP it prints a menorah?

Based. That's why nobody in the Common Lisp community uses CLISP anymore.

Rust should print a huge ASCII art portrait of Netanyahu.
Anonymous No.106566551
>>106563380
>Rust brings functional programming abstractions to systems programming and simplifies memory safety for 99% of the use cases.

kek
Anonymous No.106566561
>>106563439
>All you do all day is shill your irrelevant cult language. You don't write any software.

based
Anonymous No.106566574
>>106564842
>Rust users are unironically this mentally ill. Full disconnection from reality. They also claim things like "if it compiles, it's correct" "memory unsafety is a memory error", "memory leaks are not memory errors" etc. Psychotic cult.

Exactly. That's why it is useless to improve Rust -- its users are an order of magnitude more retarded than the lang itself.
Anonymous No.106566802 >>106566824 >>106566839
If you like FREEDOM you like C, simple as.
Anonymous No.106566822
>>106563687
This should compile into nothing because it doesn’t use the result.
Anonymous No.106566824
>>106566802
I prefer C++, C limits my freedom.
Anonymous No.106566839
>>106566802
Anonymous No.106566989 >>106567011
>>106560539 (OP)
Nim solves this
Anonymous No.106567011 >>106567022
>>106566989
Anonymous No.106567022
>>106567011
didnt know that, happy to keep using it
Anonymous No.106567185 >>106567213 >>106567348 >>106567360
>>106563407
>This is in no way useful or desirable. It does just enough to make it harder to predict what exactly your code will do
I don't give a fuck about your junior ass being unable to understand a basic abstraction that results in more composable, lazy data transformation pipelines
Anonymous No.106567213 >>106567229
>>106567185
what happened to that rust rewrite of ffmpeg?
Anonymous No.106567229
>>106567213
there never was one
Anonymous No.106567247 >>106567269
>>106560539 (OP)
>>106563760
It's impressive how nocoders don't realize you can still use normal for loops in rust rather than iters to get around borrow issues.
Anonymous No.106567269 >>106567309
>>106567247
Yeah, it's really wild: >>106563811 (Me) >>106563834 (nocoder)
Anonymous No.106567291 >>106567299
>>106563687
this does two passes of the data
Anonymous No.106567299 >>106567338
>>106567291
not necessarily
Anonymous No.106567309 >>106567356
>>106567269
>>106563811
>this doesn't compile
Have you considered that you may be retarded?
Anonymous No.106567330
>>106560539 (OP)
This is why companies are opting for AI over humans. I hope this helps, it may save your job someday.
Anonymous No.106567338 >>106567360 >>106567587
>>106567299
it absolutely does, you are creating two iterators
this is the correction:
fn main() {
let mut numbers = [1, 2, 3, 4, 5];
numbers[0] = numbers
.iter_mut()
.map(|n| {
*n += 10;
*n
})
.sum();
}
Anonymous No.106567348 >>106567357
>>106567185
You clearly don't understand what functional programming is. You think it's a shortcut "smart" people use for doing basic loops.
Anonymous No.106567356 >>106567501
>>106567309
No I never considered what I cannot be, try getting some board culture literacy.
Anonymous No.106567357 >>106567372 >>106569283
>>106567348
are you sure about that?
Anonymous No.106567360 >>106567385
>>106567185
Also see for instance >>106563687 and >>106567338 for a demonstration of my point that despite Rust "functional" programming being trivial to the point of uselessness, Rust users don't understand what their "functional" code actually does.
Anonymous No.106567372
>>106567357
I was only 90% sure but your screencap proves it without a doubt. Thanks for playing, retard.
Anonymous No.106567385 >>106567413
>>106567360
also see for instance for a demonstration of the point that C users are absolutely befuddled by any abstraction and regularly write buggy ass code because they have not even heard of a test suite
Anonymous No.106567413 >>106567955
>>106567385
I don't know what your mentally ill spergout is about. I'm just directing your attention to the fact that Rust users themselves get confused by the most trivial example of Rust's crippled "functional" programming.
Anonymous No.106567415 >>106567445
rust be like {|<>::|[]}()|} and you faggots really go "this is the way"
Anonymous No.106567425 >>106567460
can't wait for Advent of Code to humiliate more C sissies.
Anonymous No.106567445 >>106567587
>>106567415
so literally every language since... forever?
Anonymous No.106567460 >>106567473
>>106567425
Rust is the most popular language at writing non real world applications
Anonymous No.106567473 >>106567478 >>106567528
>>106567460
C++ Chuds -> solve the problems.
Rust Trannies -> solve the problems.
deranged C cuckolds -> cope and seethe by hard coding inputs, write shitty linear probing hash maps and still manage to write code that's much longer and more fragile than the former solutions in superior godly languages (C++, Rust).

this is the truth. you can cope, but you just look like a stupid bitch.
Anonymous No.106567478 >>106567484 >>106567486
>>106567473
The world runs on C, I don't even need to argue or defend it.
Anonymous No.106567484 >>106567497
>>106567478
Say this when a fighter jet programmed in Ada shoots a missile at you whose radar was programmed in C++.
Anonymous No.106567486
>>106567478
ok, so you'll have no problem come December and go through the whole year using C.
Anonymous No.106567497
>>106567484
>drones intercepting the jet running nixos
Anonymous No.106567501 >>106567508 >>106567515
>>106567356
There is no board culture here other than certain people constantly fabricating information about other languages
Anonymous No.106567508 >>106567578
>>106567501
I didn't fabricate anything, you're just genuinely a nigger who can't read text + picrel, you are either a bot or straight up brown.
Anonymous No.106567515
>>106567501
>constantly fabricating information
ya, it's kind of insane how bad it is. I wouldn't care about disagreements if people didn't just outright make up retarded bullshit.
Anonymous No.106567528 >>106567553 >>106567574
>>106567473
linear probing is based tho
Anonymous No.106567553 >>106567564
>>106567528
>kiddie continues bragging about his fizzbuzz
>still doesn't understand what "functional programming" is beyond Level 0
Anonymous No.106567555
>>106560964
That's called Ada.
Anonymous No.106567558
functional programming is when functions
Anonymous No.106567559
>rust
Anonymous No.106567564 >>106567602
>>106567553
I can drink a 12pack of Corona and write more code in an hour thaan you can in a month
Anonymous No.106567574
>>106567528
stunning, and brave.
Anonymous No.106567578 >>106567584
>>106567508
It is impossible to tell what that image is meant to convey outside of your head, whether you mean it's trolling or something else

It's Poe's law. All you seem to want to do is debase conversation of one of the few technical topics on this board
Anonymous No.106567584 >>106567595
>>106567578
Do you also often run into walls when the door is right there, autismo?
Anonymous No.106567587 >>106567593 >>106567594 >>106567853
>>106567445
>>106567338
four different symbols for one simple function. show me literally any other language that does this anti-human garbage.
Anonymous No.106567593
>>106567587
>4 different symbols
>() {}
uh... C?
Anonymous No.106567594
>>106567587
Don't get me started on C++.
Anonymous No.106567595 >>106567607
>>106567584
Board culture is that a picture's image can often have no relation whatsoever to the post content. Retards love posting jaks and frogs
Anonymous No.106567602
>>106567564
Me too, writing print("a") 61586 times is simple.
Anonymous No.106567607
>>106567595
Just like you have no relation to your biological father who you never met?
Anonymous No.106567622 >>106567874
>>106563362
Odin lacks metaprogramming and decent polymorphism which makes it annoying to use. I don't even think it should have text replacement or AST macros. He could have easily enabled metaprogramming by having a halfway decent type-system and module system, but instead we got parametric pascal with casts.
Anonymous No.106567853
>>106567587
Are you fucking retarded?
Anonymous No.106567874
>>106567622
Nim solves this
bruce3434 No.106567897
>>106564825
>>"programming" language doesn't let the user program
??
Rust let me program the exact same function that OP did, and more efficiently. Why are you lying?
bruce3434 No.106567955
>>106567413
The code in OP is fundamentally not functional because it mutates a given array. Don't give me a retarded looking procedural code and ask to make it functional with magic.
Anonymous No.106567986 >>106568066
what's happening here? it doesn't like mutating while iterating?
Anonymous No.106568066
>>106567986
XOR mutability. You can either have one mutable borrow or infinite immutable borrows
Anonymous No.106568137 >>106568148
I wonder if all this shit would be resolved by adding a "shapeshifting" mutable type so that the compiler can allow things like this while disallowing things that explicitly add/remove elements to data structures
Anonymous No.106568148
>>106568137
I think that's effects systems which is probably decades out
Anonymous No.106568801 >>106568883
>>106560539 (OP)
kys.
Anonymous No.106568883 >>106569056
>>106568801
I write Rust but you're completely missing the point
Anonymous No.106568982
>>106563937
Rust doesn't allow you to do retarded things? You can't tell me what to do!
Anonymous No.106569056
>>106568883
You made no point. You wrote unsafe code even for c.
Anonymous No.106569188 >>106569250 >>106569283
>>106560539 (OP)
i don't get why people care about rust
>m-muh memory safety
fast code is memory and type unsafe because computers are inherently memory and type unsafe. you will inevitably have to write unsafe or link with unsafe C libraries. sure, when you're writing yet another ls clone no one asked for you will think memory safety is the future

also, can you show me one (1, yi, uno) useful program written in Rust, that WAS NOT originally a C program that
did its job fine until rustards decided to preach their gospel of memory safety and "think about the children" rhetoric?
Anonymous No.106569211 >>106569250 >>106569540
Proper higher-kinded types and improve const fn so it can actually do useful things
Anonymous No.106569250 >>106569284
>>106569188
filtered, nobody cares about your incorrect thoughts regarding how computers do things
>>106569211
based
Anonymous No.106569283 >>106569302 >>106569316
>>106569188
>also, can you show me one (1, yi, uno) useful program written in Rust, that WAS NOT originally a C program that
no i can't but i made this and i'm a rust user: >>106567357
can you do such advanced functional programming?
Anonymous No.106569284 >>106569329 >>106569459
>>106569250
>filtered
filtered by what exactly? not following the rust cult? if I want to write a program that will be totally memory safe I'll use a garbage collected language, simple as. If I want a program that will be performant I will use C.
>incorrect thoughts regarding how computers do things
the closer the code you write is to assembly, the easier it is for you, as the programmer, to understand how it works and to optimize it accordingly

also
>can you show me one (1, yi, uno) useful program written in Rust, that WAS NOT originally a C program that
did its job fine until rustards decided to preach their gospel of memory safety and "think about the children" rhetoric?
I guess you can't.
Anonymous No.106569301
Better learning resources so brainlets like op don't blame the language itself
Anonymous No.106569302 >>106569343
>>106569283
>can you do such advanced functional programming?
i engage in Haskell and math autism once in a while. It's fun as a recreational activity, and I have written my fair share of compilers with les monadic combinators, but not for writing actual performant software.
Anonymous No.106569316 >>106569333 >>106569443
>>106569283
>can you show me one (1, yi, uno) useful program written in Rust, that WAS NOT originally a C program
There's quite a few, for example Cloudflare's QUIC library, firecracker, cloud-hypervisor, COSMIC, ... list goes on
Anonymous No.106569325
>>106564763
I don’t think so
Anonymous No.106569329 >>106569343
>>106569284
you got filtered by advanced Rust functional programming concepts like map and filter. you need to learn category theory to understand Rust like i do
Anonymous No.106569333 >>106569337 >>106569516
>>106569316
Slop.
Anonymous No.106569337 >>106569361
>>106569333
Nice gymnastics. NTA btw
Anonymous No.106569343
>>106569329
i do know category theory to the extent of how it's used in computer science (a monad in X is a monoid in the category of endofunctors of X, or, as one might say, chaining computations), refer to >>106569302. It's interesting and fun, but not useful.
Anonymous No.106569361 >>106569516
>>106569337
I'm sure you're running all of that on your machine right now so you can testify how good it runs. You're also a maintainer for all these projects and attest to the quality of the code. Rust programmers are top-tier professionals.
Anonymous No.106569443 >>106569516
>>106569316
>Cloudflare's QUIC library
a library for HTTP just newer, wow, such a revolutionary technology
>firecracker
>Firecracker was developed at Amazon Web Services to improve the customer experience of services like AWS Lambda and AWS Fargate
Jewish technology to solve problem they created themselves.
>cloud-hypervisor
>The project focuses on running modern, Cloud Workloads, on specific, common, hardware architectures. In this case Cloud Workloads refers to those that are run by customers inside a Cloud Service Provider. This means modern operating systems with most I/O handled by paravirtualised devices (e.g. virtio), no requirement for legacy devices, and 64-bit CPUs.
wow, a KVM wrapper. also, the usecase is slightly unclear
>COSMIC
wow, the bar is so low now. Yet another window manager. Because people haven't been writing window managers in everything from Python, to Common Lisp, to Haskell, to literally Java...
Anonymous No.106569459 >>106569551 >>106569703
>>106569284
>I guess you can't.
https://github.com/RustCrypto is pretty cool. I used to use Bouncy Castle from Java, but I found numerous bugs, and their test suite is not very solid. I like to construct cryptographic protocols that have interchangeable algorithms, and RustCrypto allows me to do this easily.
https://github.com/emilk/egui is a cool GUI that can deploy to the web or any other platform that supports OpenGL.
https://bevy.org/ looks cool, and I have a friend that has fucked around with it doing VR-type experiments.
https://embassy.dev/ is claimed by numerous embedded devs to be extremely convenient.
https://docs.rs/hifitime/latest/hifitime/ allows for extremely precise, scientific time management (for things like aiming telescopes at the exactly correct location at the exactly correct time).

there are a fuck-load more projects found at https://github.com/rust-unofficial/awesome-rust
but you don't actually give a shit. you're more interested in cherrypicking random projects that you imagine to be complete replicas of already existing software (that often has CVEs found in them).
Anonymous No.106569516 >>106569566
>>106569333
>>106569361
Rust programs that I use: ripgrep, firefox, personal things I've written
>>106569443
Congrats on moving goalposts, yes you can write almost every program in every language
Anonymous No.106569540 >>106569793
>>106569211
>Proper higher-kinded types
this.
also a real module system so i don't have to litter my code with pub impl and a million other bits of needless keyword pollution.
and bring back ocaml syntax.
Anonymous No.106569551 >>106569625
>>106569459
I have to concede that hifitime does look cool and it's cool that's it's formally verifiable. But that's about it. The rest are mostly libraries, which mean nothing by themselves. Why do you need a tool for building tools?
>random projects that you imagine to be complete replicas of already existing software (that often has CVEs found in them)
because clearly the Rust rewrite won't have CVEs because... because my CS professor told me so!!
Anonymous No.106569566 >>106569768 >>106569793
>>106569516
>yes you can write almost every program in every language
I didn't move the goalpoasts. Most of those things already existed, were written in C, and no one complained.
Anonymous No.106569625
>>106569551
newsflash bro: almost all software (C included) that does interesting shit eventually gets distributed as a lib. glueing a UI to some lib is the easy part.
there are a lot of interesting things being made in Rust, but to use them, you have to be able to sit down and write the 200loc or whatever to set up thee solutions for your problem domain. many people using Rust to ship applications that are useable by random ass people are shipping those applications in a commercial context.
Anonymous No.106569703 >>106569735
>>106569459
Nobody should be looking for anything with “rust” or an r meaning “rust” or “-rs” or anything.
That typically means it’s a c2rust project and has no legitimate purpose other than annoying cniles.

> telescopes
That reminded me of the SPIKE project written in lisp on TI Explorers to schedule the Hubble around 1987–88.

Some of these re-do “only now in rust!” are time and life-essence wasted when you could be helping out poor or sick people or contributing to your community.
Anonymous No.106569712
>>106560539 (OP)
wanker
let mut numbers = [1,2,3,4,5];

for i in 0..numbers.len() {
numbers[i] += 10;
numbers[0] += numbers[i];
}
Anonymous No.106569735
>>106569703
>That typically means it’s a c2rust project
It doesn't? There is only handful of noteworthy c2rust projects.
Anonymous No.106569768 >>106569793
>>106569566
>Most of those things already existed, were written in C, and no one complained.
NTA but this is literally moving the goalpost.
You asked for examples of Rust projects that were not originally written in C. When you got the response you changed it to mean examples of Rust projects that have features that were never present in any C program. And now you are moving it even further to make it about people not complaining about C in the past

Just pick one claim and stick to it instead of changing the criteria in every single post.
Anonymous No.106569793 >>106570140
>>106569540
>a real module system
What would you want to see?
ML-style syntax is something I'm mixed on, I do feel like the current syntax is more suited for a systems language where you need to be attentive to allocations etc.
>>106569566
No, these things never existed as C programs. Just because there were other programs that did similar things doesn't mean that the Rust programs "were originally written in C", see >>106569768 too
Anonymous No.106570140 >>106570154 >>106571179
>>106569793
Not him but what I want is basically as close as I can get to Haskell except:
>No purity
>No implicit currying
>No laziness
>Stripped down standard library, common sense reduction of the number of types
>No GC
Same module system, type classes, GADTs, etc.
Built in polymorphic type Ptr, with a deriving list that looks like (Eq, Ord, Num, Integral, Bits, Nullable, ...)
C-style pointer arithmetic (obviously)
No pointer decaying, but the internal representation should still look like a pointer.
No need for monads, so steal <- from do-style syntax for pointer dereferencing.
A parametric allocate function that returns said Ptr type
A parametric reinterpret_cast function
Lambdas are fully supported, they only capture by value. At compile time, we check for which lexical values we are using and build a special product type based on them + a function pointer. Type checker ignores the product type, and checks against the function pointer. Storage of lambdas may require a built-in wrapper type, but that's fine.
If we want to capture a reference to a thing, it means capturing a pointer.
Absolutely NO STRICT ALIASING.

I think that gets us 98% of the way there.

>I do feel like the current syntax is more suited for a systems language where you need to be attentive to allocations etc.
I think it's more just about the semantics of the language. The ML-family gets close with the ref-type. But the lack of arithmetic + the whole lambda problem.
Anonymous No.106570154
>>106570140
>But the lack of arithmetic + the whole lambda problem.
But the lack of pointer arithmetic, and then you have the whole issue with closures and allocation unless you lobotomize them properly.*
Anonymous No.106570203
>>106560539 (OP)
too broken to fix
Anonymous No.106571179
>>106570140
>no purity
Why
Anonymous No.106571191 >>106571557
>>106564153
What is good about automatic memory management? If you want the computer to do that for you then use something like Go, Java, C#. There is an inflection point where if you use enough smart pointers in your code, garbage collection becomes a faster memory management strategy.
Anonymous No.106571557
>>106571191
RAII is good. Having to write all the same code yourself and causing bugs for forgetting to clean up or wrong clean up order is stupid when it can be automated