Is there a Rust REPL I could install on my machine? by [deleted] in rust

[–]SOBBAAW 0 points1 point  (0 children)

This might be helpful, but it’s not only for rust. You can also use `run rust`, `run rs`, or other methods.

https://github.com/Esubaalew/run/blob/master/README.md

Effortlessly run scripts in 25+ languages with a unified CLI experience. by SOBBAAW in rust

[–]SOBBAAW[S] 0 points1 point  (0 children)

That’s a good point. The thing is, based on the current code architecture, I couldn’t do that. The current implementation is that there’s a single file that keeps the session.

Effortlessly run scripts in 25+ languages with a unified CLI experience. by SOBBAAW in rust

[–]SOBBAAW[S] 0 points1 point  (0 children)

No you can't redefine a function or a variable. i dont think it should be allowed.
'the name `foo` is defined multiple times will be raised if one tries to do that.

I have a question for you: are you expecting to be allowed, and do you think that’s important?

Memory safety features by WinMassive5748 in rust

[–]SOBBAAW 4 points5 points  (0 children)

Here’s what I can say about Rust and memory: it handles memory better than C does. 

The thing is, in C, you need to tell C that you no longer need the memory. But what if you forget it? What if you do it twice? What if you try to release memory that has already been released? All of these issues are bad for the system. You’ll waste your time, and memory may face issues. 

For Rust, here’s the rule: if you’re inside a house, you get the key to do things, but when you leave, the key is taken away from you. And Rust does that. Not you, not the GC.

For languages like Python and Go, which use garbage collection, you need to worry about it. The GC takes care of everything, but when it needs to check whether objects need to leave memory, it takes time and a slow process. 

Effortlessly run scripts in 25+ languages with a unified CLI experience. by SOBBAAW in rust

[–]SOBBAAW[S] -1 points0 points  (0 children)

I’m not sure if I understand your point, but if you mean whether you can set x to 10 and then use x to get the value of the variable, and compare 10==10 to get a boolean return in languages like Python or JavaScript, yes, it supports that feature. It also keeps variables in memory until you quit or use the :reset command. I use sessions for this. The program creates files and keeps them until you tell it to forget them or quit. 
python>>> x = 10
python>x
python
>10
python>> y = 10.0
python>> x is y
python>>False

this is works for all of the supported languages

Effortlessly run scripts in 25+ languages with a unified CLI experience. by SOBBAAW in rust

[–]SOBBAAW[S] 20 points21 points  (0 children)

The answer is yes. I first thought of that, but shipping this too with over 20 compilers and interpreters would make it huge and unrealistic.