When evaluating a feature I'm more inclined to ask "what's the benefit?" rather than "is it harmless?". In this case I can see no benefit, but actually some harm since the very existence require people to learn about it, at least when they happen to come across it in some code.
The syntax is not good since it has no relation with the normal meaning of the shift operators, which means that people are forced to look it up in the docs and remember it. "write" is much better since it in itself fairly well describes what's going on.
Another bad thing with Stdio.File.`<< is that it's a very incomplete attempt at implementing the C++ stream interface. There's no corresponding Stdio.File.`>> as one would expect, and no objects overloads `<< and `>> for marshalling (there's _encode, _decode and _sprintf for that). Thus it's just an oddball function that's completely out of place in Stdio.File.
But as you say this lfun is not in the way, so there's no real need to remove it in the near future so that #pike is required. It's enough to deprecate it in the manual to limit the risk that new code actually uses it.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-04-23 12:39: Subject: lfun::`+=()
I don't see why being able to write
fd << "Hello world.";
instead of
fd->write("Hello world.");
is a problem of any sort. Sure, it's not terribly useful, but there is little likelihood of any serious confusion: `<< has no predefined semantics for anything other than ints, so it is pretty much free to do anything as long as this is properly documented for the class that defines an lfun::`<<. The only issue being whether this leads to a convenient notation that makes some sense once you know how it works (which is of course rather subjective).
/ rjb