pluggable syntax, ikvm

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

pluggable syntax, ikvm

gcoles
Hi,
    I have two questions. First, is it possible that Pat might approve
the design of a pluggable syntax parser for beanshell? This might be of
limited use, but sometimes it's fun to think about things for which no
use seems to exist. It would be cool to be able to write c# code, for
example,  in beanshell and have it execute. I know this is not a weekend
project, I just wondered if this kind of thing is contemplated.

Second, has anyone used beanshell through IKVM? I am about to try it.

thx
George


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

patniemeyer
> Hi,
>     I have two questions. First, is it possible that Pat might approve
> the design of a pluggable syntax parser for beanshell? This might be of
> limited use, but sometimes it's fun to think about things for which no
> use seems to exist. It would be cool to be able to write c# code, for
> example,  in beanshell and have it execute. I know this is not a weekend
> project, I just wondered if this kind of thing is contemplated.

Here is a very preliminary proposal on that front:

  http://beanshell.org/BeanShellDialects.html



Pat




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: pluggable syntax, ikvm

Daniel Leuck
In reply to this post by gcoles
Hi George,

>     I have two questions. First, is it possible that Pat might approve
> the design of a pluggable syntax parser for beanshell? This might be of
> limited use, but sometimes it's fun to think about things for which no
> use seems to exist.

There are plenty of uses.  Miniature domain specific languages are used for
all kinds of things (regular expressions, queries, etc.)

On a related note, JetBrains has released a beta of their LOP (language
oriented programming) tool:
http://www.jetbrains.com/mps

Martin Fowler has written an excellent article on the subject:
http://www.martinfowler.com/articles/languageWorkbench.html

If you are attending JavaOne make sure to signup for the BeanShell BOF.  I
am sure this will be a topic of discussion.

Cheers,
Dan



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: pluggable syntax, ikvm

Stevenson, Scott W
In reply to this post by gcoles
What about adding operator overloading to BeanShell?

Java lacks a few features of C++ that I really miss, which would improve
it as a scripting language tremendously.  One is operator overloading,
the other is the constructor auto-casting mechanism.  (i.e. constructor
Foo(Bar) can be used to auto cast a Bar object to a Foo object)

Groovy has a really cool approach to operator overloading.

value = foo+bar;

Translates to

value = foo.plus(bar);

foo[ [1,2,3] ] = [3,4,2];

Translates to

foo.putAt(List,List);


All you have to do to use operator overloading is implement the
appropriate methods in your Java classes.

plus()
minus()
times()
divide()
putAt()
getAt()
etc.

Is there any chance of adding this type of functionality to BeanShell?

Scott...



-----Original Message-----
From: Pat Niemeyer [mailto:[hidden email]]
Sent: Thursday, June 23, 2005 9:20 AM
To: George M. Coles
Cc: [hidden email]
Subject: Re: [Beanshell-users] pluggable syntax, ikvm


> Hi,
>     I have two questions. First, is it possible that Pat might approve

> the design of a pluggable syntax parser for beanshell? This might be
> of limited use, but sometimes it's fun to think about things for which

> no use seems to exist. It would be cool to be able to write c# code,
> for example,  in beanshell and have it execute. I know this is not a
> weekend project, I just wondered if this kind of thing is
> contemplated.

Here is a very preliminary proposal on that front:

  http://beanshell.org/BeanShellDialects.html



Pat




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
_______________________________________________
Beanshell-users mailing list [hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

gcoles
In reply to this post by gcoles
I read Pat's document and I read Martin Fowler's artical on LOP when it
appeared in my rss feed. I agree with Pat's stated goal of designing
something that carries minimal cost not to use and is readable. I am
glad he recognized that there might be a desire to be able to swap in
another language at the top-level, rather than adding it on as a leaf
node on the JVM ByteCode/Java/Beanshell tree as a DSL. The
embedded-language scheme is very powerful and as conveived seems very
common-sensical, but I am someone who is also interested in the
pie-in-the-sky vision of  allowing an arbitrary language at the "Java"
level of that tree.


Daniel Leuck wrote:

>Hi George,
>
>  
>
>>    I have two questions. First, is it possible that Pat might approve
>>the design of a pluggable syntax parser for beanshell? This might be of
>>limited use, but sometimes it's fun to think about things for which no
>>use seems to exist.
>>    
>>
>
>There are plenty of uses.  Miniature domain specific languages are used for
>all kinds of things (regular expressions, queries, etc.)
>
>On a related note, JetBrains has released a beta of their LOP (language
>oriented programming) tool:
>http://www.jetbrains.com/mps
>
>Martin Fowler has written an excellent article on the subject:
>http://www.martinfowler.com/articles/languageWorkbench.html
>
>If you are attending JavaOne make sure to signup for the BeanShell BOF.  I
>am sure this will be a topic of discussion.
>
>Cheers,
>Dan
>
>  
>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

patniemeyer
> I read Pat's document and I read Martin Fowler's artical on LOP when it
> appeared in my rss feed. I agree with Pat's stated goal of designing
> something that carries minimal cost not to use and is readable. I am
> glad he recognized that there might be a desire to be able to swap in
> another language at the top-level, rather than adding it on as a leaf
> node on the JVM ByteCode/Java/Beanshell tree as a DSL. The
> embedded-language scheme is very powerful and as conveived seems very
> common-sensical, but I am someone who is also interested in the
> pie-in-the-sky vision of  allowing an arbitrary language at the "Java"
> level of that tree.

I'm certainly interested in other possibilities... like having BeanShell
be able to script parts of its own parser and syntax tree.  It just seems
to me that modifying the grammar for the language to extend it and doing
so in a way that doesn't break the existing grammar is not easy and not
something that many people would want to do...  I don't enjoy doing it ;)

So, I'm curious to see how far we can go with this pluggable eval style
extension first.  Becuase that seems like something that would allow any
average programmer to create new syntaxes easily...  especially if we give
them some powerful support classes.  I am looking forward to playing with
that ;)

After the current release is closer to bug-free I plan to dive into that.


Pat




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: pluggable syntax, ikvm

Furash Gary
In reply to this post by gcoles
I like the idea of being able to make topic specific languages.  It's
actually kind of like an extension to the command thing - making stuff
that just appears to be part of the language.

However, I'm often tempted to say "Wouldn't this feature from [lanugage
X]" be cool in groovy."  I like operator overloading, I like putting in
"${variable name}", etc., but I'm not sure when to stop asking for those
to be put in BeanShell.

Pat - can you correct/clarify what I THINK is the basic way these
enhancements are evaluated:

BeanShell is based on being Java, but reduces the "stuff" required to do
java (script files, *.java, floating methods, untyped variables, not
having to do returns, easier access to get/set, etc) - it's still java,
but it's just easier to do work.

So, while I'd like to be able to say:

X = "hat";
Print("${x} is something you wear");

That's not "java coding with fewer restrictions" - its "something
completely new."



-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Pat
Niemeyer
Sent: Thursday, June 23, 2005 8:04 AM
To: George M. Coles
Cc: Daniel Leuck; [hidden email]
Subject: Re: [Beanshell-users] pluggable syntax, ikvm


> I read Pat's document and I read Martin Fowler's artical on LOP when
> it appeared in my rss feed. I agree with Pat's stated goal of
> designing something that carries minimal cost not to use and is
> readable. I am glad he recognized that there might be a desire to be
> able to swap in another language at the top-level, rather than adding
> it on as a leaf node on the JVM ByteCode/Java/Beanshell tree as a DSL.

> The embedded-language scheme is very powerful and as conveived seems
> very common-sensical, but I am someone who is also interested in the
> pie-in-the-sky vision of  allowing an arbitrary language at the "Java"

> level of that tree.

I'm certainly interested in other possibilities... like having BeanShell
be able to script parts of its own parser and syntax tree.  It just
seems to me that modifying the grammar for the language to extend it and
doing so in a way that doesn't break the existing grammar is not easy
and not something that many people would want to do...  I don't enjoy
doing it ;)

So, I'm curious to see how far we can go with this pluggable eval style
extension first.  Becuase that seems like something that would allow any
average programmer to create new syntaxes easily...  especially if we
give them some powerful support classes.  I am looking forward to
playing with that ;)

After the current release is closer to bug-free I plan to dive into
that.


Pat




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
_______________________________________________
Beanshell-users mailing list [hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

Paul Franz
In reply to this post by Stevenson, Scott W
Stevenson, Scott W wrote:
> What about adding operator overloading to BeanShell?
>

And I remember the feature from C++. I hated it as developer. It caused
alot of grief. Especially, order predence and operators overrides and
return types.

How do you handle:

Integer j = 0;
MyClass k;
AnotherClass m;
Object obj;

obj = k+m+j;

What object type is obj?

Paul Franz


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

Martin C. Martin-4


Paul Franz wrote:

> Stevenson, Scott W wrote:
>
>> What about adding operator overloading to BeanShell?
>>
>
> And I remember the feature from C++. I hated it as developer. It caused
> alot of grief. Especially, order predence and operators overrides and
> return types.
>
> How do you handle:
>
> Integer j = 0;
> MyClass k;
> AnotherClass m;
> Object obj;
>
> obj = k+m+j;
>
> What object type is obj?

Same type as plus(plus(k, m), j).  Return types and operator overrides
are common to all function polymorphism.

Operator overloading can be really useful is "base code," i.e. code
that's reused a lot and where the operators have natural meaning.
Linear algebra packages are maddening without them.  Can they can be
useful for collections as well, e.g. using + for concatenation.

Their main use to make it much easier for the programmer to parse what's
going on, by having certain common operations look visually distinct.
For example,

compensation["bob"] + bonus[workgroup["bob"]]

is a lot clearer than:

((Compensation)
compensation.get("bob")).plus((Bonus)bonus.get((String)workgroup.get("bob")))

Why so many programmers feel so strongly that the latter is better is
beyond me.

On the other hand, operator overloading can certainly be abused, e.g.
when someone first learns of it and uses it everywhere, including very
special purpose classes that you only run across occasionally.

- Martin


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: pluggable syntax, ikvm

Stevenson, Scott W
In reply to this post by gcoles
Hi Paul,

I agree with you that it can cause confusion and should be avoided when
developing enterprise level applications.  But scripting languages are a
different story.  The main reason for using a high level scripting
lanuage is for simplicity, brievity, and portablity.  Scripting
languages should allow us to a task in a clear expressive way with fewer
lines of code.  Operator overloading is also VERY useful for
engineering, mathematical, and scientific applications, in which I am
currently envolved.  

Which of these is easier to write and to read:

// Multiply  column0*column2, column1*column3, and put results back in
columns 5 and 6
array2d[ [5,6] ] = array2d[0,1]*array2d[2,3]

// Java
c0 = array2d.getColumn(0);
c2 = array2d.getColumn(2);
c5 = c0.times(c2);
c1 = array2d.getColumn(1);
c3 = array2d.getColumn(3);
c6 = c1.times(c3);
array2d.putAt(5,c5);
array2d.putAt(6,c6);




-----Original Message-----
From: Paul Franz [mailto:[hidden email]]
Sent: Thursday, June 23, 2005 10:21 AM
To: Stevenson, Scott W
Cc: [hidden email]; George M. Coles; [hidden email]
Subject: Re: [Beanshell-users] pluggable syntax, ikvm


Stevenson, Scott W wrote:
> What about adding operator overloading to BeanShell?
>

And I remember the feature from C++. I hated it as developer. It caused
alot of grief. Especially, order predence and operators overrides and
return types.

How do you handle:

Integer j = 0;
MyClass k;
AnotherClass m;
Object obj;

obj = k+m+j;

What object type is obj?

Paul Franz


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: pluggable syntax, ikvm

Furash Gary
In reply to this post by gcoles
Strings kind of work this way, don't they?  

String x = "hat"; String y = "cat"
String z = x + y ---> "hatcat"

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
Stevenson, Scott W
Sent: Thursday, June 23, 2005 8:54 AM
To: Paul Franz
Cc: [hidden email]; George M. Coles; [hidden email]
Subject: RE: [Beanshell-users] pluggable syntax, ikvm


Hi Paul,

I agree with you that it can cause confusion and should be avoided when
developing enterprise level applications.  But scripting languages are a
different story.  The main reason for using a high level scripting
lanuage is for simplicity, brievity, and portablity.  Scripting
languages should allow us to a task in a clear expressive way with fewer
lines of code.  Operator overloading is also VERY useful for
engineering, mathematical, and scientific applications, in which I am
currently envolved.  

Which of these is easier to write and to read:

// Multiply  column0*column2, column1*column3, and put results back in
columns 5 and 6 array2d[ [5,6] ] = array2d[0,1]*array2d[2,3]

// Java
c0 = array2d.getColumn(0);
c2 = array2d.getColumn(2);
c5 = c0.times(c2);
c1 = array2d.getColumn(1);
c3 = array2d.getColumn(3);
c6 = c1.times(c3);
array2d.putAt(5,c5);
array2d.putAt(6,c6);




-----Original Message-----
From: Paul Franz [mailto:[hidden email]]
Sent: Thursday, June 23, 2005 10:21 AM
To: Stevenson, Scott W
Cc: [hidden email]; George M. Coles; [hidden email]
Subject: Re: [Beanshell-users] pluggable syntax, ikvm


Stevenson, Scott W wrote:
> What about adding operator overloading to BeanShell?
>

And I remember the feature from C++. I hated it as developer. It caused
alot of grief. Especially, order predence and operators overrides and
return types.

How do you handle:

Integer j = 0;
MyClass k;
AnotherClass m;
Object obj;

obj = k+m+j;

What object type is obj?

Paul Franz


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
_______________________________________________
Beanshell-users mailing list [hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

Paul Franz
And anybody who has done ANY profiling at all realizes that constant
addy strings is a bad thing. It creates WAY too many objects. That is
why StringBuffer as a String accumulator is a great thing.

Paul Franz

Furash Gary wrote:

> Strings kind of work this way, don't they?  
>
> String x = "hat"; String y = "cat"
> String z = x + y ---> "hatcat"
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Stevenson, Scott W
> Sent: Thursday, June 23, 2005 8:54 AM
> To: Paul Franz
> Cc: [hidden email]; George M. Coles; [hidden email]
> Subject: RE: [Beanshell-users] pluggable syntax, ikvm
>
>
> Hi Paul,
>
> I agree with you that it can cause confusion and should be avoided when
> developing enterprise level applications.  But scripting languages are a
> different story.  The main reason for using a high level scripting
> lanuage is for simplicity, brievity, and portablity.  Scripting
> languages should allow us to a task in a clear expressive way with fewer
> lines of code.  Operator overloading is also VERY useful for
> engineering, mathematical, and scientific applications, in which I am
> currently envolved.  
>
> Which of these is easier to write and to read:
>
> // Multiply  column0*column2, column1*column3, and put results back in
> columns 5 and 6 array2d[ [5,6] ] = array2d[0,1]*array2d[2,3]
>
> // Java
> c0 = array2d.getColumn(0);
> c2 = array2d.getColumn(2);
> c5 = c0.times(c2);
> c1 = array2d.getColumn(1);
> c3 = array2d.getColumn(3);
> c6 = c1.times(c3);
> array2d.putAt(5,c5);
> array2d.putAt(6,c6);
>
>
>
>
> -----Original Message-----
> From: Paul Franz [mailto:[hidden email]]
> Sent: Thursday, June 23, 2005 10:21 AM
> To: Stevenson, Scott W
> Cc: [hidden email]; George M. Coles; [hidden email]
> Subject: Re: [Beanshell-users] pluggable syntax, ikvm
>
>
> Stevenson, Scott W wrote:
>
>>What about adding operator overloading to BeanShell?
>>
>
>
> And I remember the feature from C++. I hated it as developer. It caused
> alot of grief. Especially, order predence and operators overrides and
> return types.
>
> How do you handle:
>
> Integer j = 0;
> MyClass k;
> AnotherClass m;
> Object obj;
>
> obj = k+m+j;
>
> What object type is obj?
>
> Paul Franz
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
> _______________________________________________
> Beanshell-users mailing list [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: pluggable syntax, ikvm

Furash Gary
In reply to this post by gcoles
I knew that ;-)  I was just trying to make an analogy with operator
overloading.

g

-----Original Message-----
From: Paul Franz [mailto:[hidden email]]
Sent: Thursday, June 23, 2005 10:21 AM
To: Furash Gary
Cc: Stevenson, Scott W; [hidden email]; George M. Coles;
[hidden email]
Subject: Re: [Beanshell-users] pluggable syntax, ikvm


And anybody who has done ANY profiling at all realizes that constant
addy strings is a bad thing. It creates WAY too many objects. That is
why StringBuffer as a String accumulator is a great thing.

Paul Franz

Furash Gary wrote:

> Strings kind of work this way, don't they?
>
> String x = "hat"; String y = "cat"
> String z = x + y ---> "hatcat"
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Stevenson, Scott W
> Sent: Thursday, June 23, 2005 8:54 AM
> To: Paul Franz
> Cc: [hidden email]; George M. Coles;
> [hidden email]
> Subject: RE: [Beanshell-users] pluggable syntax, ikvm
>
>
> Hi Paul,
>
> I agree with you that it can cause confusion and should be avoided
> when developing enterprise level applications.  But scripting
> languages are a different story.  The main reason for using a high
> level scripting lanuage is for simplicity, brievity, and portablity.  
> Scripting languages should allow us to a task in a clear expressive
> way with fewer lines of code.  Operator overloading is also VERY
> useful for engineering, mathematical, and scientific applications, in
> which I am currently envolved.
>
> Which of these is easier to write and to read:
>
> // Multiply  column0*column2, column1*column3, and put results back in

> columns 5 and 6 array2d[ [5,6] ] = array2d[0,1]*array2d[2,3]
>
> // Java
> c0 = array2d.getColumn(0);
> c2 = array2d.getColumn(2);
> c5 = c0.times(c2);
> c1 = array2d.getColumn(1);
> c3 = array2d.getColumn(3);
> c6 = c1.times(c3);
> array2d.putAt(5,c5);
> array2d.putAt(6,c6);
>
>
>
>
> -----Original Message-----
> From: Paul Franz [mailto:[hidden email]]
> Sent: Thursday, June 23, 2005 10:21 AM
> To: Stevenson, Scott W
> Cc: [hidden email]; George M. Coles;
[hidden email]

> Subject: Re: [Beanshell-users] pluggable syntax, ikvm
>
>
> Stevenson, Scott W wrote:
>
>>What about adding operator overloading to BeanShell?
>>
>
>
> And I remember the feature from C++. I hated it as developer. It
> caused
> alot of grief. Especially, order predence and operators overrides and
> return types.
>
> How do you handle:
>
> Integer j = 0;
> MyClass k;
> AnotherClass m;
> Object obj;
>
> obj = k+m+j;
>
> What object type is obj?
>
> Paul Franz
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies

> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
> _______________________________________________
> Beanshell-users mailing list [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: pluggable syntax, ikvm

Furash Gary
In reply to this post by gcoles
However, this leads to another interesting idea (at least to me).  Since
much of the time you're going to be sticking strings onto other strings
or string-like things, is there any reason why you wouldn't want
beanshell to do that for you?

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Furash
Gary
Sent: Thursday, June 23, 2005 10:25 AM
To: Paul Franz
Cc: Stevenson, Scott W; [hidden email]; George M. Coles;
[hidden email]
Subject: RE: [Beanshell-users] pluggable syntax, ikvm


I knew that ;-)  I was just trying to make an analogy with operator
overloading.

g

-----Original Message-----
From: Paul Franz [mailto:[hidden email]]
Sent: Thursday, June 23, 2005 10:21 AM
To: Furash Gary
Cc: Stevenson, Scott W; [hidden email]; George M. Coles;
[hidden email]
Subject: Re: [Beanshell-users] pluggable syntax, ikvm


And anybody who has done ANY profiling at all realizes that constant
addy strings is a bad thing. It creates WAY too many objects. That is
why StringBuffer as a String accumulator is a great thing.

Paul Franz

Furash Gary wrote:

> Strings kind of work this way, don't they?
>
> String x = "hat"; String y = "cat"
> String z = x + y ---> "hatcat"
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Stevenson, Scott W
> Sent: Thursday, June 23, 2005 8:54 AM
> To: Paul Franz
> Cc: [hidden email]; George M. Coles;
> [hidden email]
> Subject: RE: [Beanshell-users] pluggable syntax, ikvm
>
>
> Hi Paul,
>
> I agree with you that it can cause confusion and should be avoided
> when developing enterprise level applications.  But scripting
> languages are a different story.  The main reason for using a high
> level scripting lanuage is for simplicity, brievity, and portablity.  
> Scripting languages should allow us to a task in a clear expressive
> way with fewer lines of code.  Operator overloading is also VERY
> useful for engineering, mathematical, and scientific applications, in
> which I am currently envolved.
>
> Which of these is easier to write and to read:
>
> // Multiply  column0*column2, column1*column3, and put results back in

> columns 5 and 6 array2d[ [5,6] ] = array2d[0,1]*array2d[2,3]
>
> // Java
> c0 = array2d.getColumn(0);
> c2 = array2d.getColumn(2);
> c5 = c0.times(c2);
> c1 = array2d.getColumn(1);
> c3 = array2d.getColumn(3);
> c6 = c1.times(c3);
> array2d.putAt(5,c5);
> array2d.putAt(6,c6);
>
>
>
>
> -----Original Message-----
> From: Paul Franz [mailto:[hidden email]]
> Sent: Thursday, June 23, 2005 10:21 AM
> To: Stevenson, Scott W
> Cc: [hidden email]; George M. Coles;
[hidden email]

> Subject: Re: [Beanshell-users] pluggable syntax, ikvm
>
>
> Stevenson, Scott W wrote:
>
>>What about adding operator overloading to BeanShell?
>>
>
>
> And I remember the feature from C++. I hated it as developer. It
> caused
> alot of grief. Especially, order predence and operators overrides and
> return types.
>
> How do you handle:
>
> Integer j = 0;
> MyClass k;
> AnotherClass m;
> Object obj;
>
> obj = k+m+j;
>
> What object type is obj?
>
> Paul Franz
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies

> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
> _______________________________________________
> Beanshell-users mailing list [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

gcoles
You mean like?

String newString = bsh.append( "foo" ) instead of

StringBuffer sb = nwe STringBuffer();
sb.append("foo");

Or how about

bsh.doAll();


Furash Gary wrote:

>However, this leads to another interesting idea (at least to me).  Since
>much of the time you're going to be sticking strings onto other strings
>or string-like things, is there any reason why you wouldn't want
>beanshell to do that for you?
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of Furash
>Gary
>Sent: Thursday, June 23, 2005 10:25 AM
>To: Paul Franz
>Cc: Stevenson, Scott W; [hidden email]; George M. Coles;
>[hidden email]
>Subject: RE: [Beanshell-users] pluggable syntax, ikvm
>
>
>I knew that ;-)  I was just trying to make an analogy with operator
>overloading.
>
>g
>
>-----Original Message-----
>From: Paul Franz [mailto:[hidden email]]
>Sent: Thursday, June 23, 2005 10:21 AM
>To: Furash Gary
>Cc: Stevenson, Scott W; [hidden email]; George M. Coles;
>[hidden email]
>Subject: Re: [Beanshell-users] pluggable syntax, ikvm
>
>
>And anybody who has done ANY profiling at all realizes that constant
>addy strings is a bad thing. It creates WAY too many objects. That is
>why StringBuffer as a String accumulator is a great thing.
>
>Paul Franz
>
>Furash Gary wrote:
>  
>
>>Strings kind of work this way, don't they?
>>
>>String x = "hat"; String y = "cat"
>>String z = x + y ---> "hatcat"
>>
>>-----Original Message-----
>>From: [hidden email]
>>[mailto:[hidden email]] On Behalf Of
>>Stevenson, Scott W
>>Sent: Thursday, June 23, 2005 8:54 AM
>>To: Paul Franz
>>Cc: [hidden email]; George M. Coles;
>>[hidden email]
>>Subject: RE: [Beanshell-users] pluggable syntax, ikvm
>>
>>
>>Hi Paul,
>>
>>I agree with you that it can cause confusion and should be avoided
>>when developing enterprise level applications.  But scripting
>>languages are a different story.  The main reason for using a high
>>level scripting lanuage is for simplicity, brievity, and portablity.  
>>Scripting languages should allow us to a task in a clear expressive
>>way with fewer lines of code.  Operator overloading is also VERY
>>useful for engineering, mathematical, and scientific applications, in
>>which I am currently envolved.
>>
>>Which of these is easier to write and to read:
>>
>>// Multiply  column0*column2, column1*column3, and put results back in
>>    
>>
>
>  
>
>>columns 5 and 6 array2d[ [5,6] ] = array2d[0,1]*array2d[2,3]
>>
>>// Java
>>c0 = array2d.getColumn(0);
>>c2 = array2d.getColumn(2);
>>c5 = c0.times(c2);
>>c1 = array2d.getColumn(1);
>>c3 = array2d.getColumn(3);
>>c6 = c1.times(c3);
>>array2d.putAt(5,c5);
>>array2d.putAt(6,c6);
>>
>>
>>
>>
>>-----Original Message-----
>>From: Paul Franz [mailto:[hidden email]]
>>Sent: Thursday, June 23, 2005 10:21 AM
>>To: Stevenson, Scott W
>>Cc: [hidden email]; George M. Coles;
>>    
>>
>[hidden email]
>  
>
>>Subject: Re: [Beanshell-users] pluggable syntax, ikvm
>>
>>
>>Stevenson, Scott W wrote:
>>
>>    
>>
>>>What about adding operator overloading to BeanShell?
>>>
>>>      
>>>
>>And I remember the feature from C++. I hated it as developer. It
>>caused
>>alot of grief. Especially, order predence and operators overrides and
>>return types.
>>
>>How do you handle:
>>
>>Integer j = 0;
>>MyClass k;
>>AnotherClass m;
>>Object obj;
>>
>>obj = k+m+j;
>>
>>What object type is obj?
>>
>>Paul Franz
>>
>>
>>-------------------------------------------------------
>>SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>>    
>>
>
>  
>
>>from IBM. Find simple to follow Roadmaps, straightforward articles,
>>informative Webcasts and more! Get everything you need to get up to
>>speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
>>_______________________________________________
>>Beanshell-users mailing list [hidden email]
>>https://lists.sourceforge.net/lists/listinfo/beanshell-users
>>
>>    
>>
>
>
>
>-------------------------------------------------------
>SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>from IBM. Find simple to follow Roadmaps, straightforward articles,
>informative Webcasts and more! Get everything you need to get up to
>speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
>_______________________________________________
>Beanshell-users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
>  
>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

Martin C. Martin-4
In reply to this post by Paul Franz


Paul Franz wrote:
> And anybody who has done ANY profiling at all realizes that constant
> addy strings is a bad thing. It creates WAY too many objects. That is
> why StringBuffer as a String accumulator is a great thing.

If you could overload operators, you could add a "+" to string buffer,
and get both easy-to-understand syntax with runtime efficiency.

Like most programming tools, operator overload can be overused and
abused by those unaware of it's pitfalls.  But when used judiciously, it
can really help.

>
> Paul Franz
>
> Furash Gary wrote:
>
>> Strings kind of work this way, don't they?
>> String x = "hat"; String y = "cat"
>> String z = x + y ---> "hatcat"
>>
>> -----Original Message-----
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of
>> Stevenson, Scott W
>> Sent: Thursday, June 23, 2005 8:54 AM
>> To: Paul Franz
>> Cc: [hidden email]; George M. Coles; [hidden email]
>> Subject: RE: [Beanshell-users] pluggable syntax, ikvm
>>
>>
>> Hi Paul,
>>
>> I agree with you that it can cause confusion and should be avoided when
>> developing enterprise level applications.  But scripting languages are a
>> different story.  The main reason for using a high level scripting
>> lanuage is for simplicity, brievity, and portablity.  Scripting
>> languages should allow us to a task in a clear expressive way with fewer
>> lines of code.  Operator overloading is also VERY useful for
>> engineering, mathematical, and scientific applications, in which I am
>> currently envolved.
>> Which of these is easier to write and to read:
>>
>> // Multiply  column0*column2, column1*column3, and put results back in
>> columns 5 and 6 array2d[ [5,6] ] = array2d[0,1]*array2d[2,3]
>>
>> // Java
>> c0 = array2d.getColumn(0);
>> c2 = array2d.getColumn(2);
>> c5 = c0.times(c2);
>> c1 = array2d.getColumn(1);
>> c3 = array2d.getColumn(3);
>> c6 = c1.times(c3);
>> array2d.putAt(5,c5);
>> array2d.putAt(6,c6);
>>
>>
>>
>>
>> -----Original Message-----
>> From: Paul Franz [mailto:[hidden email]] Sent: Thursday, June
>> 23, 2005 10:21 AM
>> To: Stevenson, Scott W
>> Cc: [hidden email]; George M. Coles; [hidden email]
>> Subject: Re: [Beanshell-users] pluggable syntax, ikvm
>>
>>
>> Stevenson, Scott W wrote:
>>
>>> What about adding operator overloading to BeanShell?
>>>
>>
>>
>> And I remember the feature from C++. I hated it as developer. It
>> caused alot of grief. Especially, order predence and operators
>> overrides and return types.
>>
>> How do you handle:
>>
>> Integer j = 0;
>> MyClass k;
>> AnotherClass m;
>> Object obj;
>>
>> obj = k+m+j;
>>
>> What object type is obj?
>>
>> Paul Franz
>>
>>
>> -------------------------------------------------------
>> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>> from IBM. Find simple to follow Roadmaps, straightforward articles,
>> informative Webcasts and more! Get everything you need to get up to
>> speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
>> _______________________________________________
>> Beanshell-users mailing list [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

Paul Franz
In reply to this post by Furash Gary
I guess the one thing that I am trying to point out is that operator
overloads look nice but they hide the problem with creating alot of
intermediate objects.

Paul Franz

Furash Gary wrote:

> I knew that ;-)  I was just trying to make an analogy with operator
> overloading.
>
> g
>
> -----Original Message-----
> From: Paul Franz [mailto:[hidden email]]
> Sent: Thursday, June 23, 2005 10:21 AM
> To: Furash Gary
> Cc: Stevenson, Scott W; [hidden email]; George M. Coles;
> [hidden email]
> Subject: Re: [Beanshell-users] pluggable syntax, ikvm
>
>
> And anybody who has done ANY profiling at all realizes that constant
> addy strings is a bad thing. It creates WAY too many objects. That is
> why StringBuffer as a String accumulator is a great thing.
>
> Paul Franz
>
> Furash Gary wrote:
>
>>Strings kind of work this way, don't they?
>>
>>String x = "hat"; String y = "cat"
>>String z = x + y ---> "hatcat"
>>
>>-----Original Message-----
>>From: [hidden email]
>>[mailto:[hidden email]] On Behalf Of
>>Stevenson, Scott W
>>Sent: Thursday, June 23, 2005 8:54 AM
>>To: Paul Franz
>>Cc: [hidden email]; George M. Coles;
>>[hidden email]
>>Subject: RE: [Beanshell-users] pluggable syntax, ikvm
>>
>>
>>Hi Paul,
>>
>>I agree with you that it can cause confusion and should be avoided
>>when developing enterprise level applications.  But scripting
>>languages are a different story.  The main reason for using a high
>>level scripting lanuage is for simplicity, brievity, and portablity.  
>>Scripting languages should allow us to a task in a clear expressive
>>way with fewer lines of code.  Operator overloading is also VERY
>>useful for engineering, mathematical, and scientific applications, in
>>which I am currently envolved.
>>
>>Which of these is easier to write and to read:
>>
>>// Multiply  column0*column2, column1*column3, and put results back in
>
>
>>columns 5 and 6 array2d[ [5,6] ] = array2d[0,1]*array2d[2,3]
>>
>>// Java
>>c0 = array2d.getColumn(0);
>>c2 = array2d.getColumn(2);
>>c5 = c0.times(c2);
>>c1 = array2d.getColumn(1);
>>c3 = array2d.getColumn(3);
>>c6 = c1.times(c3);
>>array2d.putAt(5,c5);
>>array2d.putAt(6,c6);
>>
>>
>>
>>
>>-----Original Message-----
>>From: Paul Franz [mailto:[hidden email]]
>>Sent: Thursday, June 23, 2005 10:21 AM
>>To: Stevenson, Scott W
>>Cc: [hidden email]; George M. Coles;
>
> [hidden email]
>
>>Subject: Re: [Beanshell-users] pluggable syntax, ikvm
>>
>>
>>Stevenson, Scott W wrote:
>>
>>
>>>What about adding operator overloading to BeanShell?
>>>
>>
>>
>>And I remember the feature from C++. I hated it as developer. It
>>caused
>>alot of grief. Especially, order predence and operators overrides and
>>return types.
>>
>>How do you handle:
>>
>>Integer j = 0;
>>MyClass k;
>>AnotherClass m;
>>Object obj;
>>
>>obj = k+m+j;
>>
>>What object type is obj?
>>
>>Paul Franz
>>
>>
>>-------------------------------------------------------
>>SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>
>
>>from IBM. Find simple to follow Roadmaps, straightforward articles,
>>informative Webcasts and more! Get everything you need to get up to
>>speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
>>_______________________________________________
>>Beanshell-users mailing list [hidden email]
>>https://lists.sourceforge.net/lists/listinfo/beanshell-users
>>
>
>
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

Paul Franz
In reply to this post by Martin C. Martin-4
But what would it return. Currently, the StringBuffer returns nothing
because it is an accumularor.

Paul Franz

Martin C. Martin wrote:

>
>
> Paul Franz wrote:
>
>> And anybody who has done ANY profiling at all realizes that constant
>> addy strings is a bad thing. It creates WAY too many objects. That is
>> why StringBuffer as a String accumulator is a great thing.
>
>
> If you could overload operators, you could add a "+" to string buffer,
> and get both easy-to-understand syntax with runtime efficiency.
>
> Like most programming tools, operator overload can be overused and
> abused by those unaware of it's pitfalls.  But when used judiciously, it
> can really help.
>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: pluggable syntax, ikvm

Furash Gary
In reply to this post by gcoles
Well, you could magically put it back into a string /bsh.primative.
Hmmm...  Not so sure about this anymore.

-----Original Message-----
From: Paul Franz [mailto:[hidden email]]
Sent: Thursday, June 23, 2005 10:39 AM
To: Martin C. Martin
Cc: Furash Gary; Stevenson, Scott W; [hidden email]; George M. Coles;
[hidden email]
Subject: Re: [Beanshell-users] pluggable syntax, ikvm


But what would it return. Currently, the StringBuffer returns nothing
because it is an accumularor.

Paul Franz

Martin C. Martin wrote:
>
>
> Paul Franz wrote:
>
>> And anybody who has done ANY profiling at all realizes that constant
>> addy strings is a bad thing. It creates WAY too many objects. That is

>> why StringBuffer as a String accumulator is a great thing.
>
>
> If you could overload operators, you could add a "+" to string buffer,
> and get both easy-to-understand syntax with runtime efficiency.
>
> Like most programming tools, operator overload can be overused and
> abused by those unaware of it's pitfalls.  But when used judiciously,
it
> can really help.
>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: pluggable syntax, ikvm

Martin C. Martin-4
In reply to this post by Paul Franz
It could return itself:

StringBuffer plus(StringBuffer sb, String s)
{
    sb.append(s);
    return this;
}


But in reading the Java docs on StringBuffer, I found:

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html

'String buffers are used by the compiler to implement the binary string
concatenation operator +. For example, the code:

      x = "a" + 4 + "c"


'is compiled to the equivalent of:

      x = new StringBuffer().append("a").append(4).append("c")
                            .toString()'

So it looks like the Java compiler is doing almost exactly this anyway.

- Martin

Paul Franz wrote:

> But what would it return. Currently, the StringBuffer returns nothing
> because it is an accumularor.
>
> Paul Franz
>
> Martin C. Martin wrote:
>
>>
>>
>> Paul Franz wrote:
>>
>>> And anybody who has done ANY profiling at all realizes that constant
>>> addy strings is a bad thing. It creates WAY too many objects. That is
>>> why StringBuffer as a String accumulator is a great thing.
>>
>>
>>
>> If you could overload operators, you could add a "+" to string buffer,
>> and get both easy-to-understand syntax with runtime efficiency.
>>
>> Like most programming tools, operator overload can be overused and
>> abused by those unaware of it's pitfalls.  But when used judiciously,
>> it can really help.
>>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
12