#prog #rust
Несколько неожиданное следствие строгой типизации в Rust: она помогает не оставлять в коде отладочную печать. Действительно, если убрать для своего типа реализацию
Несколько неожиданное следствие строгой типизации в Rust: она помогает не оставлять в коде отладочную печать. Действительно, если убрать для своего типа реализацию
Debug
, то код, сгенерированный {, e}print{, ln}!
/format{, args}!
/write!
/dbg!
перестаёт тайпчекаться. К сожалению, не помогает, если печатаются примитивы и типы из чужих библиотек, для которых есть Debug
.Forwarded from мне не нравится реальность (вафель 🧇)
Просто хочу поделиться замечательным rust-quiz от dtolnay (кто бы сомневался). Есть над чем задуматься (хотя прилично и простых вопросов)
Forwarded from Mikail Bagishov
Ты предлагаешь научить компилятор erase-ить любые трейты?
Forwarded from Mikail Bagishov
dtolnay такого пока не сделал, значит не такая уж и простая.
Forwarded from Programming sucks
Perhaps one of the worst misfeatures of C is the ease with which responsibility for problems can be shifted to the person who wrote the code. “Oh, you segfaulted? I guess you forgot to check for
Clearly, computers can’t be expected to do everything for us. But they can be expected to do quite a bit. Programming languages are built for humans, and they ought to eliminate the sorts of rote work humans are bad at whenever possible. A programmer is already busy thinking about the actual problem they want to solve; it’s no surprise that they’ll sometimes forget some tedious detail the language forces them to worry about.
(с) https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
NULL
.” If only I had a computer to take care of such tedium for me!Clearly, computers can’t be expected to do everything for us. But they can be expected to do quite a bit. Programming languages are built for humans, and they ought to eliminate the sorts of rote work humans are bad at whenever possible. A programmer is already busy thinking about the actual problem they want to solve; it’s no surprise that they’ll sometimes forget some tedious detail the language forces them to worry about.
(с) https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
eev.ee
Let’s stop copying C
Ah, C. The best lingua franca we have… because we have no other lingua francas. Linguae franca. Surgeons general? C is fairly old — 44 years, now! — and comes from a time when there were possibly more architectures than programming languages. It works well…