microsoft/BosqueLanguage

Type and implementation separation?

Closed this issue · 2 comments

Are there any plan to separate type definition and code implementation? In typescript I usually do something like this:

interface myType {
  (myInput: { name: string, age: number }): { id: number, ticket: string }
}
const myFunc: myType = (myInput) => {
  // return {id: id, ticket: ticket};
}

It makes implementation cleaner though less verbose.

You can do the same thing in Bosque with concept and entity -- roughly they are equvalent to interface and class.

concept Foo {
    abstract method m(x: Int): Int;
}

entity FooImpl provides Foo {
    override method m(x: Int): Int {
        return x + 1;
    }
}

No current plans to do more separation, like C++ .h vs .cpp files though.

Seems to be answered. Please reopen if needed.