History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GROOVY-1077
Type: New Feature New Feature
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Rui Lopes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

operator overloading

Created: 30/Sep/05 06:01 AM   Updated: 26/Apr/08 08:01 AM
Component/s: syntax
Affects Version/s: 1.0
Fix Version/s: 2.0

Time Tracking:
Not Specified


 Description  « Hide
To keepup with next generation programming languages (such as C# 3.0), groovy would benefit from the ability to specify new operators (aka operator overloading, like C++'s "operator" keyword).

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Guillaume Laforge - 15/Nov/05 08:35 AM
Rui,

You mean having a nice syntax for operator overloading? like:

operator Foo + (Foo foo)

Or you mean also being able to add new and funny operators like <=#=> or or whatever comes to mind?


Rui Lopes - 15/Nov/05 08:51 AM
Any kind of operator syntax would be better, but harder to implement, imho. Specially regarding name-style operators, like "instanceof", e.g.:

operator Foo handles (Foo foo)

and using it would something like

"a handles foo"

Rui


Guillaume Laforge - 15/Nov/05 09:08 AM
We'll provide a syntax for operator overloading.
But I don't think we'll be able to create custom operators, either with special characters or name-style operators.
At least not for 1.0 or 1.x...

But I think it might be interesting considering that for Groovy 2.0
And that'd be pretty neat to write custom DSLs!
I'd love to support that!


Rui Lopes - 15/Nov/05 09:18 AM
yes, definitely for 2.0, hence the priority level "Minor"

I think the sql-ish syntax sugar introduced in C# regarding working with collections would be a starting point for name-style operator overloading.