Crystal 编译型的编程语言

Crystal 是一个编译型的编程语言。特性:

  • 语法类似 Ruby Ruby-inspired syntax.

  • 无需指定变量类型和方法参数类型 Never have to SPEcify the type of a variable or method argument.

  • 可以调用 C 代码 Be able to call C CODE by writing BINDings to it in Crystal.

  • 编译时代码模拟和生成 Have comPILe-time evaLuation and geneRATion of code, to avoid Boilerplate code.

  • 编译成高效的本机代码 Compile to efficIEnt native code.

示例代码:

# Compute prime numbers up to 100 with the Sieve of Eratosthenes
max = 100
 
sieve = Array.new(max + 1, true)
sieve[0] = false
sieve[1] = false
 
(2...max).each do |i|
  if sieve[i]
    (2 * i).step(max, i) do |j|
      sieve[j] = false
    end
  end
end
 
sieve.each_with_index do |prime, number|
  puts number if prime
end

 

Crystal 0.8.0 发布,编译型的编程语言
Crystal 0.8.0 发布,此版本主要改进:枚举定义问题方法;大大改进调试器支持;shards 成为官方依赖安装方法等等。更新内容如下:(breaking change) Renamed a couple of types: ChannelClosed -> Channel::ClosedError,UnbufferedChannel -> Channel::Unbuffered, BufferedChannel -> Channel::Buffered,DayOfWee

发布于 2015-09-21 01:22:14 | 166 次阅读

Crystal 0.7.0 发布,编译型的编程语言
Crystal 0.7.0 发布!Crystal 0.7.0 是个重大版本,非向后兼容版本,包括两个重大特性:非阻塞 IO,还有轻量级进程Iterators此版本还包括大量的 bug 修复,性能提升和改进。请注意,此版本是试验性版本!更多改进请看发行说明。Crysta

发布于 2015-05-01 23:58:59 | 161 次阅读


Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务