Sigil for Variable Names

By Xah Lee. Date: . Last updated: .

new crotchet: all function parameter names should start with φ and all local variable names should start with ξ .

emacs lisp greek sigil 2016-07-10
emacs lisp greek sigil 2016-07-10

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 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 Perl Tutorial〕 〔see PHP in 1 Hour〕 〔see Ruby Tutorial

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.

Programing Language Naming of Things