Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
NULLに関する一考察 #TechLunch
Search
Livesense Inc.
PRO
April 23, 2014
Technology
0
61
NULLに関する一考察 #TechLunch
2011/10/05(水) @ Livesense TechLunch
発表者:桂 大介
Livesense Inc.
PRO
April 23, 2014
Tweet
Share
More Decks by Livesense Inc.
See All by Livesense Inc.
27新卒_総合職採用_会社説明資料
livesense
PRO
0
1.5k
27新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
0
5.2k
株式会社リブセンス・転職会議 採用候補者様向け資料
livesense
PRO
0
130
株式会社リブセンス 会社説明資料(報道関係者様向け)
livesense
PRO
0
1.6k
データ基盤の負債解消のためのリプレイス
livesense
PRO
0
510
26新卒_総合職採用_会社説明資料
livesense
PRO
0
12k
株式会社リブセンス会社紹介資料 / Invent the next common.
livesense
PRO
2
47k
26新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
1
13k
中途セールス職_会社説明資料
livesense
PRO
0
280
Other Decks in Technology
See All in Technology
AWS CLIの新しい認証情報設定方法aws loginコマンドの実態
wkm2
6
750
Kiro Autonomous AgentとKiro Powers の紹介 / kiro-autonomous-agent-and-powers
tomoki10
0
530
Power of Kiro : あなたの㌔はパワステ搭載ですか?
r3_yamauchi
PRO
0
180
Database イノベーショントークを振り返る/reinvent-2025-database-innovation-talk-recap
emiki
0
220
GitHub Copilotを使いこなす 実例に学ぶAIコーディング活用術
74th
3
3.4k
文字列の並び順 / Unicode Collation
tmtms
3
600
生成AIを利用するだけでなく、投資できる組織へ / Becoming an Organization That Invests in GenAI
kaminashi
0
100
re:Invent2025 コンテナ系アップデート振り返り(+CloudWatchログのアップデート紹介)
masukawa
0
390
学習データって増やせばいいんですか?
ftakahashi
2
460
Jakarta Agentic AI Specification - Status and Future
reza_rahman
0
110
生成AI活用の型ハンズオン〜顧客課題起点で設計する7つのステップ
yushin_n
0
230
MLflowで始めるプロンプト管理、評価、最適化
databricksjapan
1
250
Featured
See All Featured
Six Lessons from altMBA
skipperchong
29
4.1k
Site-Speed That Sticks
csswizardry
13
1k
A better future with KSS
kneath
240
18k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Scaling GitHub
holman
464
140k
Docker and Python
trallard
47
3.7k
Designing for humans not robots
tammielis
254
26k
Code Review Best Practice
trishagee
74
19k
BBQ
matthewcrist
89
9.9k
The Language of Interfaces
destraynor
162
25k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
Building an army of robots
kneath
306
46k
Transcript
NULL に関する ー 考 察
[email protected]
NULL に関する ー 考 察
[email protected]
/nʌl/
nullus
From ne (“not”) + ūllus (“any”), literally meaning "not any".
Differences in dealing with null
null = undefined
PHP $value // null isset($value) // false is_null($value) // true
$value === null // true unset($value) $value = null $hash = array('key' => null) array_key_exists('key', $hash) // true isset($hash['key']) // false
Perl 5 $value // undef defined $value // false undef
$value
Perl 6 my $value $value // Any() $value = Nil
$value // Any() $value.defined // Bool::False
null and undefined
Javascript value; // undefined typeof value === 'undefined' // true
value === void 0 // true value = void 0; value = null value === null // true
null only
Ruby value // NameError defined? value // nil(false?) undef value
value = nil value.nil? // true
Python value // NameError del value value = None value
is None // true
wrapped null
Scala Option v1 = Some(1) v2 = None v1.getOrElse(2) //
1 v2.getOrElse(2) // 2
Haskell Maybe v1 = Just 1 v2 = Nothing getValueOrTwo
v = case v of Just x -> x Nothing -> 2 getValueOrTwo v1 // 1 getValueOrTwo v2 // 2
int main() { for(int j=-5; j<=5; ++j) { optional<int> x
= sqrt(j); if( x ) cout << *x << endl; else cout << "invalid" << endl; } } boost::optional
boxing
C# nullable int? value = null value.HasValue // false Nullable.GetValueOrDefault(value,
123) // 123 Value ?? 123 // 123
making null
C++ nullptr const class nullptr_t { public: template<class T> operator
T*() const { return 0; } template<class C, class T> operator T C::*() const { return 0; } private: void operator&() const; } nullptr = {};
One more thing
void f( tribool b ) { if( b ) cout
<< "True" << endl; else if( !b ) cout << "False" << endl; else cout << "Indeterminate" << endl; } int main() { tribool x = indeterminate; f(x); // Indeterminate f(true && x); // Indeterminate f(true || x); // True } boost::logic::tribool
考察 • null は必要だけど null チェック地獄 • null と値でインターフェースを合わせるのが時 代の流れ
• →Option, nullable • →coffee script • →presence • →null object pattern
次回予告
None