component { private this.lastName="Sorglos"; // cannot be accessed from outside public this.comment="This is a comment"; // can be accessed from outside ... }
component { variables.lastName="Sorglos"; // cannot be accessed from outside public this.comment="This is a comment"; // can be accessed from outside ... }
Today I was reading over the Lucee 5 docs. One thing I noticed was Access Modifiers for variables. http://docs.lucee.org/guides/lucee-5/access-modifiers.htmlMy question is how is this code:component { private this.lastName="Sorglos"; // cannot be accessed from outside public this.comment="This is a comment"; // can be accessed from outside ... }
[...]
Am I missing something with the this / variables scopes of a component?
public somePublicVar; // equiv to this.somePublicVar
private somePrivateVar; //equiv to variables.somePrivateVar
--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/dfece93c-e1a6-4e83-ab08-ec495dbf17c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Igal,
I was looking at this earlier, when I Andrew’s email came through. Wouldn’t it make sense, though, for the access modifiers to provide an implicit this
scoping.
private this.privateVar="foo";
and
public this.publicVar="bar";
seems a bit cumbersome when the access modifier is already at work.
IMHO private privateVar="foo";
( or just an empty declaration of `private privateVar;’ ) implicitly scoping is clean and matches the function accessibility declarations, as is the case in other dev languages
For what it’s worth, I think access modifiers are a great idea.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/56B123FF.3040004%40lucee.org.
Wouldn’t it make sense, though, for the
access modifiers to provide an implicit this
scoping.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/etPan.56b12818.f32df9f.5c78%40jonclausen-mbp.local.
the idea is to combine the two scopes, variables and this, into one.
so with the absence of the variables scope, we still want to allow to keep variables as private.
private this.lastName="Sorglos"; // cannot be accessed from outside public this.comment="This is a comment"; // can be accessed from outside
public myPublicVar = "something";
this.myPublicVar = "something";
public this.myPublicVar = "something";
public variables.myVar = "something";
variables.myVar = "something";