Bug 443698 - Add a "Let" model operation so one can define variables
Summary: Add a "Let" model operation so one can define variables
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 1.0.0   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 5.0.0   Edit
Assignee: Stephane Begaudeau CLA
QA Contact: Laurent Fasani CLA
URL:
Whiteboard:
Keywords: noteworthy, triaged
Depends on:
Blocks:
 
Reported: 2014-09-10 09:20 EDT by Stéphane Thibaudeau CLA
Modified: 2017-12-26 11:30 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Thibaudeau CLA 2014-09-10 09:20:11 EDT
It would be useful to have a "Let" model operation.
This model operation would allow one to define custom variables.

I know we can define custom variables below predefined variables but there are 2 main problems with this approach :
- one has to define every variables as a first step
- this is not possible in certain places (inside a quick fix for example)
Comment 1 Eclipse Genie CLA 2017-02-22 05:31:50 EST
New Gerrit change created: https://git.eclipse.org/r/91605
Comment 3 Pierre-Charles David CLA 2017-03-13 04:45:34 EDT
Most of the basic behavior is done, but there may be some adjustments needed (see the comment patch set 6 (https://git.eclipse.org/r/#/c/91605/6), and we'll need to add proper documentation. Moving to M7 for these remaining tasks.
Comment 4 Eclipse Genie CLA 2017-03-25 08:50:48 EDT
New Gerrit change created: https://git.eclipse.org/r/93850
Comment 5 Pierre-Charles David CLA 2017-03-27 08:54:43 EDT
It seems the completion-related code is buggy/not precise enough. In a simple case of:

  Let newName = aql:self.askForName('default')
    Set name to var:newN<cursor>

where askForName is a service which returns a String, the completion finds the newName variable, but its infered type (as visible on the tooltip) is: [ecore.EString,traceability.path,scxml.CondLangDatatype,scxml.DurationDatatype,scxml.EventTypeDatatype,scxml.EventTypesDatatype,scxml.LocLangDatatype,scxml.URIDatatype,scxml.ValueLangDatatype,description.TypeName,description.InterpretedExpression,description.FeatureName,description.ImagePath,description.TranslatableMessage,type.AnyURI,type.ENTITY,type.ID,type.IDREF,type.Language,type.Name,type.NCName,type.NMTOKEN,type.NormalizedString,type.String,type.Token,types.String,namespace.LangType,namespace.LangTypeNull]
Comment 6 Pierre-Charles David CLA 2017-03-27 09:06:47 EDT
(In reply to Pierre-Charles David from comment #5)
> It seems the completion-related code is buggy/not precise enough. In a
> simple case of:
> 
>   Let newName = aql:self.askForName('default')
>     Set name to var:newN<cursor>
> 
> where askForName is a service which returns a String, the completion finds
> the newName variable, but its infered type (as visible on the tooltip) is:
> [ecore.EString,traceability.path,scxml.CondLangDatatype,scxml.
> DurationDatatype,scxml.EventTypeDatatype,scxml.EventTypesDatatype,scxml.
> LocLangDatatype,scxml.URIDatatype,scxml.ValueLangDatatype,description.
> TypeName,description.InterpretedExpression,description.FeatureName,
> description.ImagePath,description.TranslatableMessage,type.AnyURI,type.
> ENTITY,type.ID,type.IDREF,type.Language,type.Name,type.NCName,type.NMTOKEN,
> type.NormalizedString,type.String,type.Token,types.String,namespace.LangType,
> namespace.LangTypeNull]

Actually, the problem does not seem related to "Let" at all. Forget about the previous comment.
Comment 7 Eclipse Genie CLA 2017-03-31 09:09:21 EDT
New Gerrit change created: https://git.eclipse.org/r/94218
Comment 10 Pierre-Charles David CLA 2017-05-12 03:32:01 EDT
Still left to do: add specifier documentation (and release notes).
Comment 11 Pierre-Charles David CLA 2017-05-21 10:57:05 EDT
Marking as resolved so that the actual behavior can be validated. I've added a "needdoc" tag to remember that this needs to be documented before the release.
Comment 12 Laurent Fasani CLA 2017-05-22 10:22:04 EDT
Validated (runtime+completion) on ODCE_20170521
Comment 13 Pierre-Charles David CLA 2017-06-29 03:31:59 EDT
Available in Sirius 5.0.0, see https://wiki.eclipse.org/Sirius/5.0.0 for details.