[fpc-devel] Generics are still broken

2012-05-11 Thread Anthony Walter
Generics still have a lot of problems. I know they've been in the works for years but they still fail easily. Consider the Delphi mode below, I get "Error: Generics without specialization cannot be used as a type for a variable" I could easily write up a whole bunch of test cases were generic sti

Re: [fpc-devel] Generics are still broken

2012-05-11 Thread Anthony Walter
Okay, i'll try getting trunk sources from svn and building. I'll reporting back shortly. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Generics are still broken

2012-05-11 Thread Anthony Walter
The example problem I listed seems to be fixed in trunk. I'll write a few more examples. Thank you FPC development team! ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Generics are still broken

2012-05-11 Thread Anthony Walter
Okay with the latest trunk version I tried compiling my generic classes. It seems there is a problem with fpc generics in that you cannot use a generic as a type parameter. e.g type TDictionary = class(TEnumerable>) ... Given: type TCollection = class end; TPair = class Key: K; Val

Re: [fpc-devel] Generics are still broken

2012-05-11 Thread Anthony Walter
oblem into a smaller test case. If you want some help let me know what I can do. On Fri, May 11, 2012 at 4:17 PM, Sven Barth wrote: > On 11.05.2012 20:10, Anthony Walter wrote: > >> Okay with the latest trunk version I tried compiling my generic classes. >> It seems there is a pr

Re: [fpc-devel] Generics are still broken

2012-05-12 Thread Anthony Walter
Okay Sven I'll be using the bug tracker with the "generics" to assist in the best way I can. I just added an issue for the problem I mentioned which I believe was previously an undocumented issue. Issue #22019 http://bugs.freepascal.org/view.php?id=22019 ___

[fpc-devel] Sven, please look into "cannot return generic derived class" issue

2012-05-24 Thread Anthony Walter
Sven, When you have the time could you look at issue #22019 titled "Cannot return generic derived class"? I think it's kind of a big issue because it prevents anyone from returning a subclass of a generic type. I just want to know that's you've read the bug report and see/understand the issue. In

[fpc-devel] Type helpers in delphi mode

2013-03-29 Thread Anthony Walter
In the latest trunk of fpc are their any plans to allow for type helpers and {$mode delphi}? I ask this because I want to mix in a single unit both the delphi style generics and type helpers and it seems that this is currently not supported. Also, is there a single online 'living' reference every

Re: [fpc-devel] Type helpers in delphi mode

2013-03-29 Thread Anthony Walter
s, but it seems like their efforts can be diminished if the only way to know about some of them is to constantly keep up messages tucked away in this mailing list (or go back through the archives for new people). Thanks On Fri, Mar 29, 2013 at 10:11 AM, Jonas Maebe wrote: > > On 29 Mar 20

Re: [fpc-devel] Does FreePascal support named parameters?

2013-04-01 Thread Anthony Walter
Name parameters are supported through variants. procedure Test(V: Variant); begin V.SomeMethod(12, ParamOne := '', ParamTwo := 12.5); end; Internally what happens is V is checked to for IDispatch, next GetIDsOfNames is called to find the dispid of SomeMethod, then a variant array of arguments i

Re: [fpc-devel] Does FreePascal support named parameters?

2013-04-03 Thread Anthony Walter
Frank, The Javascript in Delphi code depends on active script engine. and component of Windows. So no, the example I provided does not run on Linux. But, and dynamic methods and properties (as well as named optional arguments) are supported in Free Pascal, as long as you use a Variant (or OleVar

[fpc-devel] Linux x86_64 trunk fails to build

2013-04-25 Thread Anthony Walter
For testing purposes I downloaded the Ubuntu 13.04 64bit version (which came out today) and tried to build the fpc trunk. I encountered the following problem during "make all": /home/username/fpc-2.6.2/bin/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/home/username/fpc/fpc/rtl/units/x86_64-linux

Re: [fpc-devel] Linux x86_64 trunk fails to build

2013-04-25 Thread Anthony Walter
That looks like it did it, getting the older revision. I should have thought of that myself. Thanks. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

[fpc-devel] A lot of stuff broke, looking for advice

2013-07-08 Thread Anthony Walter
I have a problem and am looking for advice. The problem is I had been developing on 64-bit Linux using a trunk version of fpc from maybe 2-3 months back and now much of my core library no longer works when I use the latest trunk version of fpc. Here is what I am doing... I am working towards publ

Re: [fpc-devel] A lot of stuff broke, looking for advice

2013-07-08 Thread Anthony Walter
Here is an example: { TObjectList = class(TIndexedList) } bare.types.pas(1176,1) procedure/function constructor Create(Boolean);An unhandled exception occurred at $0816975E: bare.types.pas(1182,1) procedure/function procedure Clone:TObject; Fatal: Compilation aborted Error: ppc386 returned an e

Re: [fpc-devel] Little feature teaser

2013-08-02 Thread Anthony Walter
Wow, that looks great Sven. I've been wanting generic functions for a long time. Would it be possible to add constraints like must override operators =, <, or > ... and possibly +, -, /, *, and, or, shl, shr, div, mod? In this way you could write: function Sum(const Items: TArray): T; var I: T;

[fpc-devel] BUG: type aliases in records/classes cannot be used as fields without specialization

2013-10-26 Thread Anthony Walter
Report filed here: http://bugs.freepascal.org/view.php?id=25236 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

[fpc-devel] Generics in FPC have many problems

2011-08-29 Thread Anthony Walter
Jump to "So here are some of the problems I've found with fpc generics" if you don't want to read the backstory. I haven't been active in the FPC for a while, but last week I was asking some questions about the upcoming Delphi FireMonkey project which is supposed to allow broader development with

Re: [fpc-devel] Generics in FPC have many problems

2011-08-29 Thread Anthony Walter
On Mon, Aug 29, 2011 at 10:15 AM, Paul Ishenin wrote: > Yes. These are known problems and you would found even more a year ago. > Sven Barth now trying to fix exising problems and implement missing things. > > If you wish to try fix them yourself you need to study how parser part of > the compile

Re: [fpc-devel] Generics in FPC have many problems

2011-08-29 Thread Anthony Walter
Oh, and FPC generics really need the ability to add constraints ... e.g. type TObjectList = class TList ... end; ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Generics in FPC have many problems

2011-08-29 Thread Anthony Walter
Thanks Jonas. Btw, where would be a good place to follow your progress on JVm support? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Generics in FPC have many problems

2011-08-29 Thread Anthony Walter
On Mon, Aug 29, 2011 at 11:19 AM, Sven Barth wrote: > Hi! > > As Paul and Jonas already told you, I'm currently working on improving the > compilers generic implementation. As you have noticed it currently doesn't > support generic methods and constraints at all. Also the generic > implementation

Re: [fpc-devel] Generics in FPC have many problems

2011-08-29 Thread Anthony Walter
Sven, Tonight I tried to "make all" from your branch and wasn't able to build. This is a the output I got: http://pastebin.com/GQh5XA2w I am guessing your build requires a working version of your fpc binary to build itself. Also, I wrote a few of pretty clean test cases in Delphi 2010 Today whe

[fpc-devel] Thank You Sven Barth

2014-06-09 Thread Anthony Walter
Sven, I noticed you recently fixed many compiler issues which were in the bug tracker. I wanted give you a hearty 'Thank You' and let you know we appreciate your work. Thank You! Anthony ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://

Re: [fpc-devel] Future of FPCUP tool

2015-02-21 Thread Anthony Walter
I've tried fpcup a few times in the past and have always had problems with it not working as expected. I current;y maint what I think is a well formed set of scripts for mac, linux, and mac installers on githhub: https://github.com/sysrpl/Codebot.Setup/blob/master/linux/install.fpc-3.0.linux.sh#L1

Re: [fpc-devel] FPC 3.0.0-rc1 release

2015-09-06 Thread Anthony Walter
Regarding the FPC 3.0 what's new language features, I think there is are more new than what's listed on the wiki. Off the top of my head here two language features not present in 2.6.4: * Helpers now work on intrinsic types such as string and integer (eg. StringHelper = record helper for string) *

Re: [fpc-devel] FPC 3.0.0rc2 and fppkg

2015-10-26 Thread Anthony Walter
*Nothing works for me.* *Following the instructions at http://wiki.freepascal.org/fppkg * *When I do fppkg list I see:* $ fppkg list -l Name Installed (G) Installed (L) Available embweb - - 0.9.1-

Re: [fpc-devel] FPC 3.0.0rc2 and fppkg

2015-10-26 Thread Anthony Walter
I got it working, somewhat. It would seem that you have to duplicate the entire FPC lib tree underneath {UserDir}.fppkg/ The instructions at the page referenced in my last post are very unclear about that. I suppose under normal fpc install this is needed because the lib files are typically only

Re: [fpc-devel] FPC 3.0.0rc2 and fppkg

2015-10-26 Thread Anthony Walter
Okay, I'll check into more a bit later. As a package manager, where is the description of packages? How is anyone to know what webdesign is and what it does other than by just looking at the package name and perhaps trying to google it? The first google result for "fpc webdesign package" leads to

Re: [fpc-devel] FPC 3.0.0-rc2 release

2015-10-29 Thread Anthony Walter
Jonas, when FPC 3.0 release is ready will the Lazarus team also be releasing a tandem version? I ask because Ondrej's patch for this issue still isn't in SVN: http://bugs.freepascal.org/view.php?id=22235 ___ fpc-devel maillist - fpc-devel@lists.freepa

Re: [fpc-devel] Feature announcement: Generic functions, procedures and methods

2015-11-21 Thread Anthony Walter
Sven, first off, congratulations and we thank you for so much good work. in the future do you see a time when type inference could be used? S := Add('hello ', 'world'); I := Add(1, 2); For everyone else, I can also imagine: function Max(const A, B: T): T; begin if A > B then Result := A else Res

Re: [fpc-devel] Feature announcement: Generic functions, procedures and methods

2015-11-22 Thread Anthony Walter
Sven, fair enough. I'll test out what you've published and if I find anything interesting (strange compiler errors, edge cases, useful scenarios) I'll post replies. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-

Re: [fpc-devel] RTTI

2015-11-25 Thread Anthony Walter
Can someone refer me to a document regarding the whats planned for FPC RTTI improvements? Is it aiming to support the current Delphi RTTI improvements (attributes, virtual method intercepts, location and tvalue) or something else? ___ fpc-devel maillist

Re: [fpc-devel] [Lazarus] FPC Pestering Peacock (3.0.0) release

2015-11-25 Thread Anthony Walter
Sweeet! For Linux users here is a complete FPC 3.0 release + Lazarus from svn build script: http://cache.getlazarus.org/download/linux/install-3.0.sh ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/li

Re: [fpc-devel] Capability CPUARM_HAS_BLX_LABEL with ARM instruction set

2015-12-16 Thread Anthony Walter
Hello Gary and thanks go out to both the FPC and Lazarus teams as well. I don't want to hijack your thread, but I too am using FPC on the Pi, albeit not to the level you've gone. I believe the FPC community has the opportunity to expand to a new younger audience with the Pi. With this in mind I be

Re: [fpc-devel] Capability CPUARM_HAS_BLX_LABEL with ARM instruction set

2015-12-16 Thread Anthony Walter
Sven, the FPC community is not that large as that of C, or Java, or Go. Our figurative slice of potential users is reduced further when qualified as FPC on the Raspberry Pi. My response to Garry was a sort of "Hey we both like FPC and Pi, maybe some of us can band together to benefit FPC on Pi". My

Re: [fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

2016-01-26 Thread Anthony Walter
I guess this is good time to ask, how would the community feel about setting a new standard for Free Pascal units going forward? I am thinking that since FPC 3.0 is now official we don't really have a good excuse to start using many of the great new language features it brings, such as dotted name

Re: [fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

2016-01-26 Thread Anthony Walter
I'd also like to add that there might be more names under a namespace than just two (e.g "Core.Text"). For example: unit Core.Collections; unit Core.Collections.Specialized; unit Core.Text; unit Core.Text.Xml; unit Core.Text.Regex; unit Core.Network; unit Core.Network.Http; unit Core.Network.Ftp;

Re: [fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

2016-01-26 Thread Anthony Walter
Michael, I see the many benefits of dotted namespace units. 1) Authorship. Instead of using cryptic prefixes (Rx, Syn, Id, and so on) if we promoted the use of namespaces we might someday the full names denoting ownership more clearly. That and there would be less me creating unit names conflict

Re: [fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

2016-01-27 Thread Anthony Walter
Micahel, Do you care to address the issues I raised with the inconsistency of string related functions I raised? Specifically the part about string functions in SysUtils, StrUtils, LCLProcs, LazUTF8, among other units where string related routines are scattered. Also strings aren't the only types

Re: [fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

2016-01-27 Thread Anthony Walter
Tomas, > Alright. So what is the authorship of the default units and how does it > fit to Delphi compatibility? At some point (soon) I hope Free Pascal and Lazarus will expand beyond being Delphi compatible. In my recommendations I did not mean to infer that Delphi compatibility should be broken

Re: [fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

2016-01-27 Thread Anthony Walter
Maciej, Wouldn't it be possible to take my idea and start developing a new library which contains the generic containers you need? I have a nice generic container unit you could use or just pull out the classes you need out of the existing FPC generics unit, duplicate them in their your own unit,

Re: [fpc-devel] Generics.Collections as package for Lazarus or package for FPC RTL

2016-01-27 Thread Anthony Walter
> Unlike Delphi, we have TCompare class and TEquals class, which is used > for manual interfaces (together with TRawInterface and TComTypeSizeInterface). > Additionally (unlike in Delphi which has hidden regular functions for this in > implementation section with fake self parameter) TCompare and T

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Anthony Walter
Make it use lazy instantiation please. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Property overloading vs. property array enumerators

2016-01-28 Thread Anthony Walter
Here is a preferable solution: property Controls: IControlEnumerator read GetItems; This allows for both: for C in Test.Controls do ShowMessage(C.Name); // or for I := 0 to Test.Controls.Count - 1 do ShowMessage(Test.Controls[I]); That is you can access the property as either an enume

Re: [fpc-devel] Feature announcement: Record management operators

2016-03-13 Thread Anthony Walter
Thanks for you work Maciej. Can someone please remember to make an announcement in this mailing list when some/any of this is merged into trunk? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo

Re: [fpc-devel] Feature announcement: Record management operators

2016-03-20 Thread Anthony Walter
Maciej, Just a note, I attempted to compile your smart_pointer branch revision 33229 on a Raspberry Pi 3 Raspbian Jessie (with the latest updates) and the build failed. make all OPT="-dFPC_ARMHF" Sorry, I didn't capture the output error messages. ___ f

Re: [fpc-devel] Feature announcement: Record management operators

2016-03-21 Thread Anthony Walter
Maciej, Please let me know when you apply Sven's recommendations to the make commands and I'll test. Thanks.. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Feature announcement: Record management operators

2016-03-29 Thread Anthony Walter
Maceij, I did a build using your revision 33381. Compilation with "make all" worked with fpc 3.0.0 as a starting compiler. However my first test with it revealed a pretty serious bug: program mytest; {$mode delphi} type TFoo = record private class operator Initialize(var aFoo: TFoo);

Re: [fpc-devel] Feature announcement: Record management operators

2016-03-29 Thread Anthony Walter
Should I file mantis bug reports for personal branches such as this or is mailing list notification sufficient? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Feature announcement: Record management operators

2016-03-29 Thread Anthony Walter
I put up a testing page for your modifications here: http://www.getlazarus.org/language/smart/ The tests are rather simple and sloppy, but so far the few tests I've written have passed using revision 33384. If anyone wants to add/change the test source code you can use the edit feature on that pa

Re: [fpc-devel] Initialize/Finalize management operators and Default intrinsic

2016-04-10 Thread Anthony Walter
Maciej, I've done a little testing on your smart pointer branch but haven't found any issues recently. Can you tell me if there is a tag for this feature in mantis yet and/or if there are any known issues? Thanks ___ fpc-devel maillist - fpc-devel@lis

Re: [fpc-devel] Initialize/Finalize management operators and Default intrinsic

2016-04-14 Thread Anthony Walter
Maciej, A game engine? What happened to it? I've moved my game engine to OpenGL ES 2.0 for all platforms and am looking to create a FPC Android starter template. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bi

Re: [fpc-devel] Initialize/Finalize management operators and Default intrinsic

2016-04-14 Thread Anthony Walter
Looks really good. Why did you feel the need to have IDE integration? From my perspective (having written a game toolkit) the only point I needed IDE integration was a project template to add a reference to my game engine package and create a source code file. All the tools which can be used to wor

Re: [fpc-devel] Initialize/Finalize management operators and Default intrinsic

2016-04-14 Thread Anthony Walter
I am really looking forward to runtime package support. :) As far as game engine design, I wanted/prefer a KISS style similar to XNA. That is you just derive a game class and override two methods: Logic() and Render() and each is passed a Stopwatch class representing time. One you fill in with gam

Re: [fpc-devel] Initialize/Finalize management operators and Default intrinsic

2016-04-15 Thread Anthony Walter
The biggest problem I ran into has to do with asset lifetime management. That is, allowing for ad-hoc creation or loading and unloading of (list to follow): Textures Models Storyboards Skeletons Scripts Audio Samples Fonts Skyboxes Shaders/Shader programs ... and anything else which a game develo

Re: [fpc-devel] Management operators AddRef and Copy vs Copy

2016-04-18 Thread Anthony Walter
Do the source and dest types need to match? How about:"CopyFrom"? As it is right now you already have type parity between types such as floats <- integer and string <- char, so why not between TBar <- TFoo? class procedure TBar.CopyFrom(constref Source: TFoo; var Dest: TBar); Then this begs quest

[fpc-devel] Cannot trap divide by zero in xmm register

2017-06-20 Thread Anthony Walter
I am having a problem with unrecoverable errors in external code, presumably generated by the video driver, crashing my programs. I cannot trap these errors with try..except blocks. Here is a capture of the assembler window with ** marking the line where the error occurs. 7FFFEA79016F 4898

Re: [fpc-devel] Cannot trap divide by zero in xmm register

2017-06-20 Thread Anthony Walter
Some progress ... Since this is an OpenGL app I had been setting Set8087CW($133F) to prevent FPU errors from showing as exceptions. When I omit Set8087CW I get EDivByZero an exception, but my program is still in an unusable state. Since this error occurs in the SSE XMM registers, I think I should

Re: [fpc-devel] Cannot trap divide by zero in xmm register

2017-06-20 Thread Anthony Walter
Wow, that fixed it. Thanks Henry! ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-08-28 Thread Anthony Walter
Ondrej, I agree 100%. Many +1s. Thank you. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-08-29 Thread Anthony Walter
Out of curiosity, is there any strategy that is or can be employed to ensure new language features and mode switches automatically work with codetools and by extension the Lazarus IDE? Or is duplication of effort the only way to get codetools properly parsing new language features? ___

Re: [fpc-devel] x86-64 optimizations

2017-09-26 Thread Anthony Walter
J, Thanks for the contribution. I looked over your patch and seems reasonable, though I didn't try building fpc with it. We need more people like you helping to improve the compiler. Thanks! ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http

Re: [fpc-devel] Fix CamelCase in unit and method names

2018-03-22 Thread Anthony Walter
Yes, I agree, both for unit names, but also for methods and arguments. The exceptions should be for code related that are imports or extensions of existing APIs, for example: cairo_create should remain the same glGenBuffers should remain the same gtk_window_new should remain the same dlopen should

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Anthony Walter
If you were going to patch I'd also consider allowing: program Test; var B, C: Integer = 0, 1; // sets B = 0, and C = 1 begin end. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

[fpc-devel] What's the status of Maciej's Smart Pointer enhancements?

2018-04-29 Thread Anthony Walter
Here is a video overview of this message I've run into an almost must have use case for FPC smart pointers as described and implemented by Maciej. I wanted to know from the people who make decision about what to merge, what's the status of ro

Re: [fpc-devel] What's the status of Maciej's Smart Pointer enhancements?

2018-04-30 Thread Anthony Walter
Okay great. Thanks for the information. I'll experiment with the smart pointers and their potential performance impact. In the interim I've created a solution using the approach of records containing private reference counted interfaces. Here is an example of my JSContext record: 1. JSContex

Re: [fpc-devel] What's the status of Maciej's Smart Pointer enhancements?

2018-04-30 Thread Anthony Walter
Thanks for replying. I'd like to chime in with a few thoughts.. I believe manged types beyond string, dynamic array, and interface as important. In my use case worked around the problem by using records with private interface as I already mentioned. This solution is less than optimal as it require

Re: [fpc-devel] What's the status of Maciej's Smart Pointer enhancements?

2018-04-30 Thread Anthony Walter
Okay, I found a nice work around to allow for circular references on record types: record helpers type JSValue = record ... end; JSObject = record ... end; JSValueHelper = record helper for JSValue function AsObject: JSObject; end; JSObjectHelper= record helper for JSObje

Re: [fpc-devel] NewPascal plans, Generics.Collections and FPC trunk

2018-05-02 Thread Anthony Walter
Maciej, I am sorry to see you go. I understand sometimes people here can seem stubborn or rude, and I hope in the end cooler heads prevail. The contributions you've made to the sparta docked form designer and smart pointers are much appreciated by me personally. From me to you, thank you.

Re: [fpc-devel] Why/how does the compiler have a non-trivial numberofmemory leaks after over two decades of development?

2018-07-30 Thread Anthony Walter
I thought I'd add a point about compiling and memory. On the Raspberry Pi, I know for a fact that building the compiler can fail after a while due to insufficient memory. When this happens the problem with no memory doesn't present itself as such. Rather you're left with an error indicating a probl

Re: [fpc-devel] Aligned dynamic arrays

2019-03-28 Thread Anthony Walter
Ryan, this is just a thought. Do you need the flat memory address to start on an even 4 KB boundary or are you okay with the memory address starting at any DWORD address and spanning an even 4 KB after that address? In the latter case I have an easy solution for you. If the former I am unsure how

Re: [fpc-devel] Aligned dynamic arrays

2019-03-28 Thread Anthony Walter
Here is a brief follow up. I am working on other projects at the moment, but I am confident this a simple solution. Please tell me if this somehow will not fit you needs. Create a new type that is compatible with Array where Array = type array of T. Define implcit conversions between the to types

Re: [fpc-devel] Aligned dynamic arrays

2019-03-28 Thread Anthony Walter
Here is the full implementation of aligned arrays, let me know if it works for you. https://www.getlazarus.org/arrays/ Here is another example: uses AlignArrays; procedure Test; var VertexData: TAlignedArray; V: PVec3; I: Integer; begin VertexData.Length := 100; // page sized and alig

Re: [fpc-devel] Aligned dynamic arrays

2019-03-29 Thread Anthony Walter
Gareth, There is a bounty for this? I wonder if my solution is acceptable. Also, my solution, or any for that matter, could be enhanced to make the alignment size configurable per each array aligned array. That is, memory alignment starting position and page size could be defined by each array. T

Re: [fpc-devel] Aligned dynamic arrays

2019-03-29 Thread Anthony Walter
Ryan, actually ... A.Length := 1; A[0].X := 100; ... does work in my implementation. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Aligned dynamic arrays

2019-03-29 Thread Anthony Walter
Inside the type I have: TAlignedArray = record public type TReference = ^T; TValue = T; ... procedure Push(const Item: TValue); function Pop: TValue; property Length: Integer read FLength write SetLength; property Reference[Index: Integer]: TReference read G

Re: [fpc-devel] Aligned dynamic arrays

2019-03-30 Thread Anthony Walter
Denis, The more that I think about it, the more I am believe that using my approach is probably the best solution. Hear me out please. First, it would be fairly easy to implement copy on write logic with a custom record class. Second, because it's Pascal code, it's entirely possible to fully cus

Re: [fpc-devel] Aligned dynamic arrays

2019-03-30 Thread Anthony Walter
1) In you example you are writing this with normal arrays: A[0].X := 0; And in my implementation it's exactly the same. Regarding writing the entire type directly A[0]^ := V; If using the caret symbol ^ or an Item property is a deal breaker, then this can be simplified using a custom smart poin

Re: [fpc-devel] Aligned dynamic arrays

2019-03-30 Thread Anthony Walter
You are not required to dereference pointers to write to them. var P: PPoint; begin P := AlignedArray[0]; P.X := 3; // can be okay AlignedArray[0].Y := 4; // can be okay as well ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://li

Re: [fpc-devel] Aligned dynamic arrays

2019-03-30 Thread Anthony Walter
On a related note, since a lot of the discussion here seems related to vector types, I seem to recall someone recently published an mmx, sse1/2/3/4, simd set of routines related to vector operations. I don't use much asm other than just being familiar with the basics of ia32 from long ago, but I do

Re: [fpc-devel] Aligned dynamic arrays

2019-03-30 Thread Anthony Walter
Oh and might as well add dot product and cross product for vectors as well > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Class management operators

2019-05-24 Thread Anthony Walter
Ryan, I believe the compiler already has management support for complex types. That is for BOTH records and classes. All that is required is you have a supported version of the compiler and you add the sugar in the form of AddRef, Initialize, and Finalize. See this page for more information: http:

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Anthony Walter via fpc-devel
Thank you Ryan and Sven. Your work is much appreciated as usual. However, Michael beat me to it in asking how this feature is useful. I am sure there might be use cases, but for right now I am coming up without any real advantages. Could anyone with better insight than me please explain? _