SlideShare a Scribd company logo
1 of 37
Download to read offline
ラクダがピンクだった頃
の思い出
2018年9月14日
六本木.pm #1
近藤 嘉雪 (@yoshiyuki_kondo)
About Me
• 近藤 嘉雪 (こんどう よしゆき)
• ラクダ本(Programming Perl)、リャマ本(Learning Perl)
の訳者です。
• 某Web系企業で働いています。
(Perlじゃないけど)
こんな本も出してます
絶版 1990年8月
WARNING
• 昔の話、しかもかなりtrivialな話をします。実用性はあまり期
待しないでください。
• 近藤個人が感じた/思ったことを話します。
• 主観が入ったり、記憶があやふやだったりする点が多々ありま
すが、お許しください。
• とりとめのない話になっていて、話題もいろいろと飛びます。
思い出話なので: )
Perl4の時代は、ラクダ本もリャマ本も
ピンクでした
Larry Wallさんのサイン
Perlの歴史
• 1.0 1987/12/18
• 2.0 1986/6/5
• 3.0 1989/10/18
• 4.0 1991/3/21 ピンクのラクダ
• 5.0 1994/10/17 青いラクダ
• 5.5.0 1998/7/22
• 5.6.0 2000/5/22
• 5.8.0 2002/7/18
O’ReillyからProgramming
Perlが出たタイミングで、
Perlのバージョンが4に
なった。
そのころのネット環境
• 常時接続(いわゆるインターネット)は存在していたが、研究
用の環境という位置づけ
• 先進的な大学、先進的な企業の研究所は常時接続
• 小規模な会社は、モデム(Trailblazer)を使ってダイアルアッ
プでuucp接続していた。
• Uucp 経由でネットニュース(Usenet)、メールを利用
• (例えば)30分間隔でポーリング。メールがすぐに届かない!
Perlをいじりはじめたころ
• O’ReillyからProgramming Perlが出たタイミングで、Perlの
バージョンが4になった。
• 近藤はPerl3の途中からPerlをいじり始めた。
• ネットニュースのcomp.sources.miscに流れてきたsharアーカ
イブで入手していた
Perl 4.0のcomp.sources.miscのネットニュース記事
• http://ftp.fi.netbsd.org/pub/misc/archive/comp.sources.misc/volume18/perl/
Path:
funic!news.funet.fi!sunic!mcsun!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!samsung!usc!
cs.utexas.edu!uunet!sparky!kent
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.sources.misc
Subject: v18i019: perl - The perl programming language, Part01/36
Message-ID: <1991Apr15.015207.6491@sparky.IMD.Sterling.COM>
Date: 15 Apr 91 01:52:07 GMT
Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield)
Organization: NetLabs, Inc.
Lines: 1250
Approved: kent@sparky.imd.sterling.com
X-Checksum-Snefru: afd48341 45aaf0a0 c8af2495 9685a77c
Submitted-by: Larry Wall <lwall@netlabs.com>
Posting-number: Volume 18, Issue 19
Archive-name: perl/part01
[There are 36 kits for perl version 4.0.]
This is being posted at patchlevel 3. -Kent+]
Perl is a language that combines some of the features of C, sed, awk and shell.
#! /bin/sh
# Make a new directory for the perl sources, cd to it, and run kits 1
# thru 36 through sh. When all 36 kits have been run, read README.
[
echo "This is perl 4.0 kit 1 (of 36). If kit 1 is complete, the line"
echo '"'"End of kit 1 (of 36)"'" will echo at the end.'
echo ""
export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
mkdir eg eg/sysvipc h2pl msdos os2 t t/op usub 2>/dev/null
echo Extracting os2/README.OS2
sed >os2/README.OS2 <<'!STUFFY!FUNK!' -e 's/X//'
X Notes on the OS/2 Perl port
X
X Raymond Chen
X (rjc@math.princeton.edu)
X
X Kai Uwe Rommel
X (rommel@lan.informatik.tu-muenchen.dbp.de)
X
X-1. Background.
X
XThis port was based on the MS-DOS port by Diomidis Spinellis.
X
X0. Set-up.
X
XFirst copy the files in the os2 directory into the parent
Xdirectory. Also install the file msdos/dir.h in your include
Xdirectory.
X
X1. Compiling.
X
そのころの開発環境
• マシンはSunのSparc Station 1 (SS-1)
• メモリはたぶん16メガバイト
• ディスクは500メガバイトくらいか?
• 3人で、PC9801からログインして使用
• X windowはインストールしたが、普段は使わなかった
• エディタはEmacs (Nemacs)を使っていた。
• Eight Megs And Constantly Swapping
Larry Wallが創った「スクリプト言語」という概念
• https://twitter.com/unix_byte/st
atus/1033216768074862592
スクリプト言語の位置づけ
sed + awk + shell
C, C++
sed + awk + shell
C, C++
スクリプト言語 Perl
Perlを使って当時感じたこと
• それまでは主にCでプログラムを書いていた
• Sed + awk + shellスクリプトを1つの言語にまとめたもの
• s//とか//のsedの記法がそのまま使えるのは便利
• 文字列の操作が簡単。s//演算子+正規表現は強力!
• <>が便利。
• $_は(慣れると)便利
Perlを使って当時感じたこと
• コンパイルする必要がないので、ターンアラウンドが短い
• BASICでプログラムを書いていた頃を思い出した
• 標準Cライブラリの関数が一通り使える
• 文字列の扱いがCに比べて格段に楽!
• 教育用システムのVMのバイトコードアセンブラ
sed + awk + shell
C, C++
sed + awk + shell
C, C++
スクリプト言語 Perl
Cライブラリを使
えるうえに、
コンパイルが不要
Perl4の弱いところ
• モジュール機能がない
• requireでPerlのソースを読み込む、という素朴な機能のみ
• 外部ライブラリを利用するには、バイナリを作る必要があった
• 例えば、Oracleにアクセスするためのoraperl
• リファレンスがない
• 複雑なデータ構造が表現できない
• とはいえ、割りきればよい
Perl 4での日本語の扱い
• 当時は、Unicodeの前の時代。
• 日本語コードはShift-JISとEUC。
• MS-DOS/WindowsはSJIS。Unixでは、EUCがメジャーで
あった。
• 日本語の2バイトコードを認識するようにパッチをあ
てた、jperlというバージョンがあった。
• 日本語コードを変換するjcode.plというライブラリが
あった
Programming Perl (1st edition)
• 当時はまだオライリーの日本法人はなかった。日本の出版社が
個別にUSのオライリーと契約していた。
• 知り合いのソフトバンクの編集者から、Programming Perlを翻
訳しませんか、と打診があった。
• Perlは面白いと思っていたので、OKした。
• LaTeXで組版した(リャマ本の初版も)
• 最初のラクダ本は、1st printingと2nd printingでは、内容に大
きな違いがあった。2nd printingで大幅に加筆増ページされて
いた。
ラクダ本を書いた環境
• 1993年1月現在
• マシン:Gateway 2000 486/33C (486DX-33MHz, RAM 8M
bytes, HDD 200M bytes)
• OS: DOS/V 5.00
• DOS-Extender上の日本語TeXを使用
• プレビューアはdvioutを個人的に改造したもの
• 印刷はdvi2psを使用
• エディタは、Demacs、日本語入力はTコードドライバtc.el
• 索引はPerlで書いたスクリプトを使って作成
ピンクのラクダ本はジョークがてんこ盛り
• 特に用語集にジョークが多く、訳すのが大変だった
• Endian
• See Little-Endian or Big-Endian, but not both.
• エンディアン
• リトルエンディアンあるいはビッグエンディアンを参照。ただしどちら
か一方のみを参照すること。
Little-Endianを見ると
• Little-Endian
• From Swift, someone who eats eggs little end first. Also used of computers that
store the least significant byte of a word at a lower byte address than the most
significant byte. Often considered superior to big-endian machines. See also Big-
Endian.
• リトルエンディアン
• スウィフトの作品に登場する、タマゴをlittle end(トガっているほう)から食べ始
める人のこと。また転じて、ワードのうち最下位バイトを、最上位バイトより低位
のバイトアドレスに格納するコンピュータのこと。しばしばビッグエンディアンマ
シンよりも優れていると考えられている。ビッグエンディアンも参照。
• これは第4版でもこのまま。
• 第2版、第3版では訳注を入れた(余計なお世話?)
• 「ガリバー旅行記」のこと。Little-endianは、この作品に登場するリリパット人の正
統派である。
Loopを見ると
• Loop
• A syntactic construct that can make things happen more than once.
See Loop.
• ループ
• 物事を何回も起こるようにするための構文上の構造。ループを見よ。
• いわゆる「再帰」。ありがちといえばありがち。
Loop Labelを見ると
• Loop Label
• The nutritional information on the side of the popular (at
Randal’s house) cereal box. Or, a kind of key or name attached to
a loop so that loop control statements can talk about which loop
they want to control.
• ループラベル
• (Randal家で)人気のあるシリアルの箱の脇に書いてある栄養成分表
のこと。あるいは、ループ制御文から対象となるループを指定できる
ように、ループにつけたキーの一種または名前のこと。
• これは何?
Loop Labelの正体
• いまはネットで検索すればすぐ出てくる。
• “cereal loop”で検索!
• https://en.wikipedia.org/wiki/Froot_Loops
単なるダジャレ:翻訳不能のものも
• Parameter
• What you get when you cross paramedic and meter maid. See also
Argument, which is what you get when you just cross a meter maid.
• パラメータ
• Paramedicとmeter maidを交配させて得られるもの*1。あなたが婦人
警官に逆らうときに起こる言い争い(引数)も見よ*2。
• 注釈を付けた
• *1 paramedicは看護助手。Meter maidは駐車違反を取り締まる婦人
警官。要するに単なるダジャレである。
• *2 これはargumentが「引数」と「言い争う」の2つの意味を持つこ
とをかけている。
ピンクのラクダ本はジョークがてんこ盛り
• 第2版(青いラクダ本)では、このようなダジャレ、過剰な
ジョーク(のかなり)は削除されてしまった
• 寂しいような気がする。翻訳は楽になったけど: )
青いラクダの時代: Perl 5
• 一人前の言語になった。
• リファレンス
• オブジェクト(指向)
• モジュール
• クロージャ
• Unicode
Perl5になって、ラクダ本もリャマ本も青
くなった
• オライリージャパンが設立された。
• ラクダ本もリャマ本も、オライリージャパンから出しました。
• ラクダ本の日本語訳3版は上下2巻組となった。分量が。。。
Perl 5で導入された機能
• リファレンスが導入された。
• これであらゆるデータ構造が表現可能になった!
• 何でも書ける。
• 個人的にはクロージャが導入されたのには驚いた。というか感
動した。
• 私はLisperでもあるので:-)
• オブジェクト指向については、Object Oriented construction
kitといった感じ。
Perl 5で導入された機能
• my変数が導入された。
• Perl4のlocal変数は、localはdynamic scopingであった。
• my変数は、static scoping(lexical scoping)
• (ここもLispっぽい)
• 連想配列がハッシュと改名された
• Perl4ではassociative arrayだったが、Perl 5になった時にhashと改称
された。
• (単なる)配列と連想配列ではまぎらわしかったため(であろう)。
• 実際、訳していても、まぎらわしかった: )
Perl 5で導入された機能
• Unicodeサポート
• Perl 5.0でサポートされたけれど、実装が不完全
• 最終的に安心して使えるようになったのは、Perl 5.8.0であった。
• アルファベットを使う人たちには、Unicodeサポートはあまりメリッ
トがないように見える。
• しかし、実は、Unicodeにおける、アクセント付き文字の扱いはかな
り奥が深い。
• ということを、初めてのPerl第6版を訳していて知った。
• くわしくはリャマ本の付録 C をみてください。
京都のイベントの思い出(2000/11)
• Linux Confrence 2000 Fall & Perl/Ruby Conference
• 会場: 国立京都国際会館 2000/11/29-12/1
• Larryさんが、日本のアニメ好きというのは知る人ぞ知る話(有
名な話?)。
• LarryさんがノートPCでテキストファイルを見せてくれた。
• 画面を見ると、いろんなアニメのタイトルがローマ字で書いて
あった。
• 「これを買いたいんだけど、どこで売ってるでしょうか?」
• 近藤は京都のことは全然わからない。
• 近くにいる若い人に声をかけたら、アニメに詳しい地元の(たぶ
ん)学生の人がいて、Larryさんに場所を教えてくれた。
Perl6とRuby 2.0の話
• 2000年11月のイベントの続き。
• Perl 6は2000年から設計が開始した。
• Perl 6は初めの頃はすぐに完成するような話だったが、時間がかか
り。。
• 京都のイベントで、matzさんと話す機会があった。
• 「Ruby 2.0とPerl 6のどっちが先に完成するかなあ」などと話した
記憶がある。
• Ruby 2.0は2013/2、Perl 6.0は2015/12にリリース
Perlのハッシュの実装は優れているという話
• ハッシュ関数を使って文字列からハッ
シュ値を生成
• ハッシュ値に対応するバケットに格納
• 同じハッシュ値が生成されたら(衝突)、
連結リストでつないで格納する
• 衝突があまり発生しなければO(1)でアク
セス可能
Hello, world
Good, bye
Perlのハッシュの実装は優れているという話
• Hashdos攻撃(2011年12月)
• あらかじめ、同一のハッシュ値を生成する文字列をたくさん
作っておく。
• それをウェブサーバに送り付ける
• 文字列は同一バケットに格納されるので、アクセスにO(n)かか
る!
• サーバはハッシュの操作にO(n)の時間がかかり、レスポンスが
遅くなる。Denial of service攻撃(サービス妨害)になる。
Perlのハッシュの実装は優れているという話
• 影響を受けるプラットフォーム
• Perl以外の多くの言語で影響があります。Java(Apache
Tomcat7.0.22以下、同6.0.34以下、同5.5.34以下) 、PHP、
ASP.NET、Python、Ruby(1.8.7-p356以下のみ)などです。詳し
くは、cryptanalysisの解説を参照して下さい
Webアプリケーションに対する広範なDoS攻撃手法(hashdos)の影響と対策(徳丸浩の日
記)
https://blog.tokumaru.org/2011/12/webdoshashdos.html
Thank You!

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Roppongi pm-when-camel-was-pink