modern-pascal/modern-pascal-introduction

Should Text.ReadLn be Text.ReadLine?

Closed this issue · 2 comments

I don't know Pascal, but I wonder if this line should have Text.ReadLine instead of Text.ReadLn.

This question is prompted by the documentation of TTextReader.

If I'm wrong, feel free to close this issue without reply.

Ah, I see it is confusing -- because the text talks about a different TTextReader class. It talks about Castle Game Engine TTextReader, which has ReadLn, not ReadLine.

By accident, FPC and Delphi standard libraries have defined a class with the exact same name and very similar purpose. ( I think it didn't exist many years ago when I invented TTextReader in CGE? But I may be wrong. )

I added a link to https://castle-engine.io/url (that in turn links to Castle Game Engine API docs of TTextReader) to clarify that this text is about CGE feature, not standard Pascal feature. In the long run, we should rename in CGE the class to TCastleTextReader (it has the benefit of supporting URLs over standard one) to avoid confusion, added to TODO. And then I will change the modern_pascal text too, so it will talk about TCastleTextReader and thus be more obvious.

Done,

  • we have now TCastleTextReader (and TCastleTextWriter) in Castle Game Engine,
  • and I updated the text to mention TCastleTextReader,

so it is not confusing anymore. For compatibility, for some time, we will keep aliases in CGE:

  TTextReader = TCastleTextReader deprecated 'use TCastleTextReader instead';
  TTextWriter = TCastleTextWriter deprecated 'use TCastleTextWriter instead';

Thank you again for reporting!