PyHP-pph / PyHP_pph

This repository serves as a centre for collaboration on the PyHP++# language. It will also include a functioning interpreter and compiler for PyHP++# once the standard is finalised.
https://www.reddit.com/r/PyHP_pph/
GNU Affero General Public License v3.0
23 stars 3 forks source link

Naming convention #42

Open ghost opened 7 years ago

ghost commented 7 years ago

We should have a naming convention. One idea I've been toying with for a bit is that absolutely everything uses PascalCase (except primitive types and $self, which use camelCase), with a strict prohibition on doing anything to indicate what an identifier refers to.

class SomeThing
  {
    String $ThingInTheThing;

    String GetThingInTheThing()
      {
        return $self->$ThingInTheThing;
      }

    boolean SetThingInTheThing(String Value)
      {
        $self->$ThingInTheThing = Value;
      }
  }
Kampfkarren commented 7 years ago

We could limit the length of a variable name to around 3 characters. After all, simplicity is the essence of Python.

ghost commented 7 years ago

That would break a lot of our example code library.

Kampfkarren commented 7 years ago

Damn, you're right. It's difficult to force a naming convention for the actual language,if that's what you're proposing.

ghost commented 7 years ago

Most languages have a naming convention; it's virtually impossible to enforce, but publishing the naming convention and using it in all the example code and standard libraries will cause most programmers to use it.