Re: [fpc-devel] Advanced objects

2020-07-23 Thread Ryan Joseph via fpc-devel


> On Jul 24, 2020, at 6:07 AM, Kostas Michalopoulos via fpc-devel 
>  wrote:
> 
> There should be at least support for operators. I have a custom
> dynamic array object type (i use objects instead of classes to avoid
> unnecessary heap allocations) which would benefit a lot from such
> support. I worked around not having management operators by putting
> the data fields and core functionality inside a generic advanced
> record which implements these operators and then using that inside the
> object (so the values do get released automatically when the object
> itself is released), but i also need support for at least the equality
> operator as the dynamic array object has an IndexOf method that uses
> that and it cannot be used with other dynamic arrays (so i cannot have
> a dynamic array object which itself contains dynamic array objects
> because i cannot provide a = operator for the dynamic array object
> itself).

I thought the core team was going to accept this patch because it doesn't 
really have any downsides. Classes should be able to support operator overloads 
also provided they don't return the class type itself (this was discussed at 
length with Sven) so at the very least =, >, < etc... should be supported. If 
the first patch ever gets accepted I would like to extend it to do that also.

Regards,
Ryan Joseph

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Advanced objects

2020-07-23 Thread Kostas Michalopoulos via fpc-devel
There should be at least support for operators. I have a custom
dynamic array object type (i use objects instead of classes to avoid
unnecessary heap allocations) which would benefit a lot from such
support. I worked around not having management operators by putting
the data fields and core functionality inside a generic advanced
record which implements these operators and then using that inside the
object (so the values do get released automatically when the object
itself is released), but i also need support for at least the equality
operator as the dynamic array object has an IndexOf method that uses
that and it cannot be used with other dynamic arrays (so i cannot have
a dynamic array object which itself contains dynamic array objects
because i cannot provide a = operator for the dynamic array object
itself).
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Advanced objects

2020-07-23 Thread Ryan Joseph via fpc-devel


> On Jul 23, 2020, at 7:32 AM, Kostas Michalopoulos via fpc-devel 
>  wrote:
> 
> Hi,
> 
> I'd also like to repeat that question since i was just trying to use
> management operators for a generic object type (not class, not record)
> that i want it to automatically initialize/shutdown itself (right now
> i'm doing it manually but i'd prefer it if the compiler would do that
> for me) and found that bug too.

I never got management operators operators working for the mode switch anyways 
because I didn't know how to handle inheritance properly and this would cause 
extra scrutiny over the feature which was already in question. I have other 
patches which are not contested at all and are just sitting there for months so 
I think there's a very slim chance advanced objects (in any form) gets accepted 
at this point.

Regards,
Ryan Joseph

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Advanced objects

2020-07-22 Thread Kostas Michalopoulos via fpc-devel
Hi,

I'd also like to repeat that question since i was just trying to use
management operators for a generic object type (not class, not record)
that i want it to automatically initialize/shutdown itself (right now
i'm doing it manually but i'd prefer it if the compiler would do that
for me) and found that bug too.

Kostas

On Mon, Mar 23, 2020 at 10:43 AM Ryan Joseph via fpc-devel
 wrote:
>
> Checking in on old bug report for "advanced objects" which was marked as 
> acknowledged on the tracker. Was there ever any discussion of this and 
> possibility of it being applied? I don't think it caused any controversy so I 
> was hoping to get to use it some time soon. :)
>
> https://bugs.freepascal.org/view.php?id=36350
>
> Regards,
> Ryan Joseph
>
> ___
> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Advanced objects

2020-03-23 Thread Ryan Joseph via fpc-devel
Checking in on old bug report for "advanced objects" which was marked as 
acknowledged on the tracker. Was there ever any discussion of this and 
possibility of it being applied? I don't think it caused any controversy so I 
was hoping to get to use it some time soon. :)

https://bugs.freepascal.org/view.php?id=36350

Regards,
Ryan Joseph

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel