Refactoring is your friend / moving from 6.x to 9.x
andre at andregarzia.com
Wed Jan 2 12:34:40 CET 2019
Yes but it is not as ergonomic. Let me tell an example from a different
refactoring a ton of it.
One of the functions worked better with a different parameter order than
what I originally used. I could select the function declaration, use the
refactor contextual menu, use "change signature" and alter the param order.
The IDE then made sure that all code that called that function was changed
to support the new order automatically.
There was a piece of code inside a function that was useful elsewhere.
Click refactor, select "extract to new function", fill the new function
name. It creates a new function and place a call to that function in the
original place where it was.
These are just two examples. Those refactor tools go much deeper than that.
It makes it easy and even fun to rework your code.
It would be hard to have the same power in LC because LC is more dynamic
than JS in terms of scope and what is available. JS modern IDEs maintain an
AST in memory for your software so that when you refactor, they can locate
and fix the side effects of your changes. It is more powerful and flexible
than text replacements because the IDEs actually understand the code
through having their own parser and stuff.
Buuuuuut some of it could be done in LC with simple text replacement based
Is there a way to "safely" add to LC contextual menu in the script editor?
On Mon, Dec 31, 2018, 17:33 Bob Sneidar via use-livecode <
use-livecode at lists.runrev.com wrote:
> Find/Replace works great. I've done it a few times, so long as the thing
> you are finding has a unique name that cannot be a part of any other bit of
> code, you should be fine. Backup your stack of course before doing
> something so drastic.
> A while ago, the LC dev team optimized the search engine so that it is
> orders of magnitude faster.
> Bob S
> > On Dec 30, 2018, at 11:57 , Andre Alves Garzia via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> > Malte,
> > So happy that you're back here my friend. I too spent some time away.
> > So, refactoring and constantly trying to erase mistakes of my past
> coding self are a constant here. I wish we had better refactoring tools so
> that we could rename a handler and all code that called that handler was
> fixed, or stuff such as rename variable...
> > Cheers
> > andre
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode