NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Syntax Coloring for $this->var


Joined: 10 Oct 2007
Posts: 15
Reply with quote
I know I've asked before for various syntax coloring schemes. But just providing $this-> to be a different color would make life SOOOO much easier for classes.

I hope this would be easy for you dev team.

Thanks.
View user's profileFind all posts by dolphyxSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
but it may make ugly things too. For example you may have a function (not method) and use $this as a regular variable containing a class instance so there will be some $this-> calls. If we start highlighting $this differently, it will also highlight $this in such functions too because highlighter has no ability to track current context and treat tokens differently depending on they appear in a class method or not. Misleading results is what will be threre.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 21 Jan 2008
Posts: 19
Reply with quote
Dimitri: in Poland we say that you are looking for a hole in the whole. I think every PHP developer knows that $this is a somewhat special variable and can understand that it's highlighted differently. Also it will be posible to change color in settings.
View user's profileFind all posts by wenihalSend private message
Veteran

Joined: 06 Mar 2007
Posts: 158
Location: Poland
Reply with quote
... wenihal ... in Poland we say "pick nits" (szukac dziury w calym?) Razz

But back to this topic...
As for me, it will be not easier to work with classes if $this-> would have other colouring. This has no sense in fact.

Something like this would have more sense (and what I think schould be done):

public function delete() {}

public function ondelete() {}

This could of course have same colouring, but becouse now "delete" is colored in other way than "ondelete". And like in some post of this forum, $this->var schould have same colouring than eg. $this->thisisvar

At an above cases there is a possibility to check current context? Isnt it?

Every word starts with $ schould have same colour - and this is my opinion.

Regards and Respect

_________________
ML
View user's profileFind all posts by introSend private messageVisit poster's website


Joined: 10 Oct 2007
Posts: 15
Reply with quote
This is simply 2 completely different ways to work, it's a "preference". If $this-> being a different color is so detrimental, then simply make it the same color in the options as other vars.

At least the people who want it will have the OPTION to set to a different color.
Set it to the normal variable color by default, so it wont affect anyone who wants it the same.

I actually do not use "$this" as a standard var because I treat it as reserved.
View user's profileFind all posts by dolphyxSend private message


Joined: 05 Apr 2008
Posts: 17
Reply with quote
dolphyx wrote:
This is simply 2 completely different ways to work, it's a "preference". If $this-> being a different color is so detrimental, then simply make it the same color in the options as other vars.

At least the people who want it will have the OPTION to set to a different color.
Set it to the normal variable color by default, so it wont affect anyone who wants it the same.

I actually do not use "$this" as a standard var because I treat it as reserved.


I agree.

I never run out of variable names to use to actually use "$this" out of context. Somebody enlighten me (us) of when its a good idea to use the word "this" as a regular variable?

my lately repeated quote "Well... Dreamweaver does it"

I'm too much involved with PHPED that Dreamweaver is now old school. (like textpad)

I DEFINETLY miss this option from DreamWeaver though.
View user's profileFind all posts by dlite922Send private message


Joined: 18 Sep 2007
Posts: 54
Location: Croatia
Reply with quote
It looks like most of the posts comes from people that used Dreamweaver in their php starts.

I agree that $this should be as it was before, but it make sense to color $_GET, $_POST, $_COOKIE and $_SERVER variables different as they are global and since PHPEd is heavily OOP (thank you for that), global vars are the most dangerous once, don't you think?

PHPEd made a huge difference in tracking all references (so I can do $this->object1->object2->doThings()). Of course there is always rooms for more, like tracking singleton registry reference and similar.
View user's profileFind all posts by konixnetSend private messageVisit poster's website
Syntax Coloring for $this->var
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic