LoginSignup
25
15

More than 3 years have passed since last update.

文法がRuby風味のプログラミング言語

Last updated at Posted at 2018-10-08

なんとなく集めて見た

そんなに意味はない、文法がRubyっぽいからってどうこうはない

Ruby風味のプログラミング言語って具体的に何?

Elixir

最近話題の言語。
ErlangのVM上で動く、動的型付けの関数型言語です。
elixir
Erlangの恩恵(耐障害性など)を受けつつ、Rubyのような書きやすさを実現した魅力的な言語です。
また、ElixirのWebApplicationフレームワーク、Phoenixも勢いがあります!
Phoenixのコンセプトは"Productive. Reliable. Fast."
あーーーー、もう魅力的ですね。生産性はあり、そして信頼性があり高速。
Railsの代替になるのももうすぐでしょうか。

Elixirのコード


current_process = self()

# Spawn an Elixir process (not an operating system one!)
spawn_link(fn ->
  send current_process, {:msg, "hello world"}
end)

# Block until the message is received
receive do
  {:msg, contents} -> IO.puts contents
end

詳しくは。
https://qiita.com/HirofumiTamori/items/0dfdbada30c7d8f183fd
https://phoenixframework.org/

Crystal

静的型付けのコンパイラ言語。
まだα版です。
crystal

Crystalのコンセプトは"Fast as C, Slick as Ruby"
Cのように速く、Rubyのように滑らかに。
これもRubyの良さを生かしパフォーマンスがありとてもかっこいいですね!!

CrystalはElixirと違って、静的型付け言語です。
Rubyがファースト言語でしたから、静的型付けは慣れなかったんですけど、Rustを始めてから少しずつ慣れてきました。静的型付けなら実行しなくても単純なエラーをすぐに発見できるので良いですよね。(当たり前)
Rubyを書いてるようなのに静的型付けで素晴らしいと思いました。
また、Null安全性を取り入れていますよ。
そして、マクロというシステムがあり、コードの重複を排除すると言うメリットがあります。

Crystalのコード


# A very basic HTTP server
require "http/server"

server = HTTP::Server.new do |context|
  context.response.content_type = "text/plain"
  context.response.print "Hello world, got #{context.request.path}!"
end

puts "Listening on http://127.0.0.1:8080"
server.listen(8080)

詳しくは。
http://ja.crystal-lang.org/

おまけ

Goby

Goによる(ほぼ)Ruby実装。
主にAPIサーバやマイクロサービスの作成のための言語だそうです。
goby
https://github.com/goby-lang/goby

最後に

みなさん、Elixir,Crystal使ってみてください。

25
15
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
15