Contents Introduction Names Variables The Concept of Binding Type Checking Strong Typing Type Equivalence Scope Scope and Lifetime Referencing Environments Named Constants Introduction



Download 396.24 Kb.
Page5/16
Date18.02.2022
Size396.24 Kb.
#58269
1   2   3   4   5   6   7   8   9   ...   16
13516098

Advantage: write ability

    • Advantage: write ability
    • Disadvantage: reliability (less trouble with Perl)

Static Type Binding

Implicit Declaration in Perl

•Any name begins with $ is a scalar, which

can store either a string or a numeric value

•A name begins with @ is an array

•A name begins with a % is a hash structure

A variable is bound to a type when it is assigned a value in an assignment statement (at run time, take the type of the value on the right-hand side)

  • A variable is bound to a type when it is assigned a value in an assignment statement (at run time, take the type of the value on the right-hand side)
  • Ex. for dynamic type binding in JavaScript
  • list = [2, 4.33, 6, 8];

    list = 17.3;

    • Advantage: flexibility (generic program units)
    • Disadvantages:
      • High cost (dynamic type checking and interpretation)

      • Download 396.24 Kb.

        Share with your friends:
1   2   3   4   5   6   7   8   9   ...   16




The database is protected by copyright ©ininet.org 2024
send message

    Main page