elan-language / LanguageAndIDE

Apache License 2.0
3 stars 0 forks source link

Moving up a number of selected frames in front of constructor in a class #680

Closed stirlingstout closed 1 month ago

stirlingstout commented 1 month ago

Create a new class, the constructor frame is now inserted for you. Add the parameters for the constructor, and the code in the constructor to set the properties based on the parameters.

Now add the properties after the constructor and then decide that they look better above the constructor. Select all the properties and try to move them above the constructor.

richardpawson commented 1 month ago

The inability to move existing frames above the constructor was an explicit design choice, not an accidental result. In general, I don't like the idea of mandated ordering of members (e.g. properties first, then procedure methods, then function methods) but I do rather like always seeing the constructor at the top.

One could argue that since it is not a requirement to do anything inside the constructor that it could be optional (i.e. deletable and/or added only when needed). Personally, I think there is a strong case for there always being a constructor even if it doesn't do anything, and if that argument is accepted then I think there is a strong case for keeping it at the top.

So, at the moment, I wouldn't favour this proposed change, but we can wait and see