Coder Social home page Coder Social logo

Lab0:Go语言入门 about mit-6.824 HOT 4 OPEN

chaozh avatar chaozh commented on July 17, 2024
Lab0:Go语言入门

from mit-6.824.

Comments (4)

chaozh avatar chaozh commented on July 17, 2024

下面是Go语言的FAQ

  1. 能否关闭对未使用的包引入或变量的警告?参考官方解答 肯定是不推荐关闭的
  2. 其他编程语言中有defer关键字吗?defer关键字由go语言首先发明,本来用于解决panic的恢复,比如defer mu.Unlock()防止死锁
  3. 为何要把类型申明放到变量的后面,而不学C族语法?参考官方解答其实弱类型语言好像有将类型放后面的趋势(比如遵守ES标准的ActionScript),这样可以先var再说明具体类型嘛
  4. 为何不使用类似C++/Java的类来实现OOP?模型更像smalltalk,相比C++/Java更加轻量级减少侵入,参考Google I/O 2010演讲
  5. 为何struct多行定义要求使用分号分行?防止出现JS里面关于分号的复杂处理,Go语言里面直接隐式在每行末尾添加分号
  6. 为何列表list定义方法不一致,有些有逗号,有些又没有?原因基本上面已经回答了,那些没逗号的其实需要分号,而分号是可以隐式添加的
  7. 为何使用for实现while功能?其实不需要相同功能的关键字
  8. 为何特别关注并发和协程?使用channel和轻量级协程比线程更有效参考之前的试验

如果已经可以轻松回答下列问题,那么你只需要完成之后的Go语言编程作业就可以了:在线练习中要求实现Crawler和简单KV
答案在 #3

  1. :==的区别? 前者a:=3是变量声明var a int = 3的缩写
  2. range如何使用?仅配合slice或map遍历使用,for k, v := range SLICE_OR_MAP,注意默认是k,只取v得使用_, v
  3. make如何使用?用于创建slice或map,make(map[k]v),这些结构的初始化都使用{}
  4. 函数可以作为变量?是的,可以作为函数形参,也可以直接赋予给变量,函数还支持闭包
  5. 如何使用接口?type NAME interface { FUN() RET_VAL },结构实现相同函数即可,进行赋值
  6. 如何创建通道?使用c := make(chan int),可以配合selectcase <- 关键字使用

from mit-6.824.

chaozh avatar chaozh commented on July 17, 2024

练习做完后可以看此链接

from mit-6.824.

lexieqin avatar lexieqin commented on July 17, 2024

请问这个lab0的内容在哪里可以找到啊?

from mit-6.824.

sikuntiannan avatar sikuntiannan commented on July 17, 2024

请问这个lab0的内容在哪里可以找到啊?

http://nil.csail.mit.edu/6.824/2020/schedule.html

from mit-6.824.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.