Project

General

Profile

TH3-Drop Self » History » Version 1

Version 1/3 - Next » - Current version
Wil van Antwerpen, 06/03/2019 01:33 AM


Drop Self

In recent versions of DataFlex you do not have to use the Self notation when addressing objects.

Eg.
~~~
Get Value Of (oMyNewForm(Self)) to sValue
~~~
can be written as
~~~
Get Value Of oMyNewForm to sValue
~~~

The latter form is much easier to read for most human beings, so it is a preferred notation style.

The refactoring option "Drop Self" helps you to find and rewrite all the object notations that use the legacy self style and suggests to change them into the variant without Self. Hence the name.

The refactoring method will popup a message box that asks you if you want to change the line of code.
In it's most bare form it does that for each change.

As this is fairly invasive, you can tick a checkbox to remember specific objects.

So if you already decided to rewrite (oMyNewForm(Self)) into oMyNewForm then it remember that particular choice.

You can also keep the current lining out of the code by replacing the "wiped" out part of the code replaced with spaces.

Why all the questions?

The reason you get the message box is because our parser can not detect everything at this stage.

For example if you are using a property to store a object id then the replacement would break your code.