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
NULLに関する一考察 #TechLunch
Search
Livesense Inc.
PRO
April 23, 2014
Technology
81
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
NULLに関する一考察 #TechLunch
2011/10/05(水) @ Livesense TechLunch
発表者:桂 大介
Livesense Inc.
PRO
April 23, 2014
Transcript
28 slides
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
More Decks by Livesense Inc.
See All by Livesense Inc.
新規商品の開発におけるAIの活用 〜挑戦は人間にしかできない〜
livesense
PRO
0
32
味覇で作るパスタが美味い - 20261001_yabaubuki.dev
livesense
PRO
0
200
Rubyはただの⾔語に⾮ず
livesense
PRO
0
610
28新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
0
180
27新卒_総合職採用_会社説明資料
livesense
PRO
0
7.9k
27新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
0
13k
株式会社リブセンス・転職会議 採用候補者様向け資料
livesense
PRO
0
620
株式会社リブセンス 会社説明資料(報道関係者様向け)
livesense
PRO
1
1.8k
データ基盤の負債解消のためのリプレイス
livesense
PRO
0
750
Other Decks in Technology
See All in Technology
契約書SaaSにAIエージェントを組み込む
sansantech
PRO
0
170
「AIチャットからもできないの?」と言われたら ~業務アプリをMCP対応するときの認証・認可の勘所
oidfj
0
360
おうち環境でも「なるべく止めたくない!」 ― おうち環境の機器冗長化の理想と現実
yuutosi
1
490
Re:ゼロから始めるシェアハウスのペットな鯖
silmin_
0
170
20261113_JAWS_Osaka
takuyay0ne
0
550
常時稼働エージェントの作り方(Claude公式ブログを資料化)
minorun365
PRO
14
24k
専門家に使ってもらうAIプロダクトをつくる - 病院の医事課向けDPCコーディング支援システムの設計と評価
hagino3000
1
120
Sonnetだけで業務はまわる?
kintotechdev
1
140
マネジメントされる側の仕事は「文句」を言うこと
riyaamemiya
6
5.5k
ラクスル会社紹介資料|エンジニア向け / RAKSUL Introduction for Engineers
raksulrecruiting
0
120
Skill とカスタムエージェント (手順と役割を渡す) | 目指せ Kiro マスター 08
inariku
PRO
2
110
Community Over Code Glasgow 2026 + Lakehouse Day recap
lycorptech_jp
PRO
1
120
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
240
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Building AI with AI
inesmontani
PRO
1
1.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
A Soul's Torment
seathinner
9
3.9k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Building Applications with DynamoDB
mza
96
7.3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.8k
Technical Leadership for Architectural Decision Making
baasie
4
650
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k