Construct 3 suggestions & ideas

Suggest and vote on ideas for Construct 3! Please note this is only one aspect of planning. We do not guarantee any features here will be implemented, even if they are top-voted ideas. The aim is just to collect feedback. Remember to search for existing submissions before adding an idea, describe your ideas as comprehensively as possible, and vote for plausible ideas that are well thought out. Please see our full guidelines on suggesting features.

23 VOTE

Make Function Names/Call refactorable

In construct 2, all function calls and naming is done using string names.  This makes it very difficult to refactor a name of a function later on.  I have resorted to using text search and replace in the XML structure.

Another Solution I have tried that is a little clunky is:

  1. Setup a global dictionary called Functions and put one text instance variable for each function name I want
  2. In the On Function event declaration, I would also need to put the same text value as step 1
  3. In every Call Function action, I would use the global dictionary variable as it's refactorable.

The advantage to the above process is that there are only 2 spots that I write out the string version of the function name.  If I need to rename it, I just have to update those two locations and the whole project is refactored.

The disadvantage is that there are two locations now that I have to go to manage function names.

So my suggestion would be to create a way to have function names more static.  One Possibility is to have a new object type to compliment the Function object.  This new objects would be used throughout the project as the Call Function target which you would then have the appropriate On Function events for these objects.

  • Scott
  • Jun 23 2017
  • Shipped
  • Sep 5, 2017

    Admin Response

    In r54 we shipped 'Find all references' for functions, which provides a list of every reference of a function so you can easily update them all. Unfortunately we can't easily add a feature to automatically update references, since some references are ambiguous (e.g. call function "Func" & number), so for the time being 'Find all references' with a manual review is probably the best way to go about this. So for that reason I'm marking this entry as shipped.

    We do have plans to go beyond this though - first-class function support is something we have planned for after the C3 runtime is ready. One aspect of this will be making functions more like variables, in that if you rename them, they automatically update everywhere. This should be the ultimate solution to this kind of problem of refactoring. It's a long-term plan, but we do intend to have that.

  • Attach files
  • Je Fawk commented
    September 05, 2017 13:12

    How can this be considered shipped? Find all references was already finding function names, so r54 just added a context menu button.

  • Je Fawk commented
    September 05, 2017 13:50

    (conversation happened)
    Okey I guess I understand now why it's "shipped"