Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Sven Barth via fpc-pascal
Ryan Joseph schrieb am Do., 14. Juni 2018, 14:48: > > > > On Jun 14, 2018, at 7:26 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > Because one needs to be able to represent the properties in the RTTI. > Without pointers all that is needed to access the property

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Ryan Joseph
> On Jun 14, 2018, at 7:51 PM, Ryan Joseph wrote: > > Jonathan Blow disagrees with you then. :) None of this matter for typical > desktop applications. This is strictly for real time graphics, games etc… > where getting tons of cache misses on every frame is an actual problem. Btw here’s

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Ryan Joseph
> On Jun 14, 2018, at 7:42 PM, Marcos Douglas B. Santos > wrote: > > It is the opposite: programming languages should help programmers > to make code which is better read by human being, not CPU. Jonathan Blow disagrees with you then. :) None of this matter for typical desktop applications.

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Ryan Joseph
> On Jun 14, 2018, at 7:26 PM, Sven Barth via fpc-pascal > wrote: > > Because one needs to be able to represent the properties in the RTTI. Without > pointers all that is needed to access the property from code is an offset. > With pointers you'd need to add where dereferences are required

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Ryan Joseph
> On Jun 14, 2018, at 7:19 PM, Martin wrote: > > You can do that without the "with" > record TFoo > Bar: TOtherRecord; // has a field abc > end; > > The only thing is that you need to access the field by its fully qualified > name Foo.Bar.abc, instead of Foo.abc. > Which is good, because

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Marcos Douglas B. Santos
On Thu, Jun 14, 2018 at 8:43 AM, Ryan Joseph wrote: > [...] > His premise for the proposal is that programming languages > should help the programmer to make code which is better read > by the CPU instead of high-level constructs for abstract concepts. > It’s very specific to a particular task

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Sven Barth via fpc-pascal
Ryan Joseph schrieb am Do., 14. Juni 2018, 11:59: > > > > On Jun 14, 2018, at 4:44 PM, Ryan Joseph > wrote: > > > > Something I tried was using properties like this but it didn’t work. Is > that something properties could do? It feels like they should be able to > reach into records fields that

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Martin
On 14/06/2018 13:43, Ryan Joseph wrote: On Jun 14, 2018, at 5:18 PM, Mattias Gaertner wrote: If you only want that, why not use objects? The real reason Jon Blow proposed this syntax is because it allows you keep continuous arrays of memory which you can index into using struts. The fact

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Ryan Joseph
> On Jun 14, 2018, at 5:18 PM, Mattias Gaertner > wrote: > > If you only want that, why not use objects? The real reason Jon Blow proposed this syntax is because it allows you keep continuous arrays of memory which you can index into using struts. The fact it mimics multiple inheritance

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Mattias Gaertner
On Thu, 14 Jun 2018 16:44:40 +0700 Ryan Joseph wrote: >[...] > The idea of “with” inside records is so interesting because it basically > mimics inheritance without going full class. If you only want that, why not use objects? Mattias ___ fpc-pascal

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Ryan Joseph
> On Jun 14, 2018, at 4:25 PM, Sven Barth via fpc-pascal > wrote: > > omething like that only leads to confusion. Pascal is a rather explicit > language so manually declaring a Position property inside TDoor would be more > in the spirit of the language. > > A possible alternative would

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Ryan Joseph
> On Jun 14, 2018, at 4:44 PM, Ryan Joseph wrote: > > Something I tried was using properties like this but it didn’t work. Is that > something properties could do? It feels like they should be able to reach > into records fields that since everything is known to the property as time of >

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Sven Barth via fpc-pascal
Ryan Joseph schrieb am Do., 14. Juni 2018, 10:03: > type > TEntity = record > position: TVec2; > end; > TEntityPtr = ^TEntity; > > type > TDoor = record > with entity: TEntityPtr; // import entity namespace for > entire TDoor scope

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Ryan Joseph
> On Jun 14, 2018, at 3:23 PM, Marco van de Voort wrote: > >> // works with function parameters also. >> // this is almost like a class helper or at very least mimics ?self? in >> methods. >> >> procedure OpenDoor(with var door: TDoor); >> begin >> state := true; // with imports door

Re: [fpc-pascal] Better usage of "with"

2018-06-14 Thread Marco van de Voort
In our previous episode, Ryan Joseph said: > // works with function parameters also. > // this is almost like a class helper or at very least mimics ?self? in > methods. > > procedure OpenDoor(with var door: TDoor); > begin > state := true; // with imports door namespace into entire