FANDOM


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 Edit

  • "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 Edit

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 Edit

Valid names Edit

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 Edit

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 Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.