Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Type Completeness Principle?

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.

like image 831
Still Learning Avatar asked Nov 29 '16 01:11

Still Learning


1 Answers

The Type Completeness Principle:

No operation should be arbitrarily restricted in the types of values involved. - 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.

like image 121
The Room Avatar answered Nov 04 '22 08:11

The Room