IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 1 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New I was thinking of this feature
[link|http://www.beanshell.org/manual/bshmanual.html#Scripted_Objects|http://www.beanshell...#Scripted_Objects]

In BeanShell, as in JavaScript and Perl, method "closures" allow you to create scripted objects. You can turn the results of a method call into an object reference by having the method return the special value this. You can then use the reference to refer to any variables set during the method call. Useful objects need methods of course, so in BeanShell scripted methods may also contain methods at any level. For example:


foo() {
print("foo");
x=5;

bar() {
print("bar");
}

return this;
}

myfoo = foo(); // prints "foo"
print( myfoo.x ); // prints "5"
myfoo.bar(); // prints "bar"

------

Objects rather than classes really.



Java is a joke, only it's not funny.

     --Alan Lovejoy
Collapse Edited by tuberculosis Aug. 21, 2007, 06:24:37 AM EDT
I was thinking of this feature
[link|http://www.beanshell.org/manual/bshmanual.html#Scripted_Objects|http://www.beanshell...#Scripted_Objects]

In BeanShell, as in JavaScript and Perl, method "closures" allow you to create scripted objects. You can turn the results of a method call into an object reference by having the method return the special value this. You can then use the reference to refer to any variables set during the method call. Useful objects need methods of course, so in BeanShell scripted methods may also contain methods at any level. For example:


foo() {
print("foo");
x=5;

bar() {
print("bar");
}

return this;
}

myfoo = foo(); // prints "foo"
print( myfoo.x ); // prints "5"
myfoo.bar(); // prints "bar"

------

Objects rather than classes really.



Java is a joke, only it's not funny.

     --Alan Lovejoy
     Groovy, man. - (admin) - (9)
         Well, fewer headaches anyway. - (FuManChu) - (1)
             It doesn't need to be that way, though. - (admin)
         Re: Groovy, man. - (deSitter) - (6)
             Groovy was specifically designed - (tuberculosis) - (5)
                 Re: Groovy was specifically designed - (admin) - (4)
                     1) Yes - (tuberculosis) - (3)
                         I'll have to look at beanshell closer then - (admin)
                         I don't see where it compiles to classes - (admin) - (1)
                             I was thinking of this feature - (tuberculosis)

Who's got a match?
61 ms