Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ruby 風シンタックスな静的言語 Crystal の紹介
Search
Pine Mizune
June 23, 2015
Programming
310
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby 風シンタックスな静的言語 Crystal の紹介
社内新卒技術勉強会の資料
Pine Mizune
June 23, 2015
Transcript
15 slides
Crystal Ruby 風シンタックスな静的言語の紹介 水音ぴね
目次 • Crystal とは ? • Crystal と Ruby の相違点
• Crystal の使い所とは ? • Crystal の開発進捗
Crystal とは ? ヒトコトで言うと …? 3 u Ruby の表現力
u C の速度 を兼ね備えた言語 と
Crystal 詳細 • Ruby に酷似した syntax • 静的型付け / コンパイラ言語
– LLVM ベース • 非常に高速 • C 言語資源の再利用性を重視 4
Ruby の復習 5 • 動的型付け • インタプリタ /
JIT コンパイラで動作 • Ruby on Rails がとても有名 – ORM のチューニングが大変なことで有名 • Pascal / Delphi 系 シンタックス
Ruby syntax require ‘sinatra’ get ‘/’ do name =
if params[:name] params[:name] else ‘anonymous’ end ” Hello world, #{name} ” end 6 # 制御構文に括弧はない # メソッド呼び出しのカッコを省略できる # end 地獄
Crystal syntax app = App.new
app.route “/”, do |req| name = if req.get.has_key? “name” req.get[“name”] else “anonymous” end ok("Hello world, #{name}") end app.run(ENV[“PORT”].to_i) 7 # 入らなかったので require 省略してます # end 地獄は健在 # Hash の key が無いと exception # (Ruby よりちょっと厳しい) # to_i 使える!
Crystal syntax ≒ Ruby syntax 8 • ほとんど同じだって
Matz も言ってる!! 出展: https://twitter.com/yukihiro_matz/status/610842781091672064
Crystal と Ruby の相違点 9 Ruby 比較項目 Crystal 遅い
実行速度 早い 可能 (FFI / Extension) C との連携 容易 (それを前提に設計) 中央管理 (rubygems.org) ライブラリ リポジトリ 分散 (git) Bundler 依存モジュール管理 コンパイラに内蔵 安定フェーズ (v2.2.x) 安定性 開発フェーズ (v0.7.x)
Crystal の使い所 10 • 速度が求められる場所 • C /
C++ からの段階的移植 • Ruby エンジニアが多い環境での新規採用 • クロスプラットフォームで高速な CLI ツール (現状の Golang の領域) もちろん、安定版という条件ですが
11 Crystal の開発進捗について ※ 『 のんのんびより りぴーと 』 は
7月6日 スタート!
• 最新版: v0.7.3 (2015/06/07) • セルフホスティングコンパイラ – ある仕様 FIX &
安定動作するフェーズ • 安定した開発 12 [Crystal 進捗] 全般
• Linux – 公式サポート: Debian / Ubuntu / RHEL / CentOS
• Mac OS X – Homebrew tap を提供 • Windows – 未サポート – GitHub に Issue はある ... 13 [Crystal 進捗] 対応環境
• コンパイラに内蔵 – Golang と同じかんじ • 依存関係は Projectfile に記述 –
Cpanfile, Gemfile と同じかんじ • 分散型 リポジトリ – GitHub を直接参照 / Golang と(ry 14 [Crystal 進捗] パッケージマネージャ Ruby ... gem, Bundler Perl ... cpanm, Carton
Fin.
More Decks by Pine Mizune
See All by Pine Mizune
多言語対応と絵文字ジェネレーター / i18n of Emoji Generator
pine
0
920
C++ 製グラフィックライブラリ Skia の紹介 / Introduction to the graphics library Skia written by C++
pine
0
2k
asyncio + aiohttp で作るウェブサービス / How to develop a web service with asyncio and aiohttp
pine
0
730
Lerna による明示的疎結合アーキテクチャ
pine
1
700
CircleCI 2.0 x JavaScript
pine
3
600
Perl 卒業式
pine
0
390
Android Studio の気になる warnings を抑制する方法まとめ
pine
0
550
Emoji Generator meets Browser Extensions
pine
1
3k
近年の OSS 開発における CI 選択のベストプラクティス
pine
3
4.6k
Other Decks in Programming
See All in Programming
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
240
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
440
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
180
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
520
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
210
初学者向け 分散トレーシングとDatadog
mtaka1222
0
100
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
670
joyful-journey-spring-boot.pdf
hollycummins
0
130
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
230
Kiro Crewによる開発体験ーKiro CrewでStrands Decider 2B に関する技術検証をやってみた
satoshi256kbyte
1
230
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
450
Stage 3でも仕様は変わる。アプリケーション開発者のためのTC39プロセスの読み方
bicstone
1
1k
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
4k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
700
The Curse of the Amulet
leimatthew05
4
17k
The Language of Interfaces
destraynor
163
27k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
340
Building Applications with DynamoDB
mza
96
7.3k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
360
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How Software Deployment tools have changed in the past 20 years
geshan
3
35k