# US 2014/0196015 A1 · Declaration of lifetime of resource reference

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

- Number: US 2014/0196015 A1
- Document ID: US20140196015A1
- Status: Published application
- Kind: A1
- Application number: 13/734,762
- Filed: 2013-01-04
- Published: 2014-07-10
- Earliest claimed: 2013-01-04
- Assignees: Microsoft Corporation
- Applicants: Microsoft Corporation
- Inventors: Jared Porter Parsons; John J. Duffy; G. Shon Katzenberger; Alexander Daniel Bromfield; Yevgeniy Rozenfeld
- Web page: https://patentgrep.com/patent/US20140196015A1

## CPC

- G06F 8/41: Compilation
- 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 by specifying a lifetime of a reference that represents a resource. In accordance with the language extension, the lifetime references a particular scope in a manner that the compiler generates computer-executable instructions that enforce the lifetime of the reference to be a function of (e.g., no longer than) the lifetime of the particular scope. Accordingly, the resource lifetime may be specified in advance to have a particular scope. This helps in performing resource management as typical managed language programs can allow resources to exist indefinitely. Furthermore, because the resources have a defined finite lifetime, they might be more conveniently allocated on a stack, instead of on a heap, for much more efficient processing.

## Claims

### Claim 1

A computer-implemented method for declaring that a particular reference in a software program has a finite lifetime, the method comprising:
an act of accessing a software program under construction that includes a reference that defines a resource; and
an act of annotating a reference of the software program to be associated with a particular scope having a finite lifetime,
wherein the annotation is structured such that the compiler enforces a lifetime of the reference to be a function of the lifetime of the particular scope.

### Claim 2 (depends on 1)

The method in accordance with claim 1, wherein the annotation is structured such that the compiler enforces the lifetime of the reference to be no longer than the lifetime of the particular scope.

### Claim 3 (depends on 1)

The method in accordance with claim 1, wherein the particular scope is a lexical scope.

### Claim 4 (depends on 1)

The method in accordance with claim 1, wherein the particular scope is a stack frame scope.

### Claim 5 (depends on 1)

The method in accordance with claim 1, wherein the particular scope is an object relational scope.

### Claim 6 (depends on 1)

The method in accordance with claim 1, wherein the software program is source code.

### Claim 7 (depends on 1)

The method in accordance with claim 1, wherein the software program is intermediate code.

### Claim 8

A computer program product comprising one or more computer-readable storage media having thereon computer-executable instructions that are structured, such that, when executed by one or more processors of a computing system, cause the computing system to execute a compiler that is configured to perform the following upon encountering an annotation in a computer program, the annotation associating the reference with a particular scope:
an act of formulating computer-executable instructions that cause a lifetime of the reference to be a function of the lifetime of the particular scope; and
including the formulated computer-executable instructions as part of the compiled computer program.

### Claim 9 (depends on 8)

The computer program product in accordance with claim 8, wherein the computer-executable instructions cause a lifetime of the reference to be no longer than a lifetime of the particular scope.

### Claim 10 (depends on 9)

The computer program product in accordance with claim 9, wherein the computer-executable instructions cause a lifetime of the reference not be shorter than a lifetime of the particular scope.

### Claim 11 (depends on 9)

The computer program product in accordance with claim 9, wherein the particular scope is a lexical scope.

### Claim 12 (depends on 9)

The computer program product in accordance with claim 9, wherein the particular scope is a stack frame scope.

### Claim 13 (depends on 9)

The computer program product in accordance with claim 9, wherein the particular scope is an object relational scope.

### Claim 14 (depends on 8)

The computer program product in accordance with claim 8, wherein the particular scope is a lexical scope.

### Claim 15 (depends on 8)

The computer program product in accordance with claim 8, wherein the particular scope is a stack frame scope.

### Claim 16 (depends on 8)

The computer program product in accordance with claim 8, wherein the particular scope is an object relational scope.

### Claim 17

A system comprising:
a type definition access component that accesses a type definition of a particular type, the type definition including an annotation associating a reference with a particular scope; and
a compilation component that responds to the annotation by formulating computer-executable instructions that cause a lifetime of the reference to be a function of the lifetime of the particular scope; and includes the formulated computer-executable instructions as part of the compiled computer program.

### Claim 18 (depends on 17)

The system in accordance with claim 17, wherein the particular scope is a lexical scope.

### Claim 19 (depends on 17)

The system in accordance with claim 17, wherein the particular scope is a stack frame scope.

### Claim 20 (depends on 17)

The system in accordance with claim 17, wherein the particular scope is an object relational scope.
