Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2t-dev] [backend] About Functions

Hi Arno,

I'm wondering how what we should create in the model for some use cases, in 
Acceleo for instance, a.name will lookup in this priority order: 

1 - a Java service called "name" on the given type
if not found
2 - a script called "name" on the given type
if not found
3 - a feature of the model

It's really usefull when you want to redefine for instance just using one 
script/java method how every name is transformed to get something 
syntaxically correct for your target langage.

What functions/expressions should we create in the backend for such cases ?

Cédric


Le Saturday 05 April 2008 16:51:53 Arno Haase, vous avez écrit :
> Laurent,
>
> if you have something like
>
>     a.name
>
> you want that to refer to a property "name" or a function "getName()"
> (or "setName", depending on the context), right? In other words, would
> you be happy if it was possible to create properties by defining getter
> and/or setter functions?
>
> - Arno
>
> Laurent Goubet schrieb:
> > Hi all,
> >
> > I was looking at the backend and how expressions and operations were
> > handled and was wondering if some functionalities were accessible.
> >
> > I am currently trying to instantiate all of the backend expressions and
> > stumbled upon a use case I can't see a way to solve nicely : let's say
> > the input language is ambiguous on function calls and allows with the
> > same sintax to call either a function, or a declared field of the
> > receiver object  (I'm calling "receiver" the object on which the
> > function is called, your "first parameter"), how can I convert this to a
> > backend expression (see xpand example below)?
> >
> > I tried an InvocationOnWhateverExpression, to no avail. And since
> > InvocationOnWhateverExpression is declared final, I cannot subclass it
> > to alter the way it behaves when a function of the given name cannot be
> > retrieved before it simply throws an ExecutionException.
> >
> > An example of what I am trying to convert for the backend could look
> > like (in xpand, "name" refers to the name of the NamedElement, not to a
> > random function) :
> > DEFINE function FOR uml.NamedElement
> >    «name»
> >
> > Thanks in advance.
> > Laurent Goubet
> > Obeo
> >
> > PS : As a side note, do you ever visit an IRC chan? I'm idling on
> > #eclipse and #eclipse-modeling, these discussion might be easier on a
> > chat.
> >
> > _______________________________________________
> > m2t-dev mailing list
> > m2t-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/m2t-dev




Back to the top