KeyboardDollars

From Offering Load Wiki

Jump to: navigation, search

I find it useful to look at how a language spends it's synatax dollars, or it's punctuation characters.

Name Discussion
. period is used to terminate statements
% percent sign comment till end of line
; semicolon is used to seperate series of pattern matching rules, and guard expressions.
, comma is used to seperate series of expressions
: colon Used to denote names in module, in try statements for class of what's being caught, and in bit comprehensions. see also also :\: and =:=
:: double colon used to the type specs provided both to the compiler and in documentation as shown in this example:
%%============================================================================================================
%% @spec register_pid(FileName::filename(), Start::Pos, End::Pos, RegName::string(),SearchPaths::[dir()])-> term()
% @doc This function associates a name, which must be an atom, with a pid, and replaces the uses of this pid in
%% send expressions with the name.

-spec(register_pid(FileName::filename(), Start::pos(), End::pos(), RegName::string(),SearchPaths::[dir()], TabWidth::integer())->
             {error, string()} |{ok, [filename()]}).
register_pid(FName, Start, End, RegName,  SearchPaths, TabWidth) ->
    register_pid(FName, Start, End, RegName, SearchPaths, TabWidth, emacs).
! bang send message
? question mark prefix for preprocessor macro
- minus sign subtract, negative numbers, and in preprocessor for module attributes
$ dollar sign character literals, i.e. $a
# hash base in integer literals, i.e. 16#FFFD; record syntax
= equal sign matching operator, and in record definition syntax
@ at sign documentation in comments, i.e. @spec, @doc; and inside atoms, in particular node names like ejabberd@host1
& ampersand not used?!
* star multiply
( ) simple parens expressions, defining argument lists, functions calls, compiler annotations.
{ } squiggly brackets not used?!?
\  ???  ???
" double quote syntaxtic sugar for lists of characters, aka text string literals
` single backquote Not used
' single quote quoting atoms
_ underscore constitute character in names; as the first character in variable names denotes a wildcard, i.e. that it will never be read.
~ tilde used in io:format strings, but not otherwise?
^ carrot control characters for example $^A is control-A, not used otherwise
-> right arrow is used to define the individual rules of a functions, case statements, recieve. e.g. pattern -> 'expression
<- left error operator inside of list comprehensions
<=  ?? is used in bit comprehensions
||  ?? list comprehension
++  ? list concatenate
--  ? an set subtract, useful if lists are sets.
orelse andalso  ? short cut booleans
[, ] square brackets list construction and pattern matching
,, | list patterns and constructors
<<, >>  ? bit patterns and constructors, analagous to [, ] for lists
=:=  ? exact equals
Personal tools