1
Neurons or nerve cells - Structure function and types of neurons | Human Anatomy | 3D Biology
Neurons or nerve cells - Structure function and types of neurons | Human Anatomy | 3D Biology
DATE: 2013/04/27::
2
Structure & Types of Neurons by Professor Fink
Structure & Types of Neurons by Professor Fink
DATE: 2012/07/19::
3
Types of Neurons by Structure - Neuroanatomy Basics - Anatomy Tutorial
Types of Neurons by Structure - Neuroanatomy Basics - Anatomy Tutorial
DATE: 2014/05/17::
4
Class 11-Zoology-Structural Organization in Animals-Online-NEET Lectures
Class 11-Zoology-Structural Organization in Animals-Online-NEET Lectures
DATE: 2013/04/05::
5
Drill Structural Steel: Structural Steel GEN3SYS® XT Drilling System
Drill Structural Steel: Structural Steel GEN3SYS® XT Drilling System
DATE: 2015/04/10::
6
Evolving JavaScript with TypeScript
Evolving JavaScript with TypeScript
DATE: 2014/12/01::
7
Introduction to TypeScript | Microsoft on edX | About Video
Introduction to TypeScript | Microsoft on edX | About Video
DATE: 2015/03/10::
8
Biology Structural Organization Animals part 21 (Earthworm: digestive system) CBSE class 11 XI
Biology Structural Organization Animals part 21 (Earthworm: digestive system) CBSE class 11 XI
DATE: 2014/12/16::
9
How Nervous System Works
How Nervous System Works
DATE: 2014/01/04::
10
Biology Structural Organization Animals part 31 (cockroach: Circulatory System) CBSE class 11 XI
Biology Structural Organization Animals part 31 (cockroach: Circulatory System) CBSE class 11 XI
DATE: 2014/12/18::
11
The Structural Basis of Congenital Disorder of Glycosylation Type 1a
The Structural Basis of Congenital Disorder of Glycosylation Type 1a
DATE: 2013/04/22::
12
Plant Structure
Plant Structure
DATE: 2012/04/21::
13
Structural Controls: Market-Based Algorithm
Structural Controls: Market-Based Algorithm
DATE: 2011/10/26::
14
Deltabeam with Steel Structure
Deltabeam with Steel Structure
DATE: 2014/03/05::
15
Biology Structural Organization Animals part 30 (cockroach: Digestive System) CBSE class 11 XI
Biology Structural Organization Animals part 30 (cockroach: Digestive System) CBSE class 11 XI
DATE: 2014/12/18::
16
Lally Lock Structural Column
Lally Lock Structural Column
DATE: 2013/03/23::
17
Microbiology - Viruses (Structure, Types and Bacteriophage Replication)
Microbiology - Viruses (Structure, Types and Bacteriophage Replication)
DATE: 2013/08/05::
18
Medieval Engineers - Destruction, Structural Damage
Medieval Engineers - Destruction, Structural Damage
DATE: 2015/01/13::
19
Biology Structural Organization Animals part 4 (Types of Epithelium) CBSE class 11 XI
Biology Structural Organization Animals part 4 (Types of Epithelium) CBSE class 11 XI
DATE: 2014/12/12::
20
Sika Carbodur earthquake-resisting structural strengthening system
Sika Carbodur earthquake-resisting structural strengthening system
DATE: 2013/07/02::
21
Top 10 Design Pattern Interview Questions and Answers Creational,structural,Behavioral
Top 10 Design Pattern Interview Questions and Answers Creational,structural,Behavioral
DATE: 2013/11/05::
22
Types of hormones
Types of hormones
DATE: 2013/09/18::
23
Watch Online RIBA Approved Structural Waterproofing CPD
Watch Online RIBA Approved Structural Waterproofing CPD
DATE: 2014/11/19::
24
Biology Structural Organization Animals part 36 (Frog: Circulatory System) CBSE class 11 XI
Biology Structural Organization Animals part 36 (Frog: Circulatory System) CBSE class 11 XI
DATE: 2014/12/19::
25
Animals Cells Structure & Functions Animation Video for Kids
Animals Cells Structure & Functions Animation Video for Kids
DATE: 2013/04/21::
26
Great Glands - Your Endocrine System: CrashCourse Biology #33
Great Glands - Your Endocrine System: CrashCourse Biology #33
DATE: 2012/09/10::
27
Green Panel Romania - SIP (structural insulated panels)
Green Panel Romania - SIP (structural insulated panels)
DATE: 2010/05/04::
28
Load Bearing Wall Framing Basics - Structural Engineering and Home Building Part One
Load Bearing Wall Framing Basics - Structural Engineering and Home Building Part One
DATE: 2013/10/03::
29
Structural Geology - Lesson 6 - Joints & Veins: Regional Systems - Part 1 of 4
Structural Geology - Lesson 6 - Joints & Veins: Regional Systems - Part 1 of 4
DATE: 2011/01/12::
30
Biology Video: Learn about Human Skeleton
Biology Video: Learn about Human Skeleton
DATE: 2012/11/26::
31
The extraordinary bacterial Type VI secretion machine
The extraordinary bacterial Type VI secretion machine
DATE: 2014/12/11::
32
Types of Footings Residential and Commercial Construction
Types of Footings Residential and Commercial Construction
DATE: 2012/09/04::
33
Biology Structural Organization Animals part 24 (Earthworm: Excretory System) CBSE class 11 XI
Biology Structural Organization Animals part 24 (Earthworm: Excretory System) CBSE class 11 XI
DATE: 2014/12/17::
34
Mutations in the Borrelia burgdorferi Flagellar Type III Secretion System Genes fliH and fliI...
Mutations in the Borrelia burgdorferi Flagellar Type III Secretion System Genes fliH and fliI...
DATE: 2015/05/22::
35
Introduction to the Waffle-Crete Structural Precast Building System
Introduction to the Waffle-Crete Structural Precast Building System
DATE: 2010/10/21::
36
Looking for Signs of Foundation Structural Problems | Tar Heel Basement Systems
Looking for Signs of Foundation Structural Problems | Tar Heel Basement Systems
DATE: 2014/03/26::
37
Lattice Structures Part 1
Lattice Structures Part 1
DATE: 2009/11/10::
38
Development of A Micro Aerial Vehicle Type Wall-Climbing Robot Mechanism
Development of A Micro Aerial Vehicle Type Wall-Climbing Robot Mechanism
DATE: 2015/03/02::
39
Direct Analysis Method (DAM) - Autodesk Robot Structural Analysis Professional 2015
Direct Analysis Method (DAM) - Autodesk Robot Structural Analysis Professional 2015
DATE: 2014/05/05::
40
Biology Structural Organization Animals part 14 (Muscular Tissue Types) CBSE class 11 XI
Biology Structural Organization Animals part 14 (Muscular Tissue Types) CBSE class 11 XI
DATE: 2014/12/14::
41
Biology Structural Organization Animals part 3 (Types Animal tissues: Epithelial) CBSE class 11 XI
Biology Structural Organization Animals part 3 (Types Animal tissues: Epithelial) CBSE class 11 XI
DATE: 2014/12/12::
42
Roof Truss Basics - Structural Engineering And Home Building Tips
Roof Truss Basics - Structural Engineering And Home Building Tips
DATE: 2012/11/12::
43
How to build Earthquake proof Houses / buildings / Structures in India
How to build Earthquake proof Houses / buildings / Structures in India
DATE: 2015/04/29::
44
CEFTUS Westminster Debate ‘Structural Changes ahead of 2015 General Elections in Turkey’ 1
CEFTUS Westminster Debate ‘Structural Changes ahead of 2015 General Elections in Turkey’ 1
DATE: 2015/02/27::
45
Integumentary System : Introduction to Epithelial Cells (06:01)
Integumentary System : Introduction to Epithelial Cells (06:01)
DATE: 2013/05/09::
46
Plant Cells: Crash Course Biology #6
Plant Cells: Crash Course Biology #6
DATE: 2012/03/05::
47
Liver Structure and the Flow of Blood and Bile (Master
Liver Structure and the Flow of Blood and Bile (Master's Project)
DATE: 2012/06/15::
48
Introduction to Systems Modeling (SysML): Basic Structural Modeling
Introduction to Systems Modeling (SysML): Basic Structural Modeling
DATE: 2014/03/05::
49
Three Types of Muscle
Three Types of Muscle
DATE: 2007/08/04::
50
What is a Shear Wall
What is a Shear Wall
DATE: 2013/03/27::
NEXT >>
RESULTS [51 .. 101]
From Wikipedia, the free encyclopedia
Jump to: navigation, search

A structural type system (or property-based type system) is a major class of type system, in which type compatibility and equivalence are determined by the type's actual structure or definition, and not by other characteristics such as its name or place of declaration. Structural systems are used to determine if types are equivalent and whether a type is a subtype of another. It contrasts with nominative systems, where comparisons are based on the names of the types or explicit declarations, and duck typing, in which only the part of the structure accessed at runtime is checked for compatibility.

Description[edit]

In structural typing, a element is considered to be compatible with another if, for each feature within the second element's type, there is a corresponding and identical feature in the first element's type. Some languages may differ on the details, such as whether the features must match in name. This definition is not symmetric, and includes subtype compatibility. Two types are considered to be identical if each is compatible with the other.

As an example, OCaml uses structural typing on methods for compatibility of object types. Go uses structural typing on methods to determine compatibility of a type with an interface. C++ template functions exhibit structural typing on type arguments. Haxe uses structural typing, although classes are not structurally subtyped.

In languages which support subtype polymorphism, a similar dichotomy can be formed based on how the subtype relationship is defined. One type is a subtype of another if and only if it contains all the features of the base type (or subtypes thereof); the subtype may contain additional features (such as members not present in the base type, or stronger invariants).

There is a distinction between structural substitution for inferred and non-inferred polymorphism. Some languages, such as Haskell, do not substitute structurally in the case where an expected type is declared (i.e. not inferred), e.g. only substitute for functions that are signature-based polymorphic via type inference.[1] Then it is not possible to accidentally subtype a non-inferred type, although it may still be possible to provide an explicit conversion to a non-inferred type, which is invoked implicitly.

Structural subtyping is arguably more flexible than nominative subtyping, as it permits the creation of ad hoc types and protocols; in particular, it permits creation of a type which is a supertype of an existing type, without modifying the definition of the latter. However, this may not be desirable where the programmer wishes to create closed abstractions.

A pitfall of structural typing versus nominative typing is that two separately defined types intended for different purposes, but accidentally holding the same properties (e.g. both composed of a pair of integers), could be considered the same type by the type system, simply because they happen to have identical structure. One way this can be avoided is by creating one algebraic data type for each use.

In 1990, Cook, et al., proved that inheritance is not subtyping in structurally-typed OO languages.[citation needed]

Example[edit]

Objects in OCaml are structurally typed by the names and types of their methods.

Objects can be created directly ("immediate objects") without going through a nominative class. Classes only serve as functions for creating objects.

 # let x =
     object
       val mutable x = 5
       method get_x = x
       method set_x y = x <- y
     end;;
 val x : < get_x : int; set_x : int -> unit > = <obj>

Here the OCaml interactive runtime prints out the inferred type of the object for convenience. You can see that its type (< get_x : int; set_x : int -> unit >) is purely defined by its methods.[clarification needed]

Let's define another object, which has the same methods and types of methods:

 # let y =
     object
       method get_x = 2
       method set_x y = Printf.printf "%d\n" y
     end;;
 val y : < get_x : int; set_x : int -> unit > = <obj>

You can see that OCaml considers them the same type. For example, the equality operator is typed to only take two values of the same type:

 # x = y;;
 - : bool = false

So they must be the same type, or else this wouldn't even type-check. This shows that equivalence of types is structural.

One can define a function that invokes a method:

 # let set_to_10 a = a#set_x 10;;
 val set_to_10 : < set_x : int -> 'a; .. > -> 'a = <fun>

The inferred type for the first argument (< set_x : int -> 'a; .. >) is interesting. The .. means that the first argument can be any object which has a "set_x" method, which takes an int as argument.

So we can use it on object x:

 # set_to_10 x;;
 - : unit = ()

We can make another object that happens to have that method and method type; the other methods are irrelevant:

 # let z =
     object
       method blahblah = 2.5
       method set_x y = Printf.printf "%d\n" y
     end;;
 val z : < blahblah : float; set_x : int -> unit > = <obj>

The "set_to_10" function also works on it:

 # set_to_10 z;;
 10
 - : unit = ()

This shows that compatibility for things like method invocation is determined by structure.

Let us define a type synonym for objects with only a "get_x" method and no other methods:

 # type simpler_obj = < get_x : int >;;
 type simpler_obj = < get_x : int >

Our object x is not of this type; but structurally, x is of a subtype of this type, since x contains a superset of its methods. So we can coerce x to this type:

 # (x :> simpler_obj);;
 - : simpler_obj = <obj>
 # (x :> simpler_obj)#get_x;;
 - : int = 10

But not object z, because it is not a structural subtype:

 # (z :> simpler_obj);;
 This expression cannot be coerced to type simpler_obj = < get_x : int >;
 it has type < blahblah : float; set_x : int -> unit > but is here used with type
   < get_x : int; .. >
 The first object type has no method get_x

This shows that compatibility for widening coercions are structural.

References[edit]

External links[edit]

Wikipedia content is licensed under the GFDL License
Powered by YouTube
MASHPEDIA
LEGAL
  • Mashpedia © 2015