Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-06 Thread Sven Barth via fpc-pascal
Ryan Joseph schrieb am Do., 7. Juni 2018, 03:32: > > > > On Jun 7, 2018, at 4:25 AM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > However you can't do that with indexed properties (which is the feature > that Ryan meant) as the value returned by the property gette

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-06 Thread Ryan Joseph
> On Jun 7, 2018, at 4:25 AM, Sven Barth via fpc-pascal > wrote: > > However you can't do that with indexed properties (which is the feature that > Ryan meant) as the value returned by the property getter is merely a copy and > not a reference. > Is there anyway to fix this btw or can I m

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-06 Thread Sven Barth via fpc-pascal
Nitorami schrieb am Mi., 6. Juni 2018, 22:39: > >2) dynamic arrays can index directly into records and write to fields but > the [] operator overload can’t do this. > > I don't understand this, can you provide an example ? > With dynamic arrays that contain records you can do this: === code beg

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-06 Thread Nitorami
>2) dynamic arrays can index directly into records and write to fields but the [] operator overload can’t do this. I don't understand this, can you provide an example ? -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal ma

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-05 Thread Ryan Joseph
I fixed up my code on GitHub so the records members including the ref count are actually on the heap so the ref count is actually used now. :) There’s still 2 problems though that make dynamic arrays better: 1) the := operator for implicit arrays like [1,2,3] is bugged currently so requires a

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Ryan Joseph
> On Jun 4, 2018, at 9:12 PM, Michael Van Canneyt > wrote: > > All the rest of what you do remains exactly the same. Dynamic arrays do far > less than what you seem to assume. As noted the inclocked()/declocked() calls destroyed some performance sensitive parts of my code while testing and I

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Ryan Joseph
> On Jun 4, 2018, at 9:21 PM, Martin Schreiber wrote: > > It seems that the inclocked()/declocked() operations completely destroy the > performance of the OP's application (which I find strange) so he never want > to touch dynamic arrays anymore as he wrote. It was one hyper sensitive part o

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Martin Schreiber
On Monday 04 June 2018 16:12:27 Michael Van Canneyt wrote: > > They make life easier by reducing the need for manual memory > management. No more, no less. Other than that they behave like normal > arrays on the heap. > It seems that the inclocked()/declocked() operations completely destroy the pe

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Michael Van Canneyt
On Mon, 4 Jun 2018, Ryan Joseph wrote: On Jun 4, 2018, at 5:46 PM, Michael Van Canneyt wrote: Well, as far as I can see, you are repeating what the compiler already does for you out of the box. But it’s customizable, that’s the point. What happens when you remove an element from a dyn

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Ryan Joseph
> On Jun 4, 2018, at 5:46 PM, Michael Van Canneyt > wrote: > > Well, as far as I can see, you are repeating what the compiler already does > for you out of the box. But it’s customizable, that’s the point. What happens when you remove an element from a dynamic array? I don’t even know where

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Ryan Joseph
> On Jun 4, 2018, at 4:39 PM, Michael Van Canneyt > wrote: > > The array is private. This means that the reference count will be 0 or 1. I looked at the examples on the wiki and think by private you mean that the ref count does indeed need to be a pointer so it gets updated for all reference

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Michael Van Canneyt
On Mon, 4 Jun 2018, Ryan Joseph wrote: On Jun 4, 2018, at 4:39 PM, Michael Van Canneyt wrote: I fail to see why you need management operators for this. just because I wanted the array implementation available and to get automatic cleanup. I don’t know all the stuff dynamic arrays do be

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Ryan Joseph
> On Jun 4, 2018, at 4:39 PM, Michael Van Canneyt > wrote: > > I fail to see why you need management operators for this. just because I wanted the array implementation available and to get automatic cleanup. I don’t know all the stuff dynamic arrays do behind the scenes and that worries me

Re: [fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Michael Van Canneyt
On Mon, 4 Jun 2018, Ryan Joseph wrote: Since we were talking about dynamic arrays I was curious to see if they could be implemented using the new management operators so I made a little proof of concept by cobbling together old code. It’s not complete or very good by any means but I think i

[fpc-pascal] Dynamic arrays using management operators

2018-06-04 Thread Ryan Joseph
Since we were talking about dynamic arrays I was curious to see if they could be implemented using the new management operators so I made a little proof of concept by cobbling together old code. It’s not complete or very good by any means but I think it’s a pretty interesting alternative to usin