Wikia

FiM++ Community Wiki

Changes: Applejack's Hat

Edit

Back to page

m (spelling correction)
(renaming methods to paragraphs)
Line 8: Line 8:
   
 
=== Resolutions ===
 
=== 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 method name.
+
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 UTF-8 character that does not conflict with other restrictions
Line 29: Line 29:
 
* {{code|variable|Twilight's favorite {{codeerror|number}}}}
 
* {{code|variable|Twilight's favorite {{codeerror|number}}}}
 
** Contains a reserved keyword phrase
 
** Contains a reserved keyword phrase
* {{code|method|{{codeerror|99}} Jugs of Cider}}
+
* {{code|paragraph|{{codeerror|99}} Jugs of Cider}}
 
** Contains a literal at the beginning
 
** Contains a literal at the beginning
   
Line 35: Line 35:
 
* [[Variables]]
 
* [[Variables]]
 
* [[Classes]]
 
* [[Classes]]
* [[Methods]]
+
* [[Paragraphs]]

Revision as of 23:34, April 19, 2013

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

Around Wikia's network

Random Wiki