← Back to context

Comment by gf000

3 months ago

Hi, this language looks very cool!

I am interested in the "No Hidden I/O" section. Can you store, say, the system value (?) to a list? Because I'm afraid this is not enough to properly track side-effects.

Unfortunately I think capabilities/an effect system is required for that (so that any point that actually uses a side effect, taints its whole call tree - the same way async/checked exceptions do, both of which are specific Effects.

Thanks!

Yes, you can store the system value (or indeed any other object capability) in a list.

If a function takes in a List[NodeSystem] parameter, then the function can perform side effects through the methods on NodeSystem.

However, if a function takes in a List[T] where T is a type parameter, then that is not enough to perform side effects, even if that function is later called with a List[NodeSystem] argument. There is no way for the function to access the methods of the concrete type of T.

Hence, you can tell whether or not a function may have side effects from the function signature alone.

  • Realistically, in a bigger project, you might have a NodeSystem type n layers deep buried.

    E.g. you just grabbed a hypothetical canvas dependency, which has a Canvas. Can you tell if it does any form of IO or not?

    • Only capability type can have fields containing other (concrete) capability types.

      If Canvas contains NodeSystem, then Canvas must be a capability type itself.