[Gambas-bugtracker] Bug #1703: _print(stream) as an object special function

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Thu Jan 16 13:21:55 CET 2020


Comment #5 by Benoît MINISINI:

PRINT is there for printing text, not for sending the contents of an object in an unexpected way (i.e. in a format that is requested by a specific communication protocol). It's the same horrible idea as the "<<" C++ operator used for writing to a stream. The initial semantic is hijacked.

Of course, I can't prevent anyone to hijack _get() and _put() is such a way that it does something completely unrelated with a array-like access, or any other special method. So maybe I can add the _print() special method, even I'm strongly against what you want to do with it.

It's the other way: if you want to deal with objects through a specific communication, it's the class that implements the communication protocol that must have a method to deal with objects. Like the Paint.Begin() method.

More information about the Bugtracker mailing list