RE: Support for operator overloading

"Yemi D. Bedu" <yemi-DnQzskBZRmpWk0Htik3J/[email protected]> Mon, 28 Nov 2005 13:14:50 -0500
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
Hello,
Would you like the over loading to be scoped? What about allowing you to
alias a syntax symbol to a method call. Something like (each pair
exclusive syntax form):

// array1 + array2
Alias infix + MyArray.combine(#1, #2);
Alias : mapin #1 + #2 : mapout MyArray.combine(#1, #2);

// % s1 s2 s3
Alias postfix : start % : count 3
StringBuffer.append(#1).append(#2).append(#3);
Alias : mapin % #1 #2 #3 : mapout
StringBuffer.append(#1).append(#2).append(#3);

// MyArray[key1]
Alias wrap : start [ : end ] : inner 1 #1.getValue(#2);
Alias : mapin #1[#2] : mapout #1.getValue(#2);

// MyArray[key1]= value1
Alias wrap : start [ : end ]= : inner 1 : outer 1 MyArray.setValue(#1,
#2);
Alias : mapin #1[#2]= #3 : mapout #1.setValue(#2, #3);

Should the alias only take affect if the objects match the signature and
arguement type? Is it time that we move towards having a clean and
simple macro system? Those who would want more sugar can have it at any
time. And if some syntax is a fad, it just won't be adopted by the
community.

Yemi Bedu

P&R Fasteners
325 Pierce St
Somerset, NJ 08873
732-302-3600

-----Original Message-----
From: beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:beanshell-developers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of
Joao Victor
Sent: Sunday, November 27, 2005 11:12 AM
To: beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [Beanshell-dev] Support for operator overloading

Hi all,

Does anybody know if there has been any work, or plan, to make Beanshell
support operator overloading?

Because i was thinking about adding that support (would be very useful
for this project i'm working on), but i don't want to reinvent the
wheel.

Cheers,
J.V.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files for problems?  Stop!  Download the new AJAX search engine that
makes searching your log files as easy as surfing the  web.  DOWNLOAD
SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
_______________________________________________
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: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click