ozra / onyx-lang

The Onyx Programming Language
Other
97 stars 5 forks source link

`Self` and `this` vs Other Namings #88

Closed ozra closed 8 years ago

ozra commented 8 years ago

I've been wanting this naming a long time, but put it off while looking at the naming-scheme in different languages. Now, I've finally come to the conclusion that it is the best naming:

Prior art, pros and con:

The motivation in two phrases: "Let's operate on this instance" "Let's call a function on the Self of this"

Currently Self and Type can be used interchangeably to refer to current type, and self (lowercase) refers to current instance. So, Type will be dropped, and self renamed this to clarify the difference.

See also #42

Thoughts?

stugol commented 8 years ago

Looks alright. But how about this (instance) and This (class)?

ozra commented 8 years ago

I like the clearer separation between this and Self, it also makes it easier to talk about the concepts (when pair-programming for instance).

ozra commented 8 years ago

Because of the possible confusion stemming from other languages uses, self will be a reserved word giving an error hinting towards this and Self.