Skip to content

Expose system capability in mixin bodies #5805

@skilesare

Description

@skilesare

At the moment we don't allow code like:

mixin() {
   func f<system>(){};
   f<system>();
};

See test/fail/mixin-capabilities.mo.

In order to preserve the security guarantees we provide with the system capability, we should extend mixins to accept a <system> type parameter and require passing it on the include like so:

// MyMixin.mo
mixin<system>() {
   func f<system>(){};
   f<system>();
};

// Actor.mo
import MyMixin "MyMixin";

actor {
  include MyMixin<system>();
}

(edited by @christoph-dfinity)

Metadata

Metadata

Labels

typingInvolves the type system

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions