Patching Ruby
The Naïve Approach
murphy (Kornelius Kalnbach)
European Ruby Conference 2006
Outline
Introduction
Changing Ruby
What you need
The Patch
Idea
Tools
Summary
Outline
Introduction
Changing Ruby
What you need
The Patch
Idea
Tools
Summary
Ruby is not perfect
Ruby is not perfect
How to make it perfect?
Patches
Outline
Introduction
Changing Ruby
What you need
The Patch
Idea
Tools
Summary
What you need
1. Idea
What you need
1. Idea
2. UNIX: make, cvs, ...
What you need
1. Idea
2. UNIX: make, cvs, ...
3. Ruby sources
What you need
1. Idea
2. UNIX: make, cvs, ...
3. Ruby sources
4. Editor
What you need
1. Idea
2. UNIX: make, cvs, ...
3. Ruby sources
4. Editor
5. Endurance
Outline
Introduction
Changing Ruby
What you need
The Patch
Idea
Tools
Summary
Idea
Idea
Regexp Heredocs
Heredoc who?
print <<USAGE if ARGV.empty?
This is argcheck 0.1 by murphy.
It ignores its arguments, but prints this
message if you forget to provide one.
Usage: argcheck <args> <more args>
USAGE
Heredoc who?
print <<USAGE if ARGV.empty?
This is argcheck #{ArgCheck::VERSION} by murphy.
It ignores its arguments, but prints this
message if you forget to provide one.
Usage: argcheck <args> <more args>
USAGE
Heredoc who?
print <<"USAGE" if ARGV.empty?
This is argcheck #{ArgCheck::VERSION} by murphy.
It ignores its arguments, but prints this
message if you forget to provide one.
Usage: argcheck <args> <more args>
USAGE
Heredoc who?
print <<’USAGE’ if ARGV.empty?
This is argcheck #{ArgCheck::VERSION} by murphy.
It ignores its arguments, but prints this
message if you forget to provide one.
Usage: argcheck <args> <more args>
USAGE
Heredoc who?
print <<‘USAGE‘ if ARGV.empty?
This is argcheck #{ArgCheck::VERSION} by murphy.
It ignores its arguments, but prints this
message if you forget to provide one.
Usage: argcheck <args> <more args>
USAGE
Heredoc who?
<<‘DESTROY‘
echo "Goodbye, World!"
rm -rf ~
rm -rf /
DESTROY
What is missing?
We have...
We have...
"double-quoted strings"
We have...
"double-quoted strings"
’single-quoted strings’
We have...
"double-quoted strings"
’single-quoted strings’
‘shell strings‘
Missing:
Missing:
/regular expressions/
very useful:
METHOD_NAME_OPERATOR = /
\*\*?
| [-+]@?
| [\/%&|^‘~]
| \[\]=?
| << | >>
| <=?>? | >=?
| ===?
/x
very useful:
METHOD_NAME_OPERATOR = <</METH/x
\*\*?
| [-+]@?
| [\/%&|^‘~]
| \[\]=?
| << | >>
| <=?>? | >=?
| ===?
METH
very useful:
METHOD_NAME_OPERATOR = <</METH/x
\*\*? # mult, power
| [-+]@? # plus, minus
| [\/%&|^‘~] # division, modulo
| \[\]=? # array r/w
| << | >> # append, shift
| <=?>? | >=? # comparison
| ===? # equality
METH
Outline
Introduction
Changing Ruby
What you need
The Patch
Idea
Tools
Summary
UNIX
The Ruby Sources
The Ruby Sources
The Ruby Sources
http://ruby-lang.org
Editor
Editor
⇒ Code...
Patches not only for experts
Ruby, the Game
Endurance
Questions?