Page MenuHomePhabricator

Better workflow for creating and using enumerations
Closed, DuplicatePublic

Description

(Ticket writing in progress)

The current workflow for creating an enumeration is very fiddly.

First, let's define what an enumeration is:

  1. An enumeration is a type
  2. That type has only a single key named identity
  3. The type of the key is the enumeration type itself
  4. All instances of the type are objects in Wikifunction itself
  5. Every instance of the type point to itself in the value key
  6. The validator checks that the instance is one of the objects in the wiki

An example of an enumeration type is Z40/Boolean with its two values Z41/true and Z42/false

An example of a pseudo-enumeration is Z60/language, since its identity is an external key.

Creating such a type is difficult

Since we cannot refer to the type itself during creation, I created it first with some different type, String. Then I went to edit the type, and had to fiddle a bit to change String to Sign.

Changing that is actually hard: here are two examples, and it does not behave consistently as far as I can tell: one time I get a drop down box, but when entering another type name, it doesn't search. One time I don't even get the drop down box.

Screen Shot 2022-02-11 at 2.41.11 PM.png (1×1 px, 161 KB)

Screen Shot 2022-02-11 at 2.40.45 PM.png (1×1 px, 164 KB)

What works is that I click on the trash can next to value type, then select Type as the type I am looking for, and then I can use the object entity search.

We used to be able to enter Z0/Self, meaning self, during creation, but the front end doesn't allow that anymore.

Creating the instances is difficult

I don't even know how i created the first instance. Since it has no validator yet, I might have created it without a key, then the object had a ZID, and I could edit it again and

The following instances are easier: first you create an instance pointing to an already existing instance, then edit it, and make it point to itself.

Editing was hard: again, I didn't get to edit the value.

Screen Shot 2022-02-11 at 2.47.41 PM.png (502×818 px, 59 KB)

Instead I had to delete the value, then select the type (Sign), then switch to reference mode, and then select the right object (itself).

Again, all of this would be avoided if we had a Z0/Self that we could use during creation.

Creating the validator is difficult

...

Using the instance is difficult

...

I am tagging this against the UX, because as far as I can tell, the backend seems to deal with these steps. I am filing separate tickets against backend issues.