Иду по тротуару, никого не трогаю, вдруг с дерева в метрах четырёх от меня из кроны на землю падает... Кошка 😶
🕊7❤4
Блог*
#prog #rust #rustlib В стандартной библиотеке есть тип std::ffi::CStr, предназначенный для представления невладеющих C-строк. Не смотря на то, что для определения этого типа не нужно ничего, чего не было бы в core, у этого типа есть методы, в сигнатурах которых…
GitHub
Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends by joshtriplett · Pull Request #99277 · rust-lang/rust
Stabilize the core_c_str and alloc_c_string feature gates.
Change std::ffi to re-export these types rather than creating type
aliases, since they now have matching stability.
Change std::ffi to re-export these types rather than creating type
aliases, since they now have matching stability.
Блог*
#prog #rust С версии Rust 1.64.0 это даже стабилизируют.
#prog #rust
А, и ещё Rust 1.64.0 покончит с той неловкой ситуацией, когда типы для интеропа с C есть в std, но не в core
А, и ещё Rust 1.64.0 покончит с той неловкой ситуацией, когда типы для интеропа с C есть в std, но не в core
GitHub
Stabilize `core::ffi:c_*` and re-export in `std::ffi` by joshtriplett · Pull Request #98315 · rust-lang/rust
This only stabilizes the base types, not the non-zero variants, since
those have their own separate tracking issue and have not gone through
FCP to stabilize.
those have their own separate tracking issue and have not gone through
FCP to stabilize.
👍2
#prog #rust #article
How to speed up the Rust compiler in July 2022
Куча интересных усовершенствований!
How to speed up the Rust compiler in July 2022
Куча интересных усовершенствований!
Nicholas Nethercote
How to speed up the Rust compiler in July 2022
Let’s look at some of the progress on Rust compiler speed made since my last post. I will start with some important changes made by other people.
👍3
#prog #rust #article
Rustc показывает экспоненциальное поведение при тайпчекинге рекурсивных HRTB из-за отсутствия кеширования промежуточных результатов и разработчики не могут понять, почему. А, и ещё об этом Амос написал статью: When rustc explodes
Rustc показывает экспоненциальное поведение при тайпчекинге рекурсивных HRTB из-за отсутствия кеширования промежуточных результатов и разработчики не могут понять, почему. А, и ещё об этом Амос написал статью: When rustc explodes
GitHub
Missing caching for HRTB projection equality bounds (`for<'x> T: Trait<'x, Assoc = ...>`). · Issue #99188 · rust-lang/rust
Originally reduced from a production application using the tower crate - see @fasterthanlime's reduced repro repo for more background (though note that it exhibits several other failure mod...
👍1
Forwarded from There will be no singularity
In Snowflake, you can create tables, stages, and functions temporarily.
Temporary objects remain visible in the current session only and disappear after the session ends.
The unusual behavior is that you can create a temporary object with the same name as an already existing object.
So, all existing objects linked with it will be relinked to the "new" temporary object. For e.g. all views dependent on the original table will depend on the temporary table.
More than it!
The permanent table created after the temporary table with the same name stays invisible in the current session too :)
🤡6👍1🤔1
Forwarded from ozkriff.games 🦀 (ozkriff🇺🇦)
# Serde Tips
A nice /r/rust thread with tips about using serde_json, some of which are not so obvious. I only got two things to add:
- Don't forget to read through serde.rs, it covers most of the day-to-day knowledge. It's surprising how many serde users don't know about it.
- Consider using lib.rs/nanoserde if you only need some basic features and care about the size of your project's dependencies.
A nice /r/rust thread with tips about using serde_json, some of which are not so obvious. I only got two things to add:
- Don't forget to read through serde.rs, it covers most of the day-to-day knowledge. It's surprising how many serde users don't know about it.
- Consider using lib.rs/nanoserde if you only need some basic features and care about the size of your project's dependencies.
Reddit
From the rust community on Reddit
Explore this post and more from the rust community
👍1
Антон: не любит, не умеет и не хочет готовить
Также Антон: однажды приготовил в одиночку (пусть и под чужим руководством) торт на день рождения подруги
Также Антон: однажды приготовил в одиночку (пусть и под чужим руководством) торт на день рождения подруги
Блог*
Антон: не любит, не умеет и не хочет готовить Также Антон: однажды приготовил в одиночку (пусть и под чужим руководством) торт на день рождения подруги
Торт, кстати, понравился тем, кто его попробовал, в том числе и вышеупомянутой подруге
#prog #rust #article
What it feels like when Rust saves your bacon
You’ve probably heard that the Rust type checker can be a great “co-pilot”, helping you to avoid subtle bugs that would have been a royal pain in the !@#!$! to debug. This is truly awesome! But what you may not realize is how it feels in the moment when this happens. The answer typically is: really, really frustrating! Usually, you are trying to get some code to compile and you find you just can’t do it.
As you come to learn Rust better, and especially to gain a bit of a deeper understanding of what is happening when your code runs, you can start to see when you are getting a type-check error because you have a typo versus because you are trying to do something fundamentally flawed.
A couple of days back, I had a moment where the compiler caught a really subtle bug that would’ve been horrible had it been allowed to compile. I thought it would be fun to narrate a bit how it played out, and also take the moment to explain a bit more about temporaries in Rust (a common source of confusion, in my observations).
What it feels like when Rust saves your bacon
You’ve probably heard that the Rust type checker can be a great “co-pilot”, helping you to avoid subtle bugs that would have been a royal pain in the !@#!$! to debug. This is truly awesome! But what you may not realize is how it feels in the moment when this happens. The answer typically is: really, really frustrating! Usually, you are trying to get some code to compile and you find you just can’t do it.
As you come to learn Rust better, and especially to gain a bit of a deeper understanding of what is happening when your code runs, you can start to see when you are getting a type-check error because you have a typo versus because you are trying to do something fundamentally flawed.
A couple of days back, I had a moment where the compiler caught a really subtle bug that would’ve been horrible had it been allowed to compile. I thought it would be fun to narrate a bit how it played out, and also take the moment to explain a bit more about temporaries in Rust (a common source of confusion, in my observations).
👍3
#prog #article
The Hardest Program I’ve Ever Written
The hardest program I’ve ever written, once you strip out the whitespace, is 3,835 lines long. That handful of code took me almost a year to write. Granted, that doesn’t take into account the code that didn’t make it. The commit history shows that I deleted 20,704 lines of code over that time. Every surviving line has about three fallen comrades.
If it took that much thrashing to get it right, you’d expect it to do something pretty deep right? Maybe a low-level hardware interface or some wicked graphics demo with tons of math and pumping early-90s-style techno? A likely-to-turn-evil machine learning AI Skynet thing?
Nope. It reads in a string and writes out a string. The only difference between the input and output strings is that it modifies some of the whitespace characters. I’m talking, of course, about an automated code formatter.
Кстати, тема красивого вывода кода в Блог*е уже обсуждалась
The Hardest Program I’ve Ever Written
The hardest program I’ve ever written, once you strip out the whitespace, is 3,835 lines long. That handful of code took me almost a year to write. Granted, that doesn’t take into account the code that didn’t make it. The commit history shows that I deleted 20,704 lines of code over that time. Every surviving line has about three fallen comrades.
If it took that much thrashing to get it right, you’d expect it to do something pretty deep right? Maybe a low-level hardware interface or some wicked graphics demo with tons of math and pumping early-90s-style techno? A likely-to-turn-evil machine learning AI Skynet thing?
Nope. It reads in a string and writes out a string. The only difference between the input and output strings is that it modifies some of the whitespace characters. I’m talking, of course, about an automated code formatter.
Кстати, тема красивого вывода кода в Блог*е уже обсуждалась
Forwarded from Игорь Кочетков
Кстати, о “пропаганде среди несовершеннолетних”. В 2013 г., когда был принят тот самый федеральный закон, только 10% россиян/ок в возрасте 18-25 лет были против запрета “пропаганды гомосексуализма”
В 2018 г. уже 50% 18-25-летних считали, что никакой “пропаганды нетрадиционных сексуальных отношений” не существуют, а ЛГБТ-активисты/ки не преследуют никаких деструктивных целей. В 2020 г. таких было уже 63%
Это данные ВЦИОМ, если что.
Левада-центр говорит нам, что в 2013 г. среди молодежи толерантность была “выражена слабее, чем гомофобия”. Точных данных о распределениях по возрастным группам они тогда не публиковали, к сожалению.
Но к 2021 г. (на самом деле - раньше) картина изменилась на противоположную. 53% респондентов 18-24 лет были согласны с тем, что взрослые люди имеют право по взаимному согласию вступать в отношения с людьми того же пола (по всей выборке - только 25%).
55% - считают что геи и лесбиянки должны иметь равные права с остальными гражданами (по всей выборке - только 39%).
Для понимания. Те, кому сейчас 18-25 лет это те самые несовершеннолетние, которых в 2013 г. мизулины и милоновы обещали от нас “защитить”
Можете интерпретировать эти данные как хотите. Но лично я скажу “Хорошая работа!” себе и многим моим коллегам, а также “Ваше дело безнадежно” - тем, кто сегодня снова пытается нам что-то запретить
В 2018 г. уже 50% 18-25-летних считали, что никакой “пропаганды нетрадиционных сексуальных отношений” не существуют, а ЛГБТ-активисты/ки не преследуют никаких деструктивных целей. В 2020 г. таких было уже 63%
Это данные ВЦИОМ, если что.
Левада-центр говорит нам, что в 2013 г. среди молодежи толерантность была “выражена слабее, чем гомофобия”. Точных данных о распределениях по возрастным группам они тогда не публиковали, к сожалению.
Но к 2021 г. (на самом деле - раньше) картина изменилась на противоположную. 53% респондентов 18-24 лет были согласны с тем, что взрослые люди имеют право по взаимному согласию вступать в отношения с людьми того же пола (по всей выборке - только 25%).
55% - считают что геи и лесбиянки должны иметь равные права с остальными гражданами (по всей выборке - только 39%).
Для понимания. Те, кому сейчас 18-25 лет это те самые несовершеннолетние, которых в 2013 г. мизулины и милоновы обещали от нас “защитить”
Можете интерпретировать эти данные как хотите. Но лично я скажу “Хорошая работа!” себе и многим моим коллегам, а также “Ваше дело безнадежно” - тем, кто сегодня снова пытается нам что-то запретить
❤15🔥2💩2👍1
Санечка Ъысь
Photo
Telegram
I’m CEO, beach
Коллеги, всем приятных выходных. Напоминаю, что наша компания максимально "friendly", мы стараемся не тревожить друг друга в уик-энд. Считайте, что работа в выходные у нас официально под запретом. Скидывайте сюда фотки, как отдыхаете - будем по-хорошему завидовать…
🔥2👍1
#prog #rust #article
Predrag Gruevski написал интересную серию статей и намеревается её продолжить. Материал базируется на задаче 24 дня из Advent of Code 2021. В этой задаче описывается очень простой процессор с небольшим набором команд — без ветвлений и переходов. Целью же задачи является найти наибольший вход (четырнадцатизначное число), для которого приведённая программа, будучи выполненной на этом входе, оставляет ноль в одном из регистров. Не смотря на то, что интерпретатор для такого процессора написать весьма несложно, большое пространство для поиска не даёт шансов использовать брутфорс — слишком уж медленно это будет работать.
На примере этого процессора автор рассказывает в доступной форме об оптимизациях, которые используются в реальных компиляторах. В настоящий момент написано три части, но автор планирует написать ещё. А, и автор для иллюстрации использует Rust.
Compiler Adventures, part 1: No-op Instructions — dead code elimination
Compiler Adventures, part 2: Constant Propagation
Compiler Adventures, part 3: Value Numbering
Ссылки на новые части я буду оставлять тут.
Predrag Gruevski написал интересную серию статей и намеревается её продолжить. Материал базируется на задаче 24 дня из Advent of Code 2021. В этой задаче описывается очень простой процессор с небольшим набором команд — без ветвлений и переходов. Целью же задачи является найти наибольший вход (четырнадцатизначное число), для которого приведённая программа, будучи выполненной на этом входе, оставляет ноль в одном из регистров. Не смотря на то, что интерпретатор для такого процессора написать весьма несложно, большое пространство для поиска не даёт шансов использовать брутфорс — слишком уж медленно это будет работать.
На примере этого процессора автор рассказывает в доступной форме об оптимизациях, которые используются в реальных компиляторах. В настоящий момент написано три части, но автор планирует написать ещё. А, и автор для иллюстрации использует Rust.
Compiler Adventures, part 1: No-op Instructions — dead code elimination
Compiler Adventures, part 2: Constant Propagation
Compiler Adventures, part 3: Value Numbering
Ссылки на новые части я буду оставлять тут.
Medium
Predrag Gruevski – Medium
Read writing from Predrag Gruevski on Medium. Principal Eng @Kensho // Querying (almost) everything // GraphQL compiler author // @MIT alum // rocket nerd, hockey player, not from around here 🇲🇰.
🔥4👍1