[fpc-pascal] Stack alias for ARC like memory management?

Ryan Joseph ryan at thealchemistguild.com
Wed Apr 25 10:35:56 CEST 2018



> On Apr 25, 2018, at 3:22 PM, Marco van de Voort <marcov at stack.nl> wrote:
> 
> Most seem to be covered already by having records-with-methods. The only
> issue is that it is a different kind of  "object”.

I like C++ because because you opt into stack or heap at any point. If you use a record then you’re stuck with a record. Objects are the better option but they’ve been neglected (missing interfaces amongst others) and the calling conventions are not the same (using new for example).

> 
>> So many of the stupid memory management patterns we use in Pascal could
>> be replaced if the language had some good support for it.  C++ does it and
>> on the other end ARC languages do it for you, albeit at a performance
>> loss.
> 
> I think if you want to pursue this, you must be much more concrete. Both the
> benefits and the potential pitfalls.

Look at the little code snippet I just posted using code from another post. It’s a good example of the kind of pattern I wanted to optimize. It’s save a little block of code and a call to GetMem which is good considering how little effort goes into the keyword. In functions called from tight loops it’s actually a big save.

> 
>> Maybe I don?t know who the market for Pascal is anymore because to me it
>> seems like a legacy language which is being kept alive by a small group of
>> hobbyist but never actually used for any real world application
> 
> This is patently false. Both Delphi and FPC are used professionally.

Good news. :) That’s how it feels to me though. People are honestly confused when you tell them you use Pascal in 2018. I can’t point to where it’s a good low-language but then they remind of c++!

> 
>>  I?ve already pretty much given up writing Mac apps with Pascal because
>> it?s so hard to keep up to date and Swift is better than Objective-C but
>> I?d like to keep using it for games if I can.  At the end of the day I
>> really want to be able to say at least Pascal is a good low-level language
>> for writing fast code but in the face of C++ that?s kind of dubious claim.
> 
> The dubious claim is the suggestion that detail language features are the
> main cause for language uptake. It isn’t.

True. Pascal is basically dead on Mac because Apple has made it so hard to access their system frameworks. I made a parser to convert objective-c to Objective Pascal but it’s such a hassle to keep updated and Swift is replacing Objective-C anyways. Developers tools are hard to use outside of Xcode also.



Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list