Another feature I added (to my version of BeanShell) is the ability to =
attach ad hoc =E2=80=9Cscripty=E2=80=9D methods to common classes =
(including final classes). I=E2=80=99d be interested in hearing =
feedback on this feature. When using BeanShell at my last job I found =
that script programmers wanted methods like right(int charCount) added =
to the String class. I also added some common operations to the File =
class via this mechanism. This made the Perl and Python guys much =
The mechanism works by registering an extension (fallback delegate) =
class or scripted object with the interpreter.
Example: Interpreter.registerExtension(String.class, =
If the multipositional and/or named parameter submissions are accepted =
this becomes particularly useful as it will allow the addition of such =
methods to existing classes.
I saw a few posts related to adding methods to
exisitng classes but I missed the first part of the
post. Is this possible? how? Also, I'd like to make a
program with a code window that highlights the line
being executed by beanshell as it executes. Is this
3790 Colorado Ave. G Mobile: (303)641-8936
Boulder, CO eFax: (305)723-2968
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
On Wed, Apr 17, 2002 at 08:51:35AM -0700, Brad Urani wrote:
> I saw a few posts related to adding methods to
> exisitng classes but I missed the first part of the
> post. Is this possible? how? Also, I'd like to make a
Currently this isn't there, but it's been suggested for a variety of reasons,
including syntactic sugar for regular expressions. It would be a light
weight addition so we'll consider it.
On a related note I am planning to add the real ability to subclass classes
in an upcoming BeanShell release. So you'll be able to add methods in that
way... by subclassing to real Java objects with scripted overloaded or
> program with a code window that highlights the line
> being executed by beanshell as it executes. Is this
Currrently there isn't any feeedback from ther parser to support this, but
I've thought about adding it to support things like changing the prompt
in the GUI when inside of an expression (like Bourne shell, etc.). This
might be an easy addition.