1 / 17

Trends in Scripting Languages

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 side of programming, so Ruby is designed to make programmers happy. Yukihiro “Matz” Matsumoto. History. 1993

farrah
Download Presentation

Trends in Scripting Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Trends in Scripting Languages

  2. 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

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

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

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

  6. Example Bear Object Part 1 • Initialization • Accessor Methods • Mutator Methods

  7. Types • Seven basic types: • numbers • strings • hashes • ranges • symbols • regular expressions

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

  9. Types - Strings • single quoted strings • double quoted strings puts ‘string \n string’ puts “string \n string”

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

  11. Types - Ranges • Inclusive ranges (‘a’..’e’) • Exclusive ranges (‘a’…’e’) • As a “Comparator” • must support comparable operator <=> • must implement the succ method

  12. Example Bear Object Part 2 • Implementing Range support • <=> Comparable operator • succ method

  13. 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

  14. Scope of Variables • Specific syntax for declaring scope • Local  within each block • Global, Instance, Class  maintain their scope with their respective definition • Can use the :: operator i.e. ClassName::ConstName

  15. Conclusion • A programmer’s language • Readability vs. Writability • Facilitate creativity?

  16. Questions?

More Related