Perl 6 Essentials

Book description

Perl 6 Essentials is a sneak-preview of Perl 6, the widely-anticipated rewrite of the Perl programming language. Still in development, the Perl 6 project is a community-based effort to keep Perl vibrant well into the 21st century. This book covers the development not only of Perl 6 syntax but also Parrot, the language-independent interpreter developed as part of the Perl 6 design strategy. Although Perl remains a vibrant language with a fiercely loyal following, it has undergone many changes to keep up with new technologies and applications that were not anticipated when Perl was first introduced in 1987. Through its community-based development model, Perl has kept up with changing times and remained fresh when other languages might have stagnated. Internally, however, there have remained kinks and stumbling blocks that developers have needed to sidestep, long-abandoned features that have been maintained only for backwards compatibility, misdirected phrasings that have hindered more intuitive syntax structures, and a cacophony of modules that sometimes work well together, but occasionally don't. Perl continues to have a strong following devoted to its development, but in the meantime, a group of core Perl developers have begun working on Perl 6, a complete rewrite of the Perl language. While Perl's creative philosophy and common-sense syntax are sure to remain in Perl 6, everything else in the language is being re-examined and recreated. Perl 6 Essentials provides an overview of the current state of Perl 6 for those who await its release. Written by members of the Perl 6 core development team, the book offers an explanation of the various stages of the project, with reference material for programmers who are interested in what changes are planned or who may want to contribute to the project. The book will satisfy their curiosity and show how changes in the language will make it more powerful and easier to use. Perl 6 Essentials is the first book that offers a peek into the next major version of the Perl language. This book is essential reading for anyone interested in the future of Perl.

Table of contents

  1. Perl 6 Essentials
    1. Preface
      1. How This Book Is Organized
      2. Font Conventions
      3. We’d Like to Hear from You
      4. Acknowledgments
    2. 1. Project Overview
      1. The Birth of Perl 6
      2. In the Beginning . . .
      3. The Continuing Mission
        1. Language Design
          1. Requests for comments (RFCs)
          2. Apocalypses and Exegeses
          3. The p6l mailing list
        2. Internals
        3. Documentation
        4. Supporting Structure
    3. 2. Project Development
      1. Language Development
        1. Development Cycles
        2. Getting Involved
      2. Parrot Development
        1. Development Cycles
        2. Getting Involved
          1. Use the source
          2. Patch submission
          3. Bug tracking
    4. 3. Design Philosophy
      1. Linguistic and Cognitive Considerations
        1. The Waterbed Theory of Complexity
        2. The Principle of Simplicity
        3. The Principle of Adaptability
        4. The Principle of Prominence
        5. The Principle of End Weight
        6. The Principle of Context
        7. The Principle of DWIM
        8. The Principle of Reuse
        9. The Principle of Distinction
        10. Language Cannot Be Separated from Culture
        11. The Principle of Freedom
        12. The Principle of Borrowing
      2. Architectural Considerations
        1. Perl Should Stay Perl
          1. True to the original purpose
          2. Familiarity
          3. Translatable
        2. Important New Features
        3. Long-Term Usability
    5. 4. Syntax
      1. Variables
        1. Scalars
        2. Arrays
        3. Hashes
        4. References
        5. Variables and Context
          1. Scalar context
          2. List context
          3. Hashlist context
        6. Properties and Traits
        7. Types
      2. Operators
        1. Assignment and Binding
        2. Arithmetic Operators
        3. String Operators
        4. Comparison
        5. Logical Operators
        6. Context Forcing Operators
        7. Bitwise Operators
        8. Conditional
        9. Vector Operators
        10. Junctions
        11. Smart Match
          1. Matching scalars
          2. Matching lists
          3. Matching arrays
          4. Matching hashes
          5. Matching junctions
          6. Matching objects
          7. Matching subroutines
        12. Referencing (or Not)
        13. Zip Operator
      3. Control Structures
        1. Selection
          1. The if statement
          2. The unless statement
          3. The switch statement
        2. Iteration
          1. The while loop
          2. The simple loop
          3. The for loop
          4. Breaking out of loops
        3. Blocks
          1. my, our, temp, and let
          2. Property blocks
          3. Exceptions
      4. Subroutines
        1. Formal Parameters
          1. Named parameter passing
        2. Multimethods
        3. Lexical Scope
        4. Anonymous Subroutines
        5. Placeholder Variables
        6. Currying
      5. Classes and Objects
        1. Attributes
        2. Methods
        3. Inheritance
        4. Lexically Scoped Classes
        5. Anonymous Classes
        6. Subroutines in Classes
      6. Grammars and Rules
        1. Basic Rule Syntax
        2. Building Blocks
        3. Modifiers
        4. Assertions
        5. Built-in Rules
        6. Backtracking Control
        7. Hypothetical Variables
        8. Grammars
    6. 5. Parrot Internals
      1. Core Design Principles
      2. Parrot’s Architecture
        1. Parser
        2. Compiler
        3. Optimizer
        4. Interpreter
        5. Bytecode Loader
      3. The Interpreter
        1. Registers
        2. Stacks
        3. Strings
        4. Variables
        5. Bytecode
      4. I/O, Events, Signals, and Threads
        1. I/O
        2. Events
        3. Signals
        4. Threads
      5. Objects
        1. Generic Object Interfacing
        2. Parrot Objects
        3. Parrot Classes
        4. Mixed Class-Type Support
      6. Advanced Features
        1. Garbage Collection
        2. Signature-Based Dispatching
        3. Continuations
        4. Coroutines
      7. Conclusion
    7. 6. Parrot Assembly Language
      1. Getting Started
      2. Basics
        1. Constants
        2. Working with Registers
          1. Register assignment
          2. PMC object types
          3. Type morphing
        3. Math Operations
          1. Unary math opcodes
          2. Binary math opcodes
          3. Floating-point operations
        4. Working with Strings
          1. Concatenating strings
          2. Repeating strings
          3. Length of a string
          4. Substrings
          5. Chopping strings
          6. Copying strings
          7. Converting characters
          8. Formatting strings
          9. Testing for substrings
        5. I/O Operations
          1. Open and close a file
          2. Output operations
          3. Reading from files
        6. Logical and Bitwise Operations
      3. Working with PMCs
        1. Aggregates
          1. Arrays
          2. Hashes
          3. Data structures
        2. PMC Assignment
        3. Properties
      4. Flow Control
        1. Conditional Branches
        2. Iteration
      5. Stacks and Register Frames
        1. User Stack
        2. Control Stack
        3. Integer Stack
        4. Register Frames
      6. Lexicals and Globals
        1. Globals
        2. Lexicals
          1. Basic instructions
          2. Nested scratchpads
      7. Subroutines
        1. Calling Conventions
          1. Reserved registers
          2. Callee saves
          3. Parrot calling conventions
        2. Native Call Interface
        3. Closures
        4. Coroutines
        5. Continuations
        6. Evaluating a Code String
      8. Writing Tests
      9. PASM Quick Reference
        1. abs
        2. acos
        3. add
        4. and
        5. asin
        6. asec
        7. assign
        8. atan
        9. band
        10. bnot
        11. bor
        12. bounds
        13. branch
        14. branch_cs
        15. bsr
        16. bxor
        17. chopn
        18. chr
        19. clearX
        20. clone
        21. close
        22. cmod
        23. collect
        24. collectoff
        25. collecton
        26. compile
        27. compreg
        28. concat
        29. cos
        30. cosh
        31. debug
        32. dec
        33. defined
        34. delete
        35. delprop
        36. depth
        37. div
        38. dlfunc
        39. end
        40. entrytype
        41. eq
        42. err
        43. exchange
        44. exists
        45. exp
        46. exsec
        47. fact
        48. find_lex
        49. find_global
        50. find_method
        51. find_type
        52. getfile
        53. getline
        54. getpackage
        55. getprop
        56. gcd
        57. gc_debug
        58. ge
        59. gt
        60. hav
        61. if
        62. index
        63. inc
        64. intdepth
        65. interpinfo
        66. intrestore
        67. intsave
        68. invoke
        69. jump
        70. jsr
        71. lcm
        72. le
        73. length
        74. ln
        75. loadlib
        76. log2
        77. log10
        78. lookback
        79. lsr
        80. lt
        81. mul
        82. mod
        83. ne
        84. neg
        85. new
        86. new_pad
        87. newinterp
        88. noop
        89. not
        90. open
        91. or
        92. ord
        93. peek_pad
        94. pop
        95. pop_pad
        96. popX
        97. pow
        98. print
        99. printerr
        100. profile
        101. prophash
        102. push
        103. push_pad
        104. pushX
        105. puts
        106. read
        107. repeat
        108. restore
        109. restoreall
        110. ret
        111. rotate_up
        112. runinterp
        113. save
        114. saveall
        115. savec
        116. sec
        117. sech
        118. seek
        119. set
        120. set_addr
        121. setprop
        122. shift
        123. shl
        124. shr
        125. sin
        126. sleep
        127. splice
        128. sprintf
        129. store_lex
        130. store_global
        131. stringinfo
        132. sub
        133. substr
        134. sweep
        135. sweepoff
        136. sweepon
        137. tan
        138. tanh
        139. time
        140. trace
        141. typeof
        142. unless
        143. unshift
        144. valid_type
        145. vers
        146. warningsoff
        147. warningson
        148. xor
    8. 7. The Intermediate Code Compiler
      1. Getting Started
      2. Basics
        1. Statements
        2. Comments
        3. Variables and Constants
          1. PASM registers
          2. Temporary registers
          3. Named variables
          4. Parrot classes
          5. Named constants
          6. Register spilling
        4. Symbol Operators
        5. Labels
        6. Compilation Units
        7. Scope and Namespaces
      3. Flow Control
      4. Subroutines
        1. Stack-Based Subroutine Calls
        2. Parrot Calling Conventions
        3. PASM Subroutines
      5. IMCC Command-Line Options
        1. General Usage
        2. Assembler Options
        3. Bytecode Interpreter Options
      6. IMCC Quick Reference
        1. Directives
          1. .arg
          2. .const
          3. .constant
          4. .emit
          5. .end
          6. .endm
          7. .endnamespace
          8. .eom
          9. .include
          10. .local
          11. .macro
          12. .namespace
          13. .param
          14. .result
          15. .return
          16. .sub
          17. .sym
        2. Instructions
          1. =
          2. +
          3. -
          4. *
          5. /
          6. **
          7. %
          8. .
          9. <
          10. <=
          11. >
          12. >=
          13. = =
          14. !=
          15. &&
          16. ||
          17. ~~
          18. !
          19. &
          20. |
          21. ~
          22. <<
          23. >>
          24. >>>
          25. [ ]
          26. addr
          27. call
          28. clone
          29. defined
          30. global
          31. goto
          32. if
          33. new
          34. unless
    9. Index
    10. Colophon

Product information

  • Title: Perl 6 Essentials
  • Author(s): Allison Randal, Dan Sugalski, Leopold T&ouml;tsch
  • Release date: June 2003
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596004996