# US 2024/0004616 A1 · Runtime support for role types that extend underlying types

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

- Number: US 2024/0004616 A1
- Document ID: US20240004616A1
- Status: Published application
- Kind: A1
- Application number: 17/853,004
- Filed: 2022-06-29
- Published: 2024-01-04
- Earliest claimed: 2022-06-29
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: David Charles WRIGHTON; Julien David COUVREUR; Stephen Harris TOUB; Mads TORGERSEN; Jared Porter PARSONS
- Web page: https://patentgrep.com/patent/US20240004616A1

## CPC

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

## Abstract

Utilizing role types that extend underlying types. Within a program definition, a computer system identifies a statement assigning an object of an underlying type to a role type that extends the underlying type. The underlying type implements a first interface, and the role type implements a second interface. Based on the role type extending the underlying type, the computer system assigns the object of the underlying type to the role type. Based on assigning the object of the underlying type to the role type, the role type is usable to interact with the object of the underlying type using both the first interface and the second interface.

## Claims

### Claim 1

A method, implemented at a computer system that includes a processor, for utilizing role types that extend underlying types, the method comprising:
within a program definition, identifying a statement assigning an object of an underlying type to a role type that extends the underlying type, wherein:
the underlying type implements a first interface, and
the role type implements a second interface; and
based on the role type extending the underlying type, assigning the object of the underlying type to the role type,
wherein, based on assigning the object of the underlying type to the role type, the role type is usable to interact with the object of the underlying type using both the first interface and the second interface.

### Claim 2 (depends on 1)

The method of claim 1, wherein the underlying type is declared as sealed.

### Claim 3 (depends on 1)

The method of claim 1, wherein the underlying type is one of a reference type or a value type.

### Claim 4 (depends on 1)

The method of claim 1, wherein the underlying type is declared as inheriting from a base type.

### Claim 5 (depends on 1)

The method of claim 1, further comprising:
identifying a statement assigning the role type to another type; and
allocating a wrapper object around the object of the underlying type.

### Claim 6 (depends on 5)

The method of claim 5, further comprising:
identifying a statement comparing the wrapper object and the object of the underlying type; and
reporting reference equality between the wrapper object and the object of the underlying type.

### Claim 7 (depends on 5)

The method of claim 5, wherein allocating the wrapper object around the object of the underlying type comprises allocating a plurality of wrapper objects, and wherein the method further comprises:
reporting reference equality between the plurality of wrapper objects.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
identifying a statement assigning the role type to a second type;
determining that the underlying type is assignable to the second type; and
assigning the role type to the second type.

### Claim 9 (depends on 8)

The method of claim 8, wherein the second type comprises one of:
a base type that is inherited by the underlying type; or
the first interface.

### Claim 10 (depends on 1)

The method of claim 1, wherein the role type extends the underlying type with an additional method member.

### Claim 11 (depends on 1)

The method of claim 1, wherein the role type re-implements the first interface based on a constrained call to the object of the underlying type.

### Claim 12 (depends on 1)

The method of claim 1, further comprising:
reporting the role type as an instance of the first interface, and as an instance of the second interface.

### Claim 13

A computer system for utilizing role types that extend underlying types, comprising:
a processor; and
a computer storage media that stores computer-executable instructions that are executable by the processor to cause the computer system to at least:
within a program definition, identify a statement assigning an object of an underlying type to a role type that extends the underlying type, wherein:
the underlying type implements a first interface, and
the role type implements a second interface; and
based on the role type extending the underlying type, assign the object of the underlying type to the role type,
wherein, based on assigning the object of the underlying type to the role type, the role type is usable to interact with the object of the underlying type using both the first interface and the second interface.

### Claim 14 (depends on 13)

The computer system of claim 13, the computer-executable instructions also including instructions that are executable by the processor to cause the computer system to:
identify a statement assigning the role type to another type; and
allocate a wrapper object around the object of the underlying type.

### Claim 15 (depends on 14)

The computer system of claim 14, the computer-executable instructions also including instructions that are executable by the processor to cause the computer system to:
identify a statement comparing the wrapper object and the object of the underlying type; and
report reference equality between the wrapper object and the object of the underlying type.

### Claim 16 (depends on 14)

The computer system of claim 14, wherein allocating the wrapper object around the object of the underlying type comprises allocating a plurality of wrapper objects, and wherein the computer-executable instructions also include instructions that are executable by the processor to cause the computer system to:
report reference equality between the plurality of wrapper objects.

### Claim 17 (depends on 13)

The computer system of claim 13, the computer-executable instructions also including instructions that are executable by the processor to cause the computer system to:
identify a statement assigning the role type to a second type;
determine that the underlying type is assignable to the second type; and
assign the role type to the second type.

### Claim 18 (depends on 13)

The computer system of claim 13, wherein the role type extends the underlying type with an additional method member.

### Claim 19 (depends on 13)

The computer system of claim 13, wherein the role type re-implements the first interface based on a constrained call to the object of the underlying type.

### Claim 20

A computer program product comprising a computer storage media that stores computer-executable instructions that are executable by a processor to cause a computer system to utilize role types that extend underlying types, the computer-executable instructions including instructions that are executable by the processor to cause the computer system to at least:
within a program definition, identify a statement assigning an object of an underlying type to a role type that extends the underlying type, wherein:
the underlying type implements a first interface, and
the role type implements a second interface; and
based on the role type extending the underlying type, assign the object of the underlying type to the role type,
wherein, based on assigning the object of the underlying type to the role type, the role type is usable to interact with the object of the underlying type using both the first interface and the second interface.
