Sigil for Function Parameter Names

By Xah Lee. Date: . Last updated: .

new crotchet: all function parameter names should start with φ.

Example in emacs lisp:

emacs lisp greek sigil 2016-07-10

〔➤see Xah Emacs Lisp Tutorial

Example in JavaScript:

function draw_rect (φx_coord, φy_coord, φwidth, φheight) {
    // returns a svg rect element
    var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
    rect.setAttribute("x", φx_coord.toString());
    rect.setAttribute("y", φy_coord.toString());
    rect.setAttribute("width", φwidth.toString());
    rect.setAttribute("height", φheight.toString());
    return rect;
}

〔➤see JavaScript Tutorial by Example

this is experimental. I'm going to see how it goes.

why do you want to do this?

I want to be able to distinguish function parameters easily from local variables. (and, ideally, also easily distinguish GLOBAL variables. And built-in vs user-defined. And, wish every identifier is unique.) 〔➤see Programing Style: Variable Naming: English Words Considered Harmful

note, the choice of the character takes some consideration. You want a char that is:

note: sigil is mostly popularly associated with perl. But it's also used in PHP and Ruby, as these 2 languages directly borrowed it from Perl. (perl borrowed it from unix shell.) 〔➤see Learn Perl in 1 Hour〕 〔➤see PHP in 1 Hour〕 〔➤see Ruby: Learn Ruby in 1 Hour

The idea of sigil is however quite widespread. Many languages have special chars as starting or ending variable names to indicate special purpose, though, mostly as a convention only, not part of the language machinery.

For example:

the name sigil is coined by Philip Gwyn in 1999 to refer to perl's sigil, according to Wikipedia: Sigil (computer programming)