one trick if you wan't to keep a type but redefine the operators on it is to wrap it in a single element record.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Marc > Weustink > Sent: 14 October 2006 16:42 > To: FPC developers' list > Subject: Re: [fpc-devel] type question > > > Peter Vreman wrote: > >> On Saturday 14 October 2006 15:55, Marc Weustink wrote: > >>> Hi, > >>> > >>> if I define 2 types like: > >>> > >>> type > >>> MyA = type string; > >>> MyB = type string; > >>> > >>> are MyA and MyB considered as the same type ? > >> No, you are explicitly marking them as a new type. This is a very cool > >> feature > >> of Pascal you wont find in many other languages. > >> > >> (For instance, you could use it to create a new integer-type > for little- > >> and > >> big-endian numbers, ensuring that you _never_ directly assign a > >> little-endian > >> number to a big-endian one, or vice versa) > > > > For the compiler the types are not equal anymore, but they are still > > compatible for implicit type conversion. This has mainly impact on > > overload choosing and parameter passing. Normal assignments > using ':=' are > > not affected because of the still available implicit type conversion. > > I came to this when I wanted to do operator overloading on them. The > compiler complained that you cannot overload for equal types. > > So I wanted first to know if it are equal types or not. > > Next question: Should operator overloading be possible on such types ? > > Marc > > _______________________________________________ > fpc-devel maillist - fpc-devel@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel