LearningOS / rcore_step_by_step_old2

https://learningos.github.io/rcore_step_by_step_webdoc/
GNU General Public License v3.0
39 stars 10 forks source link

周进展纪要(7.15-7.21) #1

Open chyyuu opened 5 years ago

chyyuu commented 5 years ago

陈渝: 之前的rcore_step_by_step中有不少冗余的binary code,导致体积上百兆,且没把doc放在一起。现在进行了重构。老的放在https://github.com/LearningOS/old_rcore_step_by_step ,重构后的rcore_step_by_step 把code和doc放在一起,git clone下来只有6MB多了,目前在 https://github.com/LearningOS/rcore_step_by_step 。 参加rcore学习的同学的日记录等,可继续放到https://github.com/LearningOS/old_rcore_step_by_step中。如果是基于https://github.com/LearningOS/rcore_step_by_step 进行代码分析或尝试,可把问题放到 https://github.com/LearningOS/rcore_step_by_step/issues 中。 组织安排rust编程考试。

本周计划(7.22-7.28): 本周的任务计划是结合书籍 http://crva.io/documents/RISC-V-Reader-Chinese-v2p1.pdf 学习riscv,巩固rust语言学习,尝试ucore for rv32 or rcore for rv32.

本周退出:唐智健,陈英杰 本周加入:张译仁

coolbacon commented 5 years ago

上周参加了考试,通过考试,发现了自己的语法掌握还是不过关。rust语言的一些细节掌握的还是不到位。如:借用与引用,生命周期,泛型等。还需要不断地深入练习。

MashPlant commented 5 years ago

一直在用rust写一些实际的程序,一种情况下经常被borrow checker困扰:它不会允许一个struct的不同field被同时借用,其中有一个是可变借用。这其实是安全的,但是没办法通过函数签名表达出来,所以borrow checker不会允许通过编译。一个实际例子如下:

for m in self.nodes[n as usize].move_list.iter().filter(|&x| 
  self.active_moves.contains(x) || self.work_list_moves.contains(x)) {
  self.foo(m); /// foo 不会修改nodes,active_moves,work_list_moves,但可能修改其他field
}

本来使用迭代器可以使代码非常清晰,但是因为这个要求,必须改成这样的命令式的风格:

for i in 0..self.nodes[n as usize].move_list.len() {
  let m = self.nodes[n as usize].move_list[i];
  if self.active_moves.contains(&m) || self.work_list_moves.contains(&m) {
    self.foo(m);
  }
}

我理解前一种写法如果允许通过编译则可能产生不安全的结果,所以这个限制是合理的,但是的确不是很人性化。如果rust能够获取更细粒度的借用相关信息,就有可能让第一种写法通过编译。

此外关于lambda表达式的借用规则也比较不人性化,lambda表达式默认会借用整个struct而不是使用到的field,所以:

self.b.foo(|x| self.a.bar(x)); // 假设foo,bar至少有一个是可变借用

不能通过,但是:

let a = &mut self.a;
self.b.foo(|x| a.bar(x)); 

就可以。

huangchunzhen commented 5 years ago

上周复习的主要教材是“Rust 程序设计语言”,看完后开始继续追加“Rust编程之道”,练习使用的是“Ruby”和“C”的hard way。虽然测试没有考到,但在Rust的学习上仍有很多地方存在不足,比如元编程的宏系统,这一周在学习Risc-v的同时也得赶紧补足自己在Rust上的遗漏点。自己私下还需要继续进行大量练习。另:Risc-v流水账更新在https://github.com/LearningOS/old_rcore_step_by_step/issues/17

Yourens commented 5 years ago

上周学programming rust 到第六章。 完成issues中的练习。 做了测试题。

DeathWish5 commented 5 years ago

完成 rust程序设计语言 1-12章的学习,结合库文档对rust语法有了基本的了解,为学习rust高级特性打下基础。

juanhair commented 5 years ago

完成“rust程序设计语言 简体中文版”学习(https://kaisery.github.io/trpl-zh-cn/),“C语言练习题实现”做至15题https://github.com/juanhair/-Rust-),但是在做习题以及上周考试中发现对rust中的一些语法掌握还不够,例如生命周期以及rust强大测试功能的使用等,本周计划开始学习“risc-V系统结构”,同时继续熟练Rust编程语言并且完成C 语言练习题实现的习题。