Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Why no Operations on EEnums?
Why no Operations on EEnums? [message #415694] Sun, 30 December 2007 02:51 Go to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
I've been wondering why the .ecore editor does not allow to add an
operation to an EEnum. I would guess that the meta-model does not
provide for it, but I don't understand why; after all, Java enums can
have methods...

Eric
Re: Why no Operations on EEnums? [message #415696 is a reply to message #415694] Sun, 30 December 2007 12:11 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Eric,

Enums in the metamodels existed long before they did in Java. It's
certainly possible to consider adding them to EEnum but next we'd get
into issues of EEnums could implement interfaces and hence are sort of
more like EClasses (but of course enums can't extend classes or other
enums); the complexity would quickly grow to accommodate all that. If
we had better support for specifying the behavior of EOperations, it
would become more interesting. On that front, I've really wanted to be
able to come up with some type of mechanism whereby behavioral
extensions could register themselves and operation behaviors could be
specified via annotations on the operation (sort of like the body
annotation allows a snip of Java code to be specified, but more dynamic
so it would actually work for dynamic models rather than only for
generated models).


Eric Rizzo wrote:
> I've been wondering why the .ecore editor does not allow to add an
> operation to an EEnum. I would guess that the meta-model does not
> provide for it, but I don't understand why; after all, Java enums can
> have methods...
>
> Eric


Ed Merks
Professional Support: https://www.macromodeling.com/
registration of behavorial extensions and operation behavior annotations. [message #415739 is a reply to message #415696] Fri, 04 January 2008 16:24 Go to previous messageGo to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Hi, Ed.
Is there a feature request for this, for which we can vote, or shall I
open one?

Regards, Philipp

Ed Merks wrote:
> Eric,
>
> Enums in the metamodels existed long before they did in Java. It's
> certainly possible to consider adding them to EEnum but next we'd get
> into issues of EEnums could implement interfaces and hence are sort of
> more like EClasses (but of course enums can't extend classes or other
> enums); the complexity would quickly grow to accommodate all that. If
> we had better support for specifying the behavior of EOperations, it
> would become more interesting. On that front, I've really wanted to be
> able to come up with some type of mechanism whereby behavioral
> extensions could register themselves and operation behaviors could be
> specified via annotations on the operation (sort of like the body
> annotation allows a snip of Java code to be specified, but more dynamic
> so it would actually work for dynamic models rather than only for
> generated models).
>
>
> Eric Rizzo wrote:
>> I've been wondering why the .ecore editor does not allow to add an
>> operation to an EEnum. I would guess that the meta-model does not
>> provide for it, but I don't understand why; after all, Java enums can
>> have methods...
>>
>> Eric
Re: Why no Operations on EEnums? [message #415743 is a reply to message #415696] Fri, 04 January 2008 17:59 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Ed Merks wrote:
> Eric,
>
> Enums in the metamodels existed long before they did in Java. It's
> certainly possible to consider adding them to EEnum but next we'd get
> into issues of EEnums could implement interfaces and hence are sort of
> more like EClasses (but of course enums can't extend classes or other
> enums); the complexity would quickly grow to accommodate all that.

I don't see why you would necessarily have to open the "EENums
implemeting interfaces" can of worms. As I see it, allowing EOperations
on EEnums would be a lot simpler both conceptually and from an
implementation standpoint, but adding that capability does not
*necessarily* lead to having to support interfaces. Interfaces would be
a logical next step, but not required just to allow EOperations.

Eric


>
> Eric Rizzo wrote:
>> I've been wondering why the .ecore editor does not allow to add an
>> operation to an EEnum. I would guess that the meta-model does not
>> provide for it, but I don't understand why; after all, Java enums can
>> have methods...
>>
>> Eric
Re: Why no Operations on EEnums? [message #415745 is a reply to message #415743] Fri, 04 January 2008 19:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Guys,

This just doesn't strike me as one of life's big priorities. Next
you'll want a different implementation of the operation for each
literal! Worms get out through very small holes after all! :-P


Eric Rizzo wrote:
> Ed Merks wrote:
>> Eric,
>>
>> Enums in the metamodels existed long before they did in Java. It's
>> certainly possible to consider adding them to EEnum but next we'd get
>> into issues of EEnums could implement interfaces and hence are sort
>> of more like EClasses (but of course enums can't extend classes or
>> other enums); the complexity would quickly grow to accommodate all that.
>
> I don't see why you would necessarily have to open the "EENums
> implemeting interfaces" can of worms. As I see it, allowing
> EOperations on EEnums would be a lot simpler both conceptually and
> from an implementation standpoint, but adding that capability does not
> *necessarily* lead to having to support interfaces. Interfaces would
> be a logical next step, but not required just to allow EOperations.
>
> Eric
>
>
>>
>> Eric Rizzo wrote:
>>> I've been wondering why the .ecore editor does not allow to add an
>>> operation to an EEnum. I would guess that the meta-model does not
>>> provide for it, but I don't understand why; after all, Java enums
>>> can have methods...
>>>
>>> Eric


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Why no Operations on EEnums? [message #415802 is a reply to message #415745] Mon, 07 January 2008 16:01 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Ed Merks wrote:
> Guys,
>
> This just doesn't strike me as one of life's big priorities. Next
> you'll want a different implementation of the operation for each
> literal! Worms get out through very small holes after all! :-P

One could argue that you needn't be concerned with what "we" will want
next, just with what "we" ask for now. ;-)
I guess I can't argue with your choice of priorities. I just see this as
a pretty obvious gap in the ECore meta-model that I think would be easy
to fill.
On a general note, if we want MDD using EMF to be increasingly adopted I
would think we'd want to minimize the places where one has to drop to
injected hand-written code in order to model a system. This represents
one of those situations, where the ECore model does not support a common
construct.
I'll probably enter an enhancement request for posterity; if I had time
I'd familiarize myself with ECore and EMF internals and try to provide a
patch, but unfortunately I'm buried for the next few months. :-(

Eric



> Eric Rizzo wrote:
>> Ed Merks wrote:
>>> Eric,
>>>
>>> Enums in the metamodels existed long before they did in Java. It's
>>> certainly possible to consider adding them to EEnum but next we'd get
>>> into issues of EEnums could implement interfaces and hence are sort
>>> of more like EClasses (but of course enums can't extend classes or
>>> other enums); the complexity would quickly grow to accommodate all that.
>>
>> I don't see why you would necessarily have to open the "EENums
>> implemeting interfaces" can of worms. As I see it, allowing
>> EOperations on EEnums would be a lot simpler both conceptually and
>> from an implementation standpoint, but adding that capability does not
>> *necessarily* lead to having to support interfaces. Interfaces would
>> be a logical next step, but not required just to allow EOperations.
>>
>> Eric
>>
>>
>>>
>>> Eric Rizzo wrote:
>>>> I've been wondering why the .ecore editor does not allow to add an
>>>> operation to an EEnum. I would guess that the meta-model does not
>>>> provide for it, but I don't understand why; after all, Java enums
>>>> can have methods...
>>>>
>>>> Eric
Previous Topic:Getting Ecore based editors refreshed after TransactionalEditingDomain RecordingCommand
Next Topic:Dynamic Templates in standalone code generation
Goto Forum:
  


Current Time: Tue Apr 16 12:23:12 GMT 2024

Powered by FUDForum. Page generated in 0.92167 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top