Forwarded from Pragmatic Programmer (Nikita Bishōnen)
Немного размышлений на тему Rust и его развития без стагнации.
Для поддержания этого "девиза" в Rust появились "издания", сейчас на носу издание 2024. Вот среднего размера изменение, которое это издание привнесёт. С ним, код работающий в издании 2021:
fn indices<'s, T>( slice: &'s [T], ) -> impl Iterator<Item = usize> { 0 .. slice.len() } ... fn main() { let mut data = vec![1, 2, 3]; let i = indices(&data); data.push(4); // <-- Error! i.next(); // <-- assumed to access `&data` }
перестаёт работать и выдаёт ошибку, потому-что новое издание задействует lifetime в возвращаемом impl Trait.
Для исправления предлагается ввести некий use:
) -> impl Iterator<Item = usize> + use<> { // ----- // Return type does not use `'s` or `T`
и на мой взгляд, это конечно выглядит как костыль. Думаю сейчас я понимаю тех, кто в мою молодость программиста сидел и говорил что Java 8 это всё сахар и не нужно программистам. Думаю что дальше тянуть обратную совместимость у Rust будет получаться всё сложнее и сложнее, пора работать над Rust 2.0.
Немного размышлений на тему Rust и его развития без стагнации.
Для поддержания этого "девиза" в Rust появились "издания", сейчас на носу издание 2024. Вот среднего размера изменение, которое это издание привнесёт. С ним, код работающий в издании 2021:
fn indices<'s, T>( slice: &'s [T], ) -> impl Iterator<Item = usize> { 0 .. slice.len() } ... fn main() { let mut data = vec![1, 2, 3]; let i = indices(&data); data.push(4); // <-- Error! i.next(); // <-- assumed to access `&data` }
перестаёт работать и выдаёт ошибку, потому-что новое издание задействует lifetime в возвращаемом impl Trait.
Для исправления предлагается ввести некий use:
) -> impl Iterator<Item = usize> + use<> { // ----- // Return type does not use `'s` or `T`
и на мой взгляд, это конечно выглядит как костыль. Думаю сейчас я понимаю тех, кто в мою молодость программиста сидел и говорил что Java 8 это всё сахар и не нужно программистам. Думаю что дальше тянуть обратную совместимость у Rust будет получаться всё сложнее и сложнее, пора работать над Rust 2.0.
BY Type Driven Thoughts 🦀
Warning: Undefined variable $i in /var/www/group-telegram/post.php on line 260
He said that since his platform does not have the capacity to check all channels, it may restrict some in Russia and Ukraine "for the duration of the conflict," but then reversed course hours later after many users complained that Telegram was an important source of information. "Your messages about the movement of the enemy through the official chatbot … bring new trophies every day," the government agency tweeted. The message was not authentic, with the real Zelenskiy soon denying the claim on his official Telegram channel, but the incident highlighted a major problem: disinformation quickly spreads unchecked on the encrypted app. Apparently upbeat developments in Russia's discussions with Ukraine helped at least temporarily send investors back into risk assets. Russian President Vladimir Putin said during a meeting with his Belarusian counterpart Alexander Lukashenko that there were "certain positive developments" occurring in the talks with Ukraine, according to a transcript of their meeting. Putin added that discussions were happening "almost on a daily basis." Telegram, which does little policing of its content, has also became a hub for Russian propaganda and misinformation. Many pro-Kremlin channels have become popular, alongside accounts of journalists and other independent observers.
from ms