gemoc / ale-lang

Action Language for EMF
Eclipse Public License 1.0
8 stars 6 forks source link

Do we really want to prevent opening multiple times the same class? #161

Open echebbi opened 4 years ago

echebbi commented 4 years ago

Context

Opening several times the same class results in an error:

image

However I don't understand the rational behind it. To solve the issue it seems that we have to use the extends keyword as follows:

open class StateMachine {

}

open class StateMachine extends StateMachine {

}

which doesn't make any sense to me.

I think we should allow it, but maybe add a marker on the ruler to warn about the class already being open & to provide quick access to the other location.

Notes

For the record, this validation is done here.

dvojtise commented 4 years ago

I agree we may want to open it several times but most probably in 2 different ale files in order to create 2 aspects. Each contributing some new features for different purposes. The fact that we cannot name the aspects would be counter balanced by the name of tmeach ale file. Even if not best practice (need for doc on the each aspect to clarify the usage of each of them) in some case we may wish to put everything in a single file

echebbi commented 4 years ago

I agree we may want to open it several times but most probably in 2 different ale files in order to create 2 aspects. Each contributing some new features for different purposes

I think that's important to support this scenario. We may also decide that an EClass shouldn't be open more than once in a single source to enforce some "best" practices but in that case we should also forbid this strange extends-workaround.

Remaining tasks: