please please please add THIS aswell as SELF

BlitzMax Forums/BlitzMax Programming/please please please add THIS aswell as SELF

skn3(Posted 2005) [#1]
I can't tell you how many times I have written this.field inside a method. It is doing my nut, I am so used to typing this.field in many other languages.

Please please please please please can 'this' be added as an optional alternative to 'self'.


AaronK(Posted 2005) [#2]
Well you shouldn't be going self.field or this.field, there is no need. Inside a method, just go 'field'. Unless you're naming your arguments to a method the same as your fields and if you're doing that, don't and you'll be OK.

Aaron


FlameDuck(Posted 2005) [#3]
What Aaron said. Both self/this are only supposed to be used when passing an object on to another method as an arguement!


skn3(Posted 2005) [#4]
Ok well my point still stands :) I simply prefer this to self.


Curtastic(Posted 2005) [#5]
also, if self=list.first()


Tom(Posted 2005) [#6]
I've been using Self.blah inside methods to keep it as clear as possible what's going on.


AaronK(Posted 2005) [#7]
Tom, give it up :). Use some other method. Maybe underscore your member/private fields (They should all be private really) so it's easy to understand and a lot less typing :)

Aaron


Tom(Posted 2005) [#8]
Why? Self. takes a split second to type :)


AaronK(Posted 2005) [#9]
And an underscore even less, 1/5th the time :)


ImaginaryHuman(Posted 2005) [#10]
I'm glad you guys (and gals?) are talking about this `self` stuff, at least, I was beginning to wonder if it was needed inside a method or not. Cheers.

I guess it doesn't make things any slower to add the self. part?


Tom(Posted 2005) [#11]
Aaronk: I give _ a go, what I found was that I need to look at the keyboard when I type shift & - (too many typos), where as I don't typing Self :)


Self.Cya!
Tom :)


AaronK(Posted 2005) [#12]
Hahaha! Fair enough! ;)