Блог*
#prog #article As closing thoughts: this blog post is not intended to start a flame war, nor is it intended to be an assault on dynamically typed programming. There are many patterns in dynamically-typed languages that are genuinely difficult to translate…
#prog #article
Своеобразное продолжение статьи, даром что автор другой.
"One day you open that module which you haven’t touched in six months, and you see a function call where the third argument is null. You need to remember what kinds of variables you can pass to that third argument, or read the whole source code to figure it out. You follow through the code to see all places that third argument is used and realize the accepted type of the third argument depends on what you give to the second argument. Congratulations, you’re dealing with a dependent type, which means you’ve just surpassed Haskell in terms of type system complexity. Compilers that deal with this kind of type system are so complex they are effectively proof assistants (and are at the forefront of programming language research), and here you are dealing with those data types with your brain (and your faith in your ability to come up with sufficient tests) alone."
https://hisham.hm/2020/01/20/dynamic-type-systems-arent-even-simpler/
Своеобразное продолжение статьи, даром что автор другой.
"One day you open that module which you haven’t touched in six months, and you see a function call where the third argument is null. You need to remember what kinds of variables you can pass to that third argument, or read the whole source code to figure it out. You follow through the code to see all places that third argument is used and realize the accepted type of the third argument depends on what you give to the second argument. Congratulations, you’re dealing with a dependent type, which means you’ve just surpassed Haskell in terms of type system complexity. Compilers that deal with this kind of type system are so complex they are effectively proof assistants (and are at the forefront of programming language research), and here you are dealing with those data types with your brain (and your faith in your ability to come up with sufficient tests) alone."
https://hisham.hm/2020/01/20/dynamic-type-systems-arent-even-simpler/
#rust
Небольшое напоминание (главным образом новичкам, но и остальным тоже): если вы работаете в Rust с текстом в ASCII — пожалуйста, не используйте коды символов напрямую. Для ASCII в Rust есть прекрасные инструменты — байтовые литералы.
Также есть ещё и литералы для байтовых массивов:
Небольшое напоминание (главным образом новичкам, но и остальным тоже): если вы работаете в Rust с текстом в ASCII — пожалуйста, не используйте коды символов напрямую. Для ASCII в Rust есть прекрасные инструменты — байтовые литералы.
b'A'
— это литерал типа u8
, имеющий значение 65, но это куда понятнее, чем 65.Также есть ещё и литералы для байтовых массивов:
assert_eq!(b"hello", &[104, 101, 108, 108, 111]);
Обратите внимание, это именно (статичная) ссылка на массив. Если вам нужно куда-то передавать байтовый слайс, то, возможно, придётся приводит к слайсу явно: &b"hello"[..]
.Forwarded from Идеи неинтересных фильмов
Главный герой - простой австрийский художник, которого по непонятным причинам пытаются убить путешественники во времени.
Forwarded from мне не нравится реальность (Вафель 🧇)
Q: When I was 4, my sister was 2. I am now 44. How old is my sister?
Programmer: 44 - (4 - 2) = 42
Tester:
Programmer: 44 - (4 - 2) = 42
Tester:
Дорогие мои подписчики, я вынужден просить вас о помощи. Пожалуйста, свяжитесь со мной, кто занимался на Rust численными методами решения диффуров.
Писать лучше в @decltype_chat_ptr_t, потому что сообщение в личку я могу банально потерять среди всех моих чатов и каналов
Писать лучше в @decltype_chat_ptr_t, потому что сообщение в личку я могу банально потерять среди всех моих чатов и каналов
Forwarded from Ender Eyre
программирование и программисты не нужны в программирования, они могут только ныть, жаловаться, нихуя не делать и требовать денег.
#prog #amazingopensource
# Human injectionИз сборника Big list of naughty strings — списка строк, которые приведут к проблемам для софта, который небрежно обрабатывает пользовательский ввод, конкретно здесь
#
# Strings which may cause human to reinterpret worldview
If you're reading this, you've been in a coma for almost 20 years now. We're trying a new technique. We don't know where this message will end up in your dream, but we hope it works. Please wake up, we miss you.
GitHub
GitHub - minimaxir/big-list-of-naughty-strings: The Big List of Naughty Strings is a list of strings which have a high probability…
The Big List of Naughty Strings is a list of strings which have a high probability of causing issues when used as user-input data. - minimaxir/big-list-of-naughty-strings
#prog #article
Турецкий тест: будет ли ваша программа корректно работать в турецкой локали? Если да, велик шанс, что программа адекватно обрабатывает локали. Почему именно турецкая? Там полно граничных случаев, которые отличают её от английской.
...Правда, для меня главным выводом было "не используйте функции с неявными глобальными зависимостями".
moserware.com/2008/02/does-your-code-pass-turkey-test.html
Турецкий тест: будет ли ваша программа корректно работать в турецкой локали? Если да, велик шанс, что программа адекватно обрабатывает локали. Почему именно турецкая? Там полно граничных случаев, которые отличают её от английской.
...Правда, для меня главным выводом было "не используйте функции с неявными глобальными зависимостями".
moserware.com/2008/02/does-your-code-pass-turkey-test.html
Moserware
Does Your Code Pass The Turkey Test?
Over the past 6 years or so, I’ve failed each item on “The Turkey Test.” It’s very simple: will your code work properly on a person’s machine in or around th...
Блог*
Является ли это единственным достоинством нового варианта? Отнюдь. Оригинальный код собирает промежуточный слайс — в моём варианте собирается только конечный результат (причём память выделяется заранее). Оригинальный код дважды делает поиск в мапе по итоговым…
Как мне совершенно правильно сообщил подписчик,
iterated
можно выкинуть и проверять длину idsForSearch
. Впрочем, моя позиция остаётся прежней