issue-#38 revisited: simplify migration to 1.7

Post Reply
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#38 revisited: simplify migration to 1.7

Post by Josef Templ »

When porting code from 1.6 to 1.7 I got some compiler messages regarding issue-#38
(passing an IN parameter or read-only variable as a VAR receiver is no longer allowed).
This is not a surprise because this change is the most significant incompatible change of 1.7
and it was of course possible to do the required adaptations.

However, this change may also hit other users and complicate the upgrade to 1.7.
I therefore took a closer look and found out that almost all of the problems
could have been avoided by small refinements in the core system.
Those changes would also avoid changes in some other BB modules
that have been done for #38 and could be undone.

The changes are simply to use IN for the receiver parameter of
methods that don't change the receiver. This approach has
already been applied to module Meta as part of #38.
It would only be needed to also apply it to TextMappers.Formatter
and the various Dialog types such as List or Tree.

All of them are simple and do not introduce any new source level incompatibilities
but remove incompatibilities, thus making the upgrade to 1.7 simpler.

For easy review I have prepared the required changes in issue-#38.
For the diffs see http://redmine.blackboxframework.org/pr ... fa1db2c673.

Changes due to #38 have been undone in modules DevDependencies and StdCoder.
Docu changes are not yet done.

As a nice side effect of the changes it is now immediately visible from the interface which
methods change a dialog element and which don't, for example:

Code: Select all

		Selection = RECORD 
			len-: INTEGER;
			(VAR s: Selection) Excl (from, to: INTEGER), NEW;
			(IN s: Selection) GetItem (index: INTEGER; OUT item: String), NEW;
			(IN s: Selection) In (index: INTEGER): BOOLEAN, NEW;
			(VAR s: Selection) Incl (from, to: INTEGER), NEW;
			(VAR s: Selection) SetItem (index: INTEGER; IN item: ARRAY OF CHAR), NEW;
			(VAR s: Selection) SetLen (len: INTEGER), NEW;
			(VAR s: Selection) SetResources (IN key: ARRAY OF CHAR), NEW
		END;
The main problem of the changes in Dialog was to get rid of the implicit initialization in case of getter operations.
My understanding is that this initialization is not required at this point. It is done when calling a setter operation
and global variables are initialized to zero anyway.

- Josef
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: issue-#38 revisited: simplify migration to 1.7

Post by Zinn »

Josef, you are always find good corrections. Are there any more unnecessary changes?
- Helmut
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#38 revisited: simplify migration to 1.7

Post by Josef Templ »

According to our git log there are no other corrections due to #38 that can be reverted.

BTW, such a change show how important it is to have a tool (git) that keeps track of all changes related to an issue.
It is not required too often but when it is required it really helps.

- Josef
Post Reply