Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compact syntax for binary pattern reuse #13

Open
eclipse-viatra-bot opened this issue Mar 11, 2024 · 9 comments
Open

Compact syntax for binary pattern reuse #13

eclipse-viatra-bot opened this issue Mar 11, 2024 · 9 comments
Labels
bugzilla Issues migrated from Eclipse bugzilla. Query Issues related to the query component of VIATRA, including runtime or pattern language issues.
Milestone

Comments

@eclipse-viatra-bot
Copy link

| --- | --- |
| Bugzilla Link | 424612 |
| Status | NEW |
| Importance | P3 enhancement |
| Reported | Dec 23, 2013 09:00 EDT |
| Modified | May 27, 2019 07:45 EDT |
| Version | oldinquery |
| Reporter | Eric Lépicier |

Description

The only way to re-use a pattern is the “find” syntax.
When patterns have two parameters, they could be considered as a pseudo query-based feature.
It would then be great to be able to use them like features.
An example:
With:
pattern students(Sch, S) {
School.courses.schoolClass.students(Sch,S);
}
The pattern:
pattern schoolStudentsName(Sch, SName) {
find students(Sch, S);
Student.name(S, SName);
}
Could be written:
pattern schoolStudentsName(Sch, SName) {
School.students.name(Sch, SName);
}

This syntax would be more compact and allows dot notation cascading.
A special character may be added (like _ for expliciting unused variables, or ^ escape character for keywords) to make it explicitly a sub-pattern call whenever it would be ambiguous with a real feature.

@eclipse-viatra-bot eclipse-viatra-bot added bugzilla Issues migrated from Eclipse bugzilla. legacy Query Issues related to the query component of VIATRA, including runtime or pattern language issues. labels Mar 11, 2024
@eclipse-viatra-bot
Copy link
Author

By Gabor Bergmann on Jan 03, 2014 04:31

+1

As for the escape syntax brainstorm: I have some reservations about adding more special characters for the user to learn. One solution for escaping without special characters:

School.(find students).name(Sch, SName)

It reuses the existing keyword for pattern composition. But this is not completely satisfying either, as it is only half as concise as the special character based approach. Any better ideas?

Fortunately, such escaping should not be required in most cases.

@eclipse-viatra-bot
Copy link
Author

By Eric Lépicier on Jan 03, 2014 07:17

(In reply to Gabor Bergmann from comment #1)

+1

As for the escape syntax brainstorm: I have some reservations about adding
more special characters for the user to learn.

Well, I easily learnt the ^ and _ usage with the really clear warnings ...

One solution for escaping
without special characters:

School.(find students).name(Sch, SName)

It reuses the existing keyword for pattern composition. But this is not
completely satisfying either, as it is only half as concise as the special
character based approach.

I can't say I like this syntax ... The idea was to have it looking identical to a real feature in most cases.

Any better ideas?

An escape character, suggested by a good warning ? ;-)\

Fortunately, such escaping should not be required in most cases.

Sure.
Another solution would be to mark an ambiguity as an error, thus not allowing this syntax in case there is a real feature.

In fact, this kind of syntax is common in Acceleo. One can write queries which can be called like a method on their first parameter.
[query say(c : Class, p : String) : String = p /]
[aClass.say('hello')/]
I don't know how Acceleo complains if Class has already a 'say' feature ... I'll verify and keep you informed.

@eclipse-viatra-bot
Copy link
Author

By Eric Lépicier on Jan 06, 2014 12:45

(In reply to Eric Lépicier from comment #2)

In fact, this kind of syntax is common in Acceleo. One can write queries
which can be called like a method on their first parameter.
[query say(c : Class, p : String) : String = p /]
[aClass.say('hello')/]
I don't know how Acceleo complains if Class has already a 'say' feature ...
I'll verify and keep you informed.

Well, Acceleo gives the priority to the model feature operation, it seems it ignores the overriding user query without warning ...

@eclipse-viatra-bot
Copy link
Author

By Istvan Rath on Apr 08, 2014 18:02

Moving this feature to post-0.8.

@eclipse-viatra-bot
Copy link
Author

By Istvan Rath on Apr 24, 2014 04:30

I'm expecting this to be addressed for 0.9.

@eclipse-viatra-bot
Copy link
Author

By Abel Hegedus on Apr 19, 2016 05:25

Updating to correct milestone.

@eclipse-viatra-bot
Copy link
Author

By Zoltan Ujhelyi on Oct 04, 2017 05:26

Moving potential tasks from future to 2.0.

@eclipse-viatra-bot
Copy link
Author

By Zoltan Ujhelyi on Feb 08, 2018 07:21

Postponing to a future release.

@eclipse-viatra-bot
Copy link
Author

By Zoltan Ujhelyi on May 27, 2019 07:45

Postponing tickets to FUTURE until effort is allocated to fix them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from Eclipse bugzilla. Query Issues related to the query component of VIATRA, including runtime or pattern language issues.
Projects
None yet
Development

No branches or pull requests

2 participants