Created
November 23, 2008 00:11
-
-
Save atg/27987 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Literals are fixed values written into the source code. Examples include numbers, strings and regex constants | |
literal: | |
#A string literal. For example: "Hello World" | |
literal.string | |
literal.string.double-quote | |
literal.string.single-quote | |
#A numerical constant. For example 42, 6.127 or | |
literal.numeric | |
# | |
literal.numeric.integer | |
literal.numeric.hex | |
literal.numeric.decimal | |
literal.numeric. | |
#An array. For example {1, 2, 3} in C or [1, 2, 3] in Python (Or [NSArray arrayWithObjects:[NSNumber numberWithInt:1], [NSNumber numberWithInt:2], [NSNumber numberWithInt:3]] in Objective-C) | |
literal.array | |
#Dictionaries (aka hashes aka maps aka associative arrays) store pairs of keys and values. Some langaguages do not make a distiction between arrays and dictionaries, but you should if possible | |
literal.dictionary | |
#Languages can extent the literal class by adding their own unique literals. | |
#For example ruby :symbols or Objective-C selectors might be literal.symbol.ruby or literal.selector.objc respectively | |
# Variables are containers for values. For languages like Ruby, Perl or PHP, the sugar can work out if an identifier is a variable from the prefix. This may not be possible for all languages | |
variable: | |
variable.array | |
# Names might include class names, namespace names, method/function names, etc | |
name: | |
name.class #A class | |
name.namespace #A namespace or module | |
#Functions vs Methods: Some languages (like C++ or Objective-C) have both and need the distinction. Some langauges (like Ruby) only have methods. Some languages (like C) only have functions. Use what makes most sense | |
name.function #A function not belonging to a class/object | |
name.method #A method or member function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment