Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » Ambigous Roles and SmartLifting(§2.3.4)
Ambigous Roles and SmartLifting [message #653679] Thu, 10 February 2011 12:01 Go to next message
Jan Marc Hoffmann is currently offline Jan Marc Hoffmann
Messages: 32
Registered: July 2009
Member
Hey guys!

I just thought I might redesign my code a bit and ran into some problems.

As you might know the TypeDeclaration in the OT-Core stands for Roles, Teams, and Classes. I thought about splitting the TypeDeclaration in separate nodes.

public team MyAST {
protected class MyTypeDeclaration playedBy TypeDeclaration {}
protected class MyTeamDeclaration extends MyTypeDeclaration {}
protected class MyClassDeclaration extends MyTypeDeclaration {}
protected class MyRoleDeclaration extends MyClassDeclaration {}
/* my special type */
protected class MyPerDeclaration extends MyClassDeclaration {}
}


The obvious problem is the ambiguity between MyRoleDeclaration and MyPerDeclaration. I will be able to handle the ambiguity with base guards, so during runtime there won't be any problems. But the OT compiler won't let me do that. How does the SmartLifting algorithm check candidates for Lifting? Will it evaluate baseguards?

Or is my design flawed?

thanks

greetings

Jan Marc

Re: Ambigous Roles and SmartLifting [message #654428 is a reply to message #653679] Tue, 15 February 2011 12:38 Go to previous message
Stephan Herrmann is currently offline Stephan Herrmann
Messages: 924
Registered: July 2009
Senior Member
Hi Jan Marc,

sorry for the delay ...

Jan Marc Hoffmann wrote on Thu, 10 February 2011 18:01

The obvious problem is the ambiguity between MyRoleDeclaration and MyPerDeclaration. I will be able to handle the ambiguity with base guards, so during runtime there won't be any problems. But the OT compiler won't let me do that.

What kind of message do you get? If it's just a warning regarding potential binding ambiguity (§2.3.4(a)) you should actually be fine with those guard predicates.

If you get an error I'd like to see what code triggers it.

Quote:

How does the SmartLifting algorithm check candidates for Lifting? Will it evaluate baseguards?


No, base guards are evaluated even before lifting. But once the guard has been passed lifting needs to be able to find the correct role type.

OTOH, if you want each base to be decorated with exactly one of your roles you'll be missing the cases like nested teams (it's a role and a team) etc.

One option might be to just give up the playedBy relation in MyTypeDeclaration and only let specific roles declare playedBy. That way roles will be independent and no ambiguity will arise.

what fits your case?
Stephan
Previous Topic:Milestone 5 Release and other activities
Next Topic:0.8.0 M7 and approaching Indigo final
Goto Forum:
  


Current Time: Sat Apr 19 11:47:55 EDT 2014

Powered by FUDForum. Page generated in 0.01850 seconds