FiM++ Wiki
Advertisement

The Applejack's Hat scenario is one that was used to work out how variables should work in FiM++ when it was first being proposed. This particular phrase was used because it represents several decisions about how the language, as a whole, should work.

Challenges[]

  • "Applejack's Hat" must be used as a variable name, as it is mundane enough that users of the language will expect it to be valid
  • It contains whitespace, something most other programming languages prohibit in keywords.
  • It contains both lower- and upper-case letters.
  • It contains an apostrophe

Resolutions[]

The following were changes made to the language to accommodate for Applejack's hat. These affect how character literals are defined, what is valid punctuation, and what is a valid variable, class, and paragraph name.

  • Names may contain any UTF-8 character that does not conflict with other restrictions
  • Names may contain any whitespace character, and variable declaration ends when a keyword or punctuation is encountered
  • Names are case-sensitive
  • Names may contain operators and literals as long as they are after the first character of the word.

Other similar propositional variable names[]

Valid names[]

These were also used as examples for what must be a valid variable name:

  • how to add all the Numbers from 1 to 100
    • Contains an alternate capitalization of the "the numbers" reserved keyword, as well as two number literals
  • Somepony’s true identity
    • Contains an apostrophe and a Boolean literal
  • Team Fortress 2
    • Contains a number literal

Invalid Names[]

These were used as examples for what might seem like valid variable names, but are not.

  • Twilight's favorite number
    • Contains a reserved keyword phrase
  • 99 Jugs of Cider
    • Contains a literal at the beginning

See Also[]

Advertisement