# US 2014/0196008 A1 · Immutable object types

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2014/0196008 A1
- Document ID: US20140196008A1
- Status: Published application
- Kind: A1
- Application number: 13/734,750
- Filed: 2013-01-04
- Published: 2014-07-10
- Earliest claimed: 2013-01-04
- Assignees: Microsoft Corporation
- Applicants: Microsoft Corporation
- Inventors: John J. Duffy; Jared Porter Parsons; Michael Sinz; Alexander Daniel Bromfield; Krzysztof J. Cwalina
- Web page: https://patentgrep.com/patent/US20140196008A1

## CPC

- G06F 8/315: {Object-oriented languages}
- G06F 8/436: {Semantic checking}
- G06F 8/437: {Type checking}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A language extension that advances safety in system programming in that an entire type may be declared to be immutable in the case in which all instances of that type are immutable. The immutable type declaration automatically causes any instances of that type to be treated as immutable, and automatically causes all directly or indirectly reachable members (e.g., fields, methods, properties) of the instance to also be treated as immutable. Furthermore, any construction time reference that allows for field assignment of the instance is not permitted to survive beyond the point at which the instance becomes accessible to its creator. Accordingly, this instance, and any other instance of that same type, will be immutable from the very time of construction. The ability to classify all such instances as immutable is beneficial as the immutable characteristic permits actions that normally would not be allowed due to resource access safety.

## Claims

### Claim 1

A computer-implemented method for ensuring multiple instances of an object type are immutable, the method comprising:
an act of accessing a declaration that an object type is immutable; and
in response to the declaration, performing the following:
an act of automatically formulating computer-executable instructions such that each instance of that object type is classified as immutable;
an act of automatically formulating computer-executable instructions such that all directly or indirectly reachable members of the instance of that object type are classified as immutable; and
an act of automatically formulating computer-executable instructions such that any reference that allows for field assignment of the instance of that object time is not permitted to survive beyond the point at which the instance becomes accessible to a creator of the instance.

### Claim 2 (depends on 1)

The computer-implemented method in accordance with claim 1, wherein at least one instance of the immutable object type takes one or more writable input values.

### Claim 3 (depends on 2)

The computer-implemented method in accordance with claim 2, wherein none of the one or more writable input values are stored in a field of any of the at least one instance.

### Claim 4 (depends on 1)

The computer-implemented method in accordance with claim 1, wherein one or more members of an instance of the reference includes a permission that is not an immutable permission.

### Claim 5 (depends on 4)

The computer-implemented method in accordance with claim 4, further comprising ignoring the permission given that the object type itself is classified as immutable.

### Claim 6 (depends on 1)

The computer-implemented method in accordance with claim 1, wherein there is no mechanism to make any of the instances of the object type mutable.

### Claim 7 (depends on 1)

The computer-implemented method in accordance with claim 1, wherein members of the instance comprises all fields, methods, and properties of the instance.

### Claim 8 (depends on 1)

The computer-implemented method in accordance with claim 1, wherein the reference that allows for field assignment is a this reference of an instance constructor that constructs instances of the object type.

### Claim 9 (depends on 1)

The computer-implemented method in accordance with claim 1, wherein a set of one or more actions that may be performed on the reference that allows for field assignment are limited such that the reference is not stored as a field.

### Claim 10 (depends on 1)

The computer-implemented method in accordance with claim 1, wherein the set of one or more actions includes read and write.

### Claim 11

A computer program product comprising one or more computer-readable storage media having thereon computer-executable instructions that, when executed by one or more processors of a computing system, cause the computing system to perform a method for ensuring multiple instances of an object type are immutable, the method comprising:
an act of accessing a declaration that an object type is immutable; and
in response to the declaration, performing the following:
an act of automatically formulating computer-executable instructions such that each instance of that object type is classified as immutable;
an act of automatically formulating computer-executable instructions such that all directly or indirectly reachable members of the instance of that object type are classified as immutable; and
an act of automatically formulating computer-executable instructions such that any reference that allows for field assignment of the instance of that object time is not permitted to survive beyond the point at which the instance becomes accessible to a creator of the instance.

### Claim 12 (depends on 11)

The computer program product in accordance with claim 11, wherein at least one instance of the immutable object type takes one or more writable input values.

### Claim 13 (depends on 12)

The computer program product in accordance with claim 12, wherein none of the one or more writable input values are stored in a field of any of the at least one instance.

### Claim 14 (depends on 11)

The computer program product in accordance with claim 11, wherein one or more members of an instance of the reference includes a permission that is not an immutable permission.

### Claim 15 (depends on 14)

The computer program product in accordance with claim 14, further comprising ignoring the permission given that the object type itself is classified as immutable.

### Claim 16 (depends on 11)

The computer program product in accordance with claim 11, wherein there is no mechanism to make any of the instances of the object type mutable.

### Claim 17 (depends on 11)

The computer program product in accordance with claim 11, wherein members of the instance comprises all fields, methods, and properties of the instance.

### Claim 18 (depends on 11)

The computer program product in accordance with claim 11, wherein the reference that allows for field assignment is a this reference of an instance constructor that constructs instances of the object type.

### Claim 19 (depends on 11)

The computer program product in accordance with claim 11, wherein a set of one or more actions that may be performed on the reference that allows for field assignment are limited such that the reference is not stored as a field.

### Claim 20

A system comprising:
a compiler that is configured to performing the following upon accessing a declaration that an object type is immutable:
an act of automatically formulating computer-executable instructions such that each instance of that object type is classified as immutable;
an act of automatically formulating computer-executable instructions such that all directly or indirectly reachable members of the instance of that object type are classified as immutable; and
an act of automatically formulating computer-executable instructions such that any reference that allows for field assignment of the instance of that object time is not permitted to survive beyond the point at which the instance becomes accessible to a creator of the instance.
