Jump to content

Wikifunctions:Type proposals/Gregorian era

From Wikifunctions

Summary

This is an enumeration for the Gregorian eras. There are two eras: the Common Era (CE, also designated as AD), and “before Common Era” (BCE, also designated as BC).

Uses

Prompts:

  • Why should this exist?

To represent the two possible eras used in the Gregorian calendar.

  • What kinds of functions would be created using this?

Beyond identity, the era is probably only useful as part of other calendar related Functions.

  • What standard concepts, if any, does this align with?

The Gregorian calendar.

Structure

Gregorian eras are represented as an enumeration with two values. Like all enumeration types, the Gregorian era consists of a single key. The key is an identity key.

Values

There are two values.

  1. CE
  2. BCE

Example values

The BCE value

{
  "type": "Gregorian era",
  "value": "BCE"
}
{
  "Z1K1": "Znnn",
  "ZnnnK1": "Zmmm"
}


Validator

The validator ensures that:

  • the identity key points to a value of Gregorian era

Identity

Two Gregorian eras are the same if their identity is the same ZID.

Converting to code

Python

We represent the era as a Boolean. CE is True, and BCE False.

JavaScript

We represent the era as a Boolean. CE is true, and BCE false.

Renderer

As for all enumerations, the renderer displays the label of the value object.

Parsers

As with all enumerations, there is no parser, but a selector based on pre-defined values.

Alternatives

  1. One alternative would be not to have the Gregorian era as a Type at all, but to have a different representation for Gregorian years, e.g. using Integers.
  2. Another alternative would not to have the Gregorian era as a Type but to use Boolean directly. It seems cleaner and have less semantic overloading by splitting this Type off.
  3. One question is whether the Gregorian era, the Julian era, and other eras should all be just a single Type, or should be separate Types. This proposal makes no assumption about that for now.

Comments