Presentation is loading. Please wait.

Presentation is loading. Please wait.

Trends in Scripting Languages History For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative.

Similar presentations


Presentation on theme: "Trends in Scripting Languages History For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative."— Presentation transcript:

1

2 Trends in Scripting Languages

3 History For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to make programmers happy. Yukihiro “Matz” Matsumoto

4 History  1993  Fill what lacked in Perl and Python  More powerful than Perl  More Object Oriented than Python  Facilitate creativity  1995 – First release

5 Basic Syntax #example if-block if goldilocks > 10 puts “too big” elsif goldilocks < 10 puts “too small” else puts “just right” end

6 Basic Syntax #example function call def my_funct(arg) “Hello #{arg}” end puts my_funct(“world!”)

7 Example Bear Object Part 1  Initialization  Accessor Methods  Mutator Methods

8 Types  Seven basic types: numbers strings hashes ranges symbols regular expressions

9 Types - Numbers num = 81 6.times do puts “#{num.class}: #{num}” num *= num end

10 Types - Strings  single quoted strings  double quoted strings puts ‘string \n string’ puts “string \n string”

11 Types - Hashes  Basically Associative Arrays  Uses {} and => notation bears = { “mamma” =>1, “pappa” =>2, “baby” =>3 } puts[“pappa”]

12 Types - Ranges  Inclusive ranges (‘a’..’e’)  Exclusive ranges (‘a’…’e’)  As a “Comparator” must support comparable operator must implement the succ method

13 Example Bear Object Part 2  Implementing Range support Comparable operator succ method

14 Types – Regular Expressions  Pattern matching of String objects  Object of class Regexp declared from constructor defined directly re1 = Regexp.new(‘[a-z]’) re2 = /[a-z]/ “Goldilocks” =~ re1 “GOLDILOCKS” =~ re1

15 Scope of Variables  Specific syntax for declaring scope LocalGlobalInstanceClassConstant var$var@var@@varVar  Local  within each block  Global, Instance, Class  maintain their scope with their respective definition Can use the :: operator i.e. ClassName::ConstName

16 Conclusion  A programmer’s language  Readability vs. Writability  Facilitate creativity?

17 Questions?


Download ppt "Trends in Scripting Languages History For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative."

Similar presentations


Ads by Google