I7: Expanded compiler type deduction possible?

The I7 compiler is able to deduce the kind of something previously unmentioned when it is involved in a relation. The following causes no issues:

A race car is a kind of vehicle.

Driving relates one person (called the driver) to various race cars. [compiler informed of required kinds]

The Speedster is driven by Mr Speedy. [deduces kinds for both Speedster and Speedy]

However, the compiler is not able to deduce the kind of something previously-unmentioned when it is assigned as a property. The last statement of the following triggers a Problem message:

A race car is a kind of vehicle.

A race car has a person called the driver. [compiler informed of required kind]

The Speedster is a race car. The driver of the Speedster is Mr Speedy. [can't deduce that Speedy is a person]

The Problem message resulting seems like the compiler is trying to make a deduction about Mr Speedy but is getting no farther than deciding it must be an object.

Problem. In the sentence ‘The driver of the Speedster is Mr Speedy’ , it looks as if you intend ‘The driver of the Speedster is Mr Speedy’ to be asserting something, but that tries to set the value of the ‘driver’ property to an object - which must be wrong because this property has to be a person.

Type information is available to the compiler – the Problem message even indicates an awareness of the required type! Why doesn’t it make the same kind of deduction as it does for relations? Is this something that could be implemented?

4 Likes