Monthly Archives: April 2024

Pinafore 0.5

A much smaller update, this time.

  * Language
    - redesign dynamic types
    - allow decarations in do-blocks
  * Library
    - built-in
      . add collect.FiniteSetModel
      . add newClockUTC.Date, newClockLocal.Date
      . improve type of getList.FiniteSetModel
      . add DynamicType and functions
    - GTK
      . allow checkbox menus
    - UILib
      . update

The main improvement is a reworking of dynamic types. Before, they had to be defined bottom up, that is, you had to define the concrete types first, and then define abstract supertypes in terms of them.

# old Pinafore
dynamictype Human = !"Human";
dynamictype Cat = !"Cat";
dynamictype Dog = !"Dog";
dynamictype Animal = Human | Cat | Dog;

Now, however, you can define the types in any order, and then simply declare subtype relations:

# new Pinafore
dynamictype Animal;
dynamictype Human = !"Human";
subtype Human <: Animal;
dynamictype Cat = !"Cat";
subtype Cat <: Animal;
dynamictype Dog = !"Dog";
subtype Dog <: Animal;

This is much more flexible, and matches the way open entity types work. The only caveat is that the behaviour of abstract dynamic types (e.g. check @Animal) varies depending on what subtype relations are in scope.

— Ashley Yakeley