Download
1 / 17

Trends in Scripting Languages - PowerPoint PPT Presentation


  • 81 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Trends in Scripting Languages' - farrah


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

History
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


History1
History

  • 1993

  • Fill what lacked in Perl and Python

  • More powerful than Perl

  • More Object Oriented than Python

  • Facilitate creativity

  • 1995 – First release


Basic syntax
Basic Syntax

#example if-block

if goldilocks > 10

puts “too big”

elsif goldilocks < 10

puts “too small”

else

puts “just right”

end


Basic syntax1
Basic Syntax

#example function call

def my_funct(arg)

“Hello #{arg}”

end

puts my_funct(“world!”)


Example bear object part 1
Example Bear Object Part 1

  • Initialization

  • Accessor Methods

  • Mutator Methods


Types
Types

  • Seven basic types:

    • numbers

    • strings

    • hashes

    • ranges

    • symbols

    • regular expressions


Types numbers
Types - Numbers

num = 81

6.times do

puts “#{num.class}: #{num}”

num *= num

end


Types strings
Types - Strings

  • single quoted strings

  • double quoted strings

    puts ‘string \n string’

    puts “string \n string”


Types hashes
Types - Hashes

  • Basically Associative Arrays

  • Uses {} and => notation

    bears = { “mamma” =>1,

    “pappa” =>2,

    “baby” =>3 }

    puts[“pappa”]


Types ranges
Types - Ranges

  • Inclusive ranges (‘a’..’e’)

  • Exclusive ranges (‘a’…’e’)

  • As a “Comparator”

    • must support comparable operator <=>

    • must implement the succ method


Example bear object part 2
Example Bear Object Part 2

  • Implementing Range support

    • <=> Comparable operator

    • succ method


Types regular expressions
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


Scope of variables
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


Conclusion
Conclusion

  • A programmer’s language

  • Readability vs. Writability

  • Facilitate creativity?



ad