<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hkdnet</author_name>
  <author_url>https://blog.hatena.ne.jp/hkdnet/</author_url>
  <blog_title>Smoky God Express</blog_title>
  <blog_url>https://hkdnet.hatenablog.com/</blog_url>
  <categories>
    <anon>Crystal</anon>
  </categories>
  <description>環境 $ crystal version Crystal 0.15.0 [0f62400] (Fri Apr 1 16:59:50 UTC 2016) $ crenv --version crenv 1.0.0-7-g578eb0a 問題点 適当に getter や property を生やしてるとNot Nilであることをコンパイラが検知できなくて困る 対応策 getter に型定義を書いておく 型推論を活かしつつ getter! あるいは property! を使う initialize 内で インスタンス変数 @fuga に値を入れる 楽に書きたい派なので getter! を好んで使って…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhkdnet.hatenablog.com%2Fentry%2F2016%2F04%2F25%2F010531&quot; title=&quot;Crystalでnot nilなgetterを定義する - Smoky God Express&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2016-04-25 01:05:31</published>
  <title>Crystalでnot nilなgetterを定義する</title>
  <type>rich</type>
  <url>https://hkdnet.hatenablog.com/entry/2016/04/25/010531</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
