😜 水一篇文章应该不过分吧!
| 排名 | 发布年份 | 语言 | Star/k | 项目地址 |
|---|---|---|---|---|
| 1 | 2009 | Go | 76.7 | github.com/golang/go |
| 2 | 2012 | TypeScript | 64.4 | github.com/microsoft/T… |
| 3 | 2014 | Swift | 53.5 | github.com/apple/swift |
| 4 | 2010 | Rust | 48.3 | github.com/rust-lang/r… |
| 5 | 1991 | Python | 33.6 | github.com/python/cpyt… |
| 6 | 2011 | Kotlin | 33.4 | github.com/JetBrains/k… |
| 7 | 2012 | Julia | 29.4 | github.com/JuliaLang/j… |
| 8 | 1995 | PHP | 28.2 | github.com/php/php-src |
| 9 | 1993 | Ruby | 17.3 | github.com/ruby/ruby |
2009 — Go
// 模块初始化: go mod init main
// 编译: go build -o main main.go
package main
import "fmt"
func Hello(s string) string {
return "Hello " + s
}
func main() {
str := Hello("World")
fmt.Printf("%s\n", str)
}
2012 — TypeScript
// 编译成JS: tsc main.ts
// 解释执行: node main.js
function Hello(s: string) {
return `Hello ${s}`
}
let str: string = Hello("World")
console.log(str)
2014 — Swift
// 生成项目: swift package init --type executable
// 编译: swift build --build-path bin
func Hello(s: String) -> String {
return "Hello " + s
}
let str = Hello(s: "World")
print(str)
2010 — Rust
// 生成项目: cargo new main_rs
// 编译: cargo build
fn hello(s: String) -> String {
return "Hello ".to_string() + &s;
}
fn main() {
let str = hello("World".to_string());
println!("{}", str.to_string());
}
1991 — Python
# 解释执行: python3 main.py
def Hello(s):
return "Hello " + s
str = Hello("World")
print(str)
2011 — Kotlin
// 编译成中间文件: kotlinc main.kt
// 解释执行: kotlin MainKt
fun Hello(s: String): String {
return "Hello $s"
}
fun main() {
val str = Hello("World")
println(str)
}
2012 — Julia
# 解释执行: julia main.jl
function hello(s)
return string("Hello ", s)
end
str = hello("World")
println(str)
1995 — PHP
<?php
// 解释执行: php main.php
function Hello($s)
{
return "Hello " . $s;
}
$str = Hello("World");
echo $str . "\n";
1993 — Ruby
# 解释执行: ruby main.ru
def Hello(s)
puts "Hello " + s
end
str = Hello("World")
puts str