View Single Post
  #13  
Old 05-04-2009, 05:17 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Codein View Post
Hrm, I can see what you mean. However, I don't agree that the 'pr_' prefix is the best way to DECLARE a private variable.

Maybe something like this:

PHP Code:
private this.pr_var "redfish"
Where the keyword actually declares the variable as private, and the name indicates that it is a private variable, as some sort of convention maybe.

I think indicating what's private and what's not should be completely down to the programmer.
I am 100 percent against a private keyword. Graal is too dynamic to have variable behavior changed by keywords.

I think this.__var (or this.__var__) is a much better way of indicating a private variable, because you can simply look at it and know that it's private without having to use a function to check the access level.

A great many scripters on Graal don't understand the importance of convention in a scripting language and Stefan makes no effort to try to enforce one. So even if you propose a convention it will most likely not be upheld and everyone will just indicate private variables however they please. My proposition forces scripters to name the variable a specific way if they want the functionality. You're defeating yourself with your own argument's complexity, simple is better.

Edit: Also, isn't it rather redundant to have both the keyword and the convention? If you're wanting everyone to use pr_ to indicate private variables, why not simply make that the way to declare them? That way you don't need to make a more complicated change to GScript by introducing access level keywords.
Quote:
Originally Posted by Loriel View Post
I do not see what being dynamic has to do with anything. In Ruby, which is dynamic as ****, every member variable is private.
Well if every member variable is private you don't need a private keyword then.
Quote:
Originally Posted by Loriel View Post
By that logic, C has no language features since they are all resolved by the compiler to assembly.
I'm saying that const is a compiler feature, not really a feature of GScript. With the proposed access level keyword, that would not be the case. So you can't say private would fit good with keywords such as const, because const isn't part of GScript, and an access level constraint certainly is.

Edit2: I just noticed I reached 3,000 posts, yay me.
__________________

Last edited by Inverness; 05-04-2009 at 05:32 PM..
Reply With Quote