RE: [Beanshell-users] RE: Announce: Upcoming BeanShell 1.3 Scoping Changes...
"White, John K" <JohnWhite-1VmriVQ4F2F8UrSeD/[email protected]>
| Newsgroups | gmane.comp.java.beanshell.devel |
|---|---|
| Message-ID | <2B5685BB89170947A53B9EDD0CA6276C2CBF00@sdomsg00.corp.fairisaac.com> |
the new beanshell scoping is similar to perl's, right? eg:
sub foo() {
$bar1 = "going down"; # global
my $bar2 = "the road"; # local
}
or, translated to beanshell:
foo() {
bar1 = "going down"; // global
var bar2 = "the road"; // local
}
if so then at least beanshell has company... now whether that
is good or bad company, well.. :)
j.
> -----Original Message-----
> From: Daniel Leuck [mailto:[email protected]]
> Sent: Wednesday, June 25, 2003 1:31 PM
> To: [email protected]; 'Shankar Unni';
> beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: RE: [Beanshell-users] RE: [Beanshell-dev] Announce:
> Upcoming BeanShell 1.3 Scoping Changes...
>
>
> > In BeanShell 1.3 the assignments
> > now follow the "strict Java" style of applying wherever the
> > variable was defined, or ultimately in the global scope if
> > not defined at all.
>
> I think the first part is great, the second part, as Shankar
> pointed out, is problematic.
>
> I really think making auto-declared variables global will
> cause massive pollution of the namespace, introduce bizarre
> and hard to track bugs, and cause beanshell to be unsuitable
> for large scripts.
>
> -----Original Message-----
> From: beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> [mailto:beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On
> Behalf Of Pat
> Sent: Thursday, June 26, 2003 5:07 AM
> To: Daniel Leuck; 'Shankar Unni';
> beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: Re: [Beanshell-users] RE: [Beanshell-dev] Announce:
> Upcoming BeanShell 1.3 Scoping Changes...
>
> On Thu, Jun 26, 2003 at 04:14:24AM +0900, Daniel Leuck wrote:
> > Hi Pat,
> >
> > I just noticed the "global" scope second part of this statement. I
> > missed that the first time around (damn that sake!) I
> think the local
> > scope should be used for auto-declarations, otherwise won't
> you have
> > pollution of the namespace causing larger scripts to be massively
> > confusing?
>
> I really don't like it either and have been wondering if I
> should recant ;) I hate having to hide my variables in the new style.
>
> But do we really want most people to have to say:
>
> setFlag() {
> super.flag = true;
> }
>
> as opposed to:
>
> setFlag() {
> flag = true;
> var localVar = false; // as needed
> }
>
> The former seems very awkward for the most common usage and
> the latter also seems more consistent with Java.
>
> Looking at it again, the change just seems the right thing to do.
>
> We could formaliz the "local scoping" mode by making a
> command to turn it on
> or off, scoped by namespace? It would be easy to do. So
> some of us could
> start our scripts with:
>
> setLocalScoping( true );
>
> and continue working in the old style... but gack.
>
> BTW, in the process of rewriting the user manual making this
> change allows me
> to remove several pages of explanation and just seems more
> natural. Sometimes that's the best indication of the right
> thing to do.
>
> I'm open to suggestions.
>
>
> Pat
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU
> Hosting Partner. Refer Dedicated Servers. We Manage Them. You
> Get 10% Monthly Commission! INetU Dedicated Managed Hosting
> http://www.inetu.net/partner/index.php
>
> _______________________________________________
> Beanshell-developers mailing list
> Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/beanshell-developers
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU
> Hosting Partner. Refer Dedicated Servers. We Manage Them. You
> Get 10% Monthly Commission! INetU Dedicated Managed Hosting
> http://www.inetu.net/partner/index.php
>
> _______________________________________________
> Beanshell-developers mailing list
> Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/beanshell-developers
>
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php