Page 1 of 1

Another feature suggestion

Posted: 13 Feb 2023 17:28
by Harrison Pratt
After having explored PropertyDepot ideas, it seems that a nice feature for VP would be a compiler directive that could automatically insert the property getters and setters into the implementation file.
That would make a database of properties less important.

Maybe something like this:

Code: Select all

interface myClass   properties [autoProperty] % automatic code appended to myClass.pro     tally : integer := 0. % count of everything     total : real. % sum of everything   properties % no code generation     textColor : ::color.     bgColor : ::color.     centerText : boolean.   end interface myClass

Code: Select all

Implement myClass ... % This PROPERTY code is maintained automatically, do not update it manually. %  11:56:28-10.2.2023   facts % for autoProperties ... clauses % for autoProperties ... % end of automatic PROPERTY code   end implement myClass

Re: Another feature suggestion

Posted: 14 Feb 2023 10:53
by Thomas Linder Puls
Well, I have two "problems" with this suggestion. First of all it is a strict rule that implementation details are written in the implementation; interfaces only defines the interface.

Secondly, the suggested auto code has exactly the same effect as implementing the property with a fact:

Code: Select all

interface ... property     aProperty : someDomain.   implement ... facts     aProperty : someDomain := ....
Implementing a property using "getters" and "setters" mainly makes sense, if you want some other functionality than the plain get/set functionality. But in that case the code will be different from the auto code and then it cannot be maintained automatically.

Re: Another feature suggestion

Posted: 14 Feb 2023 13:51
by Harrison Pratt
Thanks ... it seems I've been under-thinking this. :oops:

Re: Another feature suggestion

Posted: 14 Feb 2023 22:14
by Gukalov
I have a dream)))
The simplest set/get declaration in class/interface with value settings:

Code: Select all

properties     aProperty : someDomain := someValue.
also declares the corresponding fact without extra words in implement.

Re: Another feature suggestion

Posted: 16 Feb 2023 9:29
by Thomas Linder Puls
Unfortunately, that dream will not come through. Interfaces define the interface of objects the implementation is written in the implementation. Also recall that though you think of a class and interface together, a single interface can be used for many classes.

Likewise a class defines the "interface" of a class, the implementation is written in the implementation.