Lucee 5 variable modifiers questions

So I was reading Adam latest blog post about the lucee 5 property modifiers
and I had a thought. Up until now I have used the this scope for public
variables and the variables scope for private variables like this:

component {
variables.var1 = “accessible only inside this component”;
this.var2 = “accessible from outside this component”;
}

In my mind i equate this to:

//sudo code equiv
component {
private var1 = “accessible only inside this component”;
public var2 = “accessible from outside this component”;
}

With these new modifiers I would expect to rewrite my code like this:

// new way
component {
private this.var1 = “accessible only inside this component”;
public this.var2 = “accessible from outside this component”;
}

Question #1: Do the access modifiers also work for variables scoped
variables? i.e.

private variables.var1 = “accessible only inside this component”;

Question #2: Regardless of the answer to Q1, Is specifying the this scope
not redundant now? In my head I now read the new way as being this

public this.var2 == public public var2

I guess what Im really wondering wondering is if eventually we can write
our code like this. Where we can drop specifying the this scope altogether
in the variable declaration in the component body and only need to specify
it within a function that accesses it.

component {
private var1 = “accessible only inside this component”;
public var2 = “accessible from outside this component”;

public function doSomething(){
if( this.var1 == this.var2){
//do something else
}
}
}

See my comments between the lines.
Micha

So I was reading Adam latest blog post about the lucee 5 property
modifiers and I had a thought. Up until now I have used the this scope for
public variables and the variables scope for private variables like this:

component {
variables.var1 = “accessible only inside this component”;
this.var2 = “accessible from outside this component”;
}

In my mind i equate this to:

//sudo code equiv
component {
private var1 = “accessible only inside this component”;
public var2 = “accessible from outside this component”;
}

With these new modifiers I would expect to rewrite my code like this:

// new way
component {
private this.var1 = “accessible only inside this component”;
public this.var2 = “accessible from outside this component”;
}

Question #1: Do the access modifiers also work for variables scoped
variables? i.e.

No they only work for the this scope, the variables scope is always private.

private variables.var1 = “accessible only inside this component”;

Question #2: Regardless of the answer to Q1, Is specifying the this scope
not redundant now?

A big yes, you could always disable the variables scope in Lucee/Railo and
set the this scope to private. In the new Lucee dialect components have no
variables scope …Am Donnerstag, 9. April 2015 schrieb Steven Neiland :

In my head I now read the new way as being this

public this.var2 == public public var2

I guess what Im really wondering wondering is if eventually we can write
our code like this. Where we can drop specifying the this scope altogether
in the variable declaration in the component body and only need to specify
it within a function that accesses it.

component {
private var1 = “accessible only inside this component”;
public var2 = “accessible from outside this component”;

public function doSomething(){
if( this.var1 == this.var2){
//do something else
}
}
}


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+unsubscribe@googlegroups.com
<javascript:_e(%7B%7D,‘cvml’,‘lucee%2Bunsubscribe@googlegroups.com’);>.
To post to this group, send email to lucee@googlegroups.com
<javascript:_e(%7B%7D,‘cvml’,‘lucee@googlegroups.com’);>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/01343201-dfcc-4e9d-bbc6-904ae478cc0e%40googlegroups.com
https://groups.google.com/d/msgid/lucee/01343201-dfcc-4e9d-bbc6-904ae478cc0e%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

Excellent! Great work.