Generics Java Language Feature in BeanShell

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

Generics Java Language Feature in BeanShell

yccheok
Hello all,

I had did some testing on BeanShell. It seems that it
doesn't support Java Generics Language feature at
current moment. Am I right? Is there any plan to
support this feature in future release?

Thanks!

cheok



 
____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Generics Java Language Feature in BeanShell

Paul Franz
You are correct. My assumption is that it would be in BeanShell 3.0
though I am not sure when it will be available.

Cheok Yan Cheng wrote:

> Hello all,
>
> I had did some testing on BeanShell. It seems that it
> doesn't support Java Generics Language feature at
> current moment. Am I right? Is there any plan to
> support this feature in future release?
>
> Thanks!
>
> cheok
>
>
>
>  
> ____________________________________________________________________________________
> Need Mail bonding?
> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
> http://answers.yahoo.com/dir/?link=list&sid=396546091
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
>  

--

-------------------------------------------

There are seven sins in the world.
     Wealth without work.
     Pleasure without conscience.
     Knowledge without character.
     Commerce without morality.
     Science without humanity.
     Worship without sacrifice.
     Politics without principle.

   -- Mohandas Gandhi

-------------------------------------------


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Generics Java Language Feature in BeanShell

Daniel Martin-7
In reply to this post by yccheok
Cheok Yan Cheng <[hidden email]> writes:

> I had did some testing on BeanShell. It seems that it
> doesn't support Java Generics Language feature at
> current moment. Am I right? Is there any plan to
> support this feature in future release?

What would it mean if beanshell did support Generics?

Note that since variables in Beanshell are not statically typed, and
since BeanShell is not compiled, the benefit of Java Generics is
limited at best.  The main benefit of Java Generics is to make
compile-time type guarantees about parameterized types, which also
allows you to avoid lots of casting when you know what type the
resulting object will be.

In beanshell, you never needed to do that casting in the first place.

I can't see what generic support would mean to beanshell - if you have
some code that uses Java Generics, the way to convert it to beanshell
so far as I can see is to strip everything inside angle brackets.

The only way to support generics that I can imagine making sense in
beanshell is to modify the parser so that it rips out the generic type
parameter bits.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Generics Java Language Feature in BeanShell

David Lee
Excellent commentary.
I think this hinges on a great feature, as well as a problem with beanshell.
That is BeanShell has 2 design philosophies which are sometimes in conflict.

1) Scripting language
Beanshell is a scripting language, and in that way it diverges from java in
all the wonderful ways scripting languages intend (like loose typing)

2) Conformance to java
Beanshell is intended to allow strict conformance to java, in fact its got a
"mode" for it.  The purpose is for interactive and easy use to learn java,
ideally to be able to parse any valid java.   This implementation is not
perfect, but it is a stated design goal.


What is the "right" decision when these two goals are in conflict ?



----- Original Message -----
From: "Daniel Martin" <[hidden email]>
To: "Cheok Yan Cheng" <[hidden email]>
Cc: <[hidden email]>
Sent: Wednesday, May 09, 2007 10:40 AM
Subject: Re: [Beanshell-users] Generics Java Language Feature in BeanShell


> Cheok Yan Cheng <[hidden email]> writes:
>
>> I had did some testing on BeanShell. It seems that it
>> doesn't support Java Generics Language feature at
>> current moment. Am I right? Is there any plan to
>> support this feature in future release?
>
> What would it mean if beanshell did support Generics?
>
> Note that since variables in Beanshell are not statically typed, and
> since BeanShell is not compiled, the benefit of Java Generics is
> limited at best.  The main benefit of Java Generics is to make
> compile-time type guarantees about parameterized types, which also
> allows you to avoid lots of casting when you know what type the
> resulting object will be.
>
> In beanshell, you never needed to do that casting in the first place.
>
> I can't see what generic support would mean to beanshell - if you have
> some code that uses Java Generics, the way to convert it to beanshell
> so far as I can see is to strip everything inside angle brackets.
>
> The only way to support generics that I can imagine making sense in
> beanshell is to modify the parser so that it rips out the generic type
> parameter bits.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Generics Java Language Feature in BeanShell

Borislav Iordanov
BeanShell enforces type safety when the programmer actually specifies the
types. If you have:

f(int a) { print(a); }

then f("adfasdf") yields an exception:

javax.script.ScriptException: Sourced file: inline evaluation of:
``f("asdfasd") ;'' : Command not found: f( java.lang.String ) : at Line: 1
: in file: inline evaluation of: ``f("asdfasd") ;'' : f ( "asdfasd" )

So for generics it would actually make more sense to do the opposite of
Java: enforce generics' semantics at runtime. This could be very useful
for strong typing maniacs, getting best of both worlds ;) Part of the
reason Java strips generics during compilation is backward compatibility,
I believe. And this is actually a problem with generics and you get all
those annoying "unchecked conversion" warnings.

Or have the two strategies be configurable....

Best,
Boris

> Excellent commentary.
> I think this hinges on a great feature, as well as a problem with
> beanshell.
> That is BeanShell has 2 design philosophies which are sometimes in
> conflict.
>
> 1) Scripting language
> Beanshell is a scripting language, and in that way it diverges from java
> in
> all the wonderful ways scripting languages intend (like loose typing)
>
> 2) Conformance to java
> Beanshell is intended to allow strict conformance to java, in fact its got
> a
> "mode" for it.  The purpose is for interactive and easy use to learn java,
> ideally to be able to parse any valid java.   This implementation is not
> perfect, but it is a stated design goal.
>
>
> What is the "right" decision when these two goals are in conflict ?
>
>
>
> ----- Original Message -----
> From: "Daniel Martin" <[hidden email]>
> To: "Cheok Yan Cheng" <[hidden email]>
> Cc: <[hidden email]>
> Sent: Wednesday, May 09, 2007 10:40 AM
> Subject: Re: [Beanshell-users] Generics Java Language Feature in BeanShell
>
>
>> Cheok Yan Cheng <[hidden email]> writes:
>>
>>> I had did some testing on BeanShell. It seems that it
>>> doesn't support Java Generics Language feature at
>>> current moment. Am I right? Is there any plan to
>>> support this feature in future release?
>>
>> What would it mean if beanshell did support Generics?
>>
>> Note that since variables in Beanshell are not statically typed, and
>> since BeanShell is not compiled, the benefit of Java Generics is
>> limited at best.  The main benefit of Java Generics is to make
>> compile-time type guarantees about parameterized types, which also
>> allows you to avoid lots of casting when you know what type the
>> resulting object will be.
>>
>> In beanshell, you never needed to do that casting in the first place.
>>
>> I can't see what generic support would mean to beanshell - if you have
>> some code that uses Java Generics, the way to convert it to beanshell
>> so far as I can see is to strip everything inside angle brackets.
>>
>> The only way to support generics that I can imagine making sense in
>> beanshell is to modify the parser so that it rips out the generic type
>> parameter bits.
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Beanshell-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Generics Java Language Feature in BeanShell

Mirko Nasato
In reply to this post by David Lee
I think Groovy went through the same discussion recently and they're
planning to add Generics in 1.1

  http://www.nabble.com/A-proposal-for-generic-in-Groovy-t3668167.html

could be interesting to see what their solution will be.

Best regards

Mirko

David A. Lee wrote:

> Excellent commentary.
> I think this hinges on a great feature, as well as a problem with beanshell.
> That is BeanShell has 2 design philosophies which are sometimes in conflict.
>
> 1) Scripting language
> Beanshell is a scripting language, and in that way it diverges from java in
> all the wonderful ways scripting languages intend (like loose typing)
>
> 2) Conformance to java
> Beanshell is intended to allow strict conformance to java, in fact its got a
> "mode" for it.  The purpose is for interactive and easy use to learn java,
> ideally to be able to parse any valid java.   This implementation is not
> perfect, but it is a stated design goal.
>
>
> What is the "right" decision when these two goals are in conflict ?
>
>
>
> ----- Original Message -----
> From: "Daniel Martin" <[hidden email]>
> To: "Cheok Yan Cheng" <[hidden email]>
> Cc: <[hidden email]>
> Sent: Wednesday, May 09, 2007 10:40 AM
> Subject: Re: [Beanshell-users] Generics Java Language Feature in BeanShell
>
>
>  
>> Cheok Yan Cheng <[hidden email]> writes:
>>
>>    
>>> I had did some testing on BeanShell. It seems that it
>>> doesn't support Java Generics Language feature at
>>> current moment. Am I right? Is there any plan to
>>> support this feature in future release?
>>>      
>> What would it mean if beanshell did support Generics?
>>
>> Note that since variables in Beanshell are not statically typed, and
>> since BeanShell is not compiled, the benefit of Java Generics is
>> limited at best.  The main benefit of Java Generics is to make
>> compile-time type guarantees about parameterized types, which also
>> allows you to avoid lots of casting when you know what type the
>> resulting object will be.
>>
>> In beanshell, you never needed to do that casting in the first place.
>>
>> I can't see what generic support would mean to beanshell - if you have
>> some code that uses Java Generics, the way to convert it to beanshell
>> so far as I can see is to strip everything inside angle brackets.
>>
>> The only way to support generics that I can imagine making sense in
>> beanshell is to modify the parser so that it rips out the generic type
>> parameter bits.
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Beanshell-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>>
>>    
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
>
>  


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users