本文譯自 Julio Merino 2018 年七月撰寫的 Rust vs. Go 一文。Julio Merino 是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。
Thanks Julio Merino for this awesome article!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<!-- 1. The <iframe> (and video player) will replace this <div> tag. --> | |
<div id="player"></div> | |
<div>Current Time: <span id="time"></span></div> | |
<script> | |
// 2. This code loads the IFrame Player API code asynchronously. | |
var tag = document.createElement('script'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A concurrent prime sieve | |
// via: http://golang.org/doc/play/sieve.go | |
package main | |
// Send the sequence 2, 3, 4, ... to channel 'ch'. | |
func Generate(ch chan<- int) { | |
for i := 2; ; i++ { | |
ch <- i // Send 'i' to channel 'ch'. | |
} |