zlacker

[parent] [thread] 5 comments
1. atoav+(OP)[view] [source] 2022-10-02 14:56:26
I mean if it is a cosmetic thing sure. If it has substantial meaning I would rather have that 5 ton robotic welding arm not move than have it move through my skill.

It is sometimes acceptable to get wrong output. But is nearly always better to know it is wrong.

replies(2): >>analog+H4 >>fritol+v5
2. analog+H4[view] [source] 2022-10-02 15:23:06
>>atoav+(OP)
This sounds like the difference between "fault tolerant" and "fail safe".

Fault tolerant - you get a fault, you keep moving.

Fail safe - you fail, and thus all operations are stopped.

replies(2): >>gmueck+Yt >>atoav+Oc2
3. fritol+v5[view] [source] 2022-10-02 15:27:59
>>atoav+(OP)
Unless it was holding a welding gun and stopped on one spot with the welding flame turned on instead of gracefully turning off the flame and backing away.

Never used Rust before but is there a way to supply some default code to run in such a situation instead of just not carrying out the bad operation?

replies(1): >>shephe+08
◧◩
4. shephe+08[view] [source] [discussion] 2022-10-02 15:41:48
>>fritol+v5
Yes, you can define your own panic handler in Rust.

https://doc.rust-lang.org/nomicon/panic-handler.html

◧◩
5. gmueck+Yt[view] [source] [discussion] 2022-10-02 17:39:40
>>analog+H4
Failing may require triggering some actions actively. Going inert is not the right way in many cases. Some system absolutely require best efforts in the face of failure. A fire alarm in an otherwise secure and locked down facility may have to trigger the opening of door locks, for example.
◧◩
6. atoav+Oc2[view] [source] [discussion] 2022-10-03 08:30:16
>>analog+H4
I mean the Rust appeal is actually that it foeces you to handle Errors. Whether you then fail or not is your decision. What Rust usually does not do is just fail.

This is good for when the things you are using could error, e.g. when you use an arbitrary unicode string as a filename you might get an error because depending on the OS there might be characters that you cannot use as filenames that are valid unicode (or the other way around, possible filenames that are not valid unicode).

In most programming languages this is something you need to know to catch it. In Rust this is an Error that you can or cannot handle. But you can't forget to deal with it.

[go to top]