[Lazarus] TMask revisited

Bart bartjunk64 at gmail.com
Sat Oct 23 22:18:29 CEST 2021

On Sat, Oct 23, 2021 at 12:22 PM Bart <bartjunk64 at gmail.com> wrote:

> Then we have TMaskOpcode and TMaskOpcodesEnum types.
> The first one is more or less an internal type.
> The latter one is for common user interface.
> Since TMaskOpCode is used in the interface part of TMask, we must have
> it in the interface part of the unit.

I've given it some more thought.

AFAICS the TMaskOpCode and TMaskOpcodesEnum types are not related at all.
TMaskOpCode is some kind of internal identifier in the internal mask
representation, whereas TMaskOpcodesEnum are options for interpreting
the mask.

Q1: is it possible to have the TMaskOpCode as an internal type in the
class (maybe in the protected part of the class definition)?
It seems it is not needed outside (as in the public part of the interface).

If we did not already have the old TMaskOption type, I would actually
have liked to propose to rename the TMaskOpcodesEnum into

Q2: @José: the TMaskOpCode enums are indexed, and there is a gap in
the index. Is the index necessary for the code to work?
Is the gap necessary?
In the Add() method, the enum is cast to a byte, this should also work
if no indices are used (as long as you do not do mathematical
operations with the value of that byte).


More information about the lazarus mailing list