Forums

get e set

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

get e set

Postby relez » Sun Sep 28, 2008 3:28 pm

This code is ok

Code: Select all
   pro p as int
      get
         return _pprog
      set
         _pprog = value


and this is not

Code: Select all
   pro p as int
      set
         _pprog = value
      get
         return _pprog


Why? For example C# doesn't care about get-set order....
relez
 
Posts: 69

Re: get e set

Postby Charles » Mon Sep 29, 2008 2:47 pm

I didn't think about it much because I've never put the setter before the getter. Most other developers do not either based on source code I've read.

I don't see any need to put the "set" first and there is some value in having a more uniform syntax, therefore, I'm going to leave it as is. I'm willing to improve the error message if you think that would be helpful.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: get e set

Postby relez » Mon Sep 29, 2008 3:45 pm

Yes, it was a discovery entirely fortuitous i simply added get after set modifying a program. Yes, i think an improved message could be helpful, although I do not understand why the order set-get should be considered a mistake, that is if there is a technical reason.
Tk u.
relez
 
Posts: 69


Return to Discussion

Who is online

Users browsing this forum: No registered users and 133 guests