Optional<Interface> does not work allow direct connection

Heyhey,

This is 5.3-118 speaking.

When creating an input of type Optional<ISomething>, one cannot connect an instance implementing ISomething directly. You have to use Create (Optional).

optionalinterface

Patch attached for debug :

OptionalInterface.vl (8.5 KB)

One of the big features of VL is that we have a very strong type inference when compared to other languages like C#: You seldomly need to add type annotations.

In your example two things have to happen at the same time. This is one of those examples where you need to place a type annotation to help the type inference system.

By placing the annotation, you help the compiler break down the problem into two steps.
These two features now work isolated:

  • automatic super type conversion
  • automatic lifting to Optional<>

OptionalInterface.vl (8.8 KB)

I understand the desire to have each feature work indepndantly from the other and combine flawlessly with any other feature. However, I know of no sufficiently feature-rich system / language, where each and every feature combines without any further ado. Type inference would just get too complex and resource hungry.

Allowed myself to classify this as a missing feature, not a bug.

1 Like

Noted, thanks for the explanation!

1 Like