Re: [fpc-devel] class operator overloads

2019-06-10 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Mo., 10. Juni 2019, 20:35: > > > > On Jun 10, 2019, at 2:21 PM, Sven Barth via fpc-devel < > fpc-devel@lists.freepascal.org> wrote: > > > > There exist only two assignment operators, namely "Implicit" (aka := in > mode ObjFPC) and "Explicit" both taking a single argument.

Re: [fpc-devel] class operator overloads

2019-06-10 Thread Ryan Joseph
> On Jun 10, 2019, at 2:21 PM, Sven Barth via fpc-devel > wrote: > > There exist only two assignment operators, namely "Implicit" (aka := in mode > ObjFPC) and "Explicit" both taking a single argument. Introducing a binary > operator does not change that the operator is forbidden for

Re: [fpc-devel] class operator overloads

2019-06-10 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Mo., 10. Juni 2019, 16:26: > > > > On Jun 10, 2019, at 9:31 AM, Sven Barth via fpc-devel < > fpc-devel@lists.freepascal.org> wrote: > > > > The +-operator is not defined internally thus it is allowed to be > overloaded. (is it really that hard to understand? If you can use

Re: [fpc-devel] class operator overloads

2019-06-10 Thread Ryan Joseph
> On Jun 10, 2019, at 9:31 AM, Sven Barth via fpc-devel > wrote: > > The +-operator is not defined internally thus it is allowed to be overloaded. > (is it really that hard to understand? If you can use an operator in code > without declaring an operator overload then this operator is

Re: [fpc-devel] class operator overloads

2019-06-10 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Mo., 10. Juni 2019, 15:28: > > > > On Jun 10, 2019, at 9:25 AM, Sven Barth via fpc-devel < > fpc-devel@lists.freepascal.org> wrote: > > > > The operator for assigning one class instance to another exists and is > internal thus it is not allowed to be overloaded. > > > > Is

Re: [fpc-devel] class operator overloads

2019-06-10 Thread Ryan Joseph
> On Jun 10, 2019, at 9:25 AM, Sven Barth via fpc-devel > wrote: > > The operator for assigning one class instance to another exists and is > internal thus it is not allowed to be overloaded. > Is that true for binary operators also? The same principle could apply to them also and

Re: [fpc-devel] class operator overloads

2019-06-10 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Mo., 10. Juni 2019, 14:28: > > > > On Jun 10, 2019, at 3:13 AM, Sven Barth via fpc-devel < > fpc-devel@lists.freepascal.org> wrote: > > > > A basic principle of operator overloads is that existing, internal > operators are not overloadable. This principle won't be

Re: [fpc-devel] class operator overloads

2019-06-10 Thread Ryan Joseph
> On Jun 10, 2019, at 3:13 AM, Sven Barth via fpc-devel > wrote: > > A basic principle of operator overloads is that existing, internal operators > are not overloadable. This principle won't be abandoned only because you want > managed classes. > Existing internal operators? Sorry I

Re: [fpc-devel] class operator overloads

2019-06-10 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Mo., 10. Juni 2019, 03:00: > Sorry to bring this up again but I had a thought today while working > regarding class operator overloads in classes (i.e. operators that are > members of classes). > > If the operators in classes allowed another parameter for the left sided >

Re: [fpc-devel] class operator overloads

2019-06-09 Thread Ryan Joseph
Sorry to bring this up again but I had a thought today while working regarding class operator overloads in classes (i.e. operators that are members of classes). If the operators in classes allowed another parameter for the left sided value could this idea be more viable? Unless I’m mistaken I

Re: [fpc-devel] class operator overloads

2019-04-21 Thread Ryan Joseph
> On Apr 20, 2019, at 9:56 AM, Ryan Joseph wrote: > >> On Apr 16, 2019, at 8:43 PM, Ryan Joseph wrote: >> >> I see why that could be a problem but aren’t users reasonable for not doing >> dangerous things in a language like Pascal with low-level memory access? >> They can already do this

Re: [fpc-devel] class operator overloads

2019-04-16 Thread Ryan Joseph
> On Apr 16, 2019, at 6:10 PM, Sven Barth via fpc-devel > wrote: > > Mutating is also not the solution. Consider this: > > === code begin === > > operator + (aLeft, aRight: TSomeClass): TSomeClass; > begin > aLeft.DoSomething(aRight); > Result := aLeft; > end; > > var > a, b, c:

Re: [fpc-devel] class operator overloads

2019-04-16 Thread Sven Barth via fpc-devel
Am 16.04.2019 um 22:59 schrieb Ryan Joseph: On Apr 16, 2019, at 4:51 PM, Sven Barth via fpc-devel wrote: It's the same problem there. The thing however is that FPC's operator overloading support is quite old (compared to Delphi's) and it's possible that it is even older than the support

Re: [fpc-devel] class operator overloads

2019-04-16 Thread Ryan Joseph
> On Apr 16, 2019, at 4:51 PM, Sven Barth via fpc-devel > wrote: > > It's the same problem there. > The thing however is that FPC's operator overloading support is quite old > (compared to Delphi's) and it's possible that it is even older than the > support for Delphi's class type. So the

Re: [fpc-devel] class operator overloads

2019-04-16 Thread Sven Barth via fpc-devel
Am 16.04.2019 um 18:21 schrieb Ryan Joseph: Nagging question I had that I would like answered. I was told that we can’t have operator overloads on classes (only records) because there is a potential temporary class that could be created and thus some kind of automatic memory management would

[fpc-devel] class operator overloads

2019-04-16 Thread Ryan Joseph
Nagging question I had that I would like answered. I was told that we can’t have operator overloads on classes (only records) because there is a potential temporary class that could be created and thus some kind of automatic memory management would be needed. How is this any different than