What is Type Completeness Principle?
Question:
In the book Programming Language Design Concepts, it says :
PYTHON counts procedures as first-class values, along with all primitive and composite values. Thus PYTHON conforms well to the Type Completeness Principle.
I still didn’t get it.
Answers:
The Type Completeness Principle:
No operation should be arbitrarily restricted in the types of values
involved.
- David A. Watt
First-class values can be evaluated, passed as arguments
and used as components of composite values.
Functional languages attempt to make no class distinctions,
whereas imperative languages typically treat functions (at
best) as second-class values.
Pretty much all programming languages limit the kinds of entities
that may be pass as values (and therefore have a meaningful
type). In C or C++, functions are not values, though pointers to
functions are. Classes are not values.
In Java, methods and classes are not values, though you can
obtain a reified object representing a class as a value, and in Java
8, you can pass method references as values. Packages are not
values, however.
In Haskell, functions are first-class values, so can be passed as
arguments and returned as values. Since Haskell is statically typed,
the type system is capable of expressing function types.
In the book Programming Language Design Concepts, it says :
PYTHON counts procedures as first-class values, along with all primitive and composite values. Thus PYTHON conforms well to the Type Completeness Principle.
I still didn’t get it.
The Type Completeness Principle:
No operation should be arbitrarily restricted in the types of values
involved.
- David A. Watt
First-class values can be evaluated, passed as arguments
and used as components of composite values.
Functional languages attempt to make no class distinctions,
whereas imperative languages typically treat functions (at
best) as second-class values.
Pretty much all programming languages limit the kinds of entities
that may be pass as values (and therefore have a meaningful
type). In C or C++, functions are not values, though pointers to
functions are. Classes are not values.
In Java, methods and classes are not values, though you can
obtain a reified object representing a class as a value, and in Java
8, you can pass method references as values. Packages are not
values, however.
In Haskell, functions are first-class values, so can be passed as
arguments and returned as values. Since Haskell is statically typed,
the type system is capable of expressing function types.