I'm wondering whether we can make use of the contrary sense implied by the word "but", and have it apply specifically to cases where something is being overridden. In cases where there isn't something to override we could use a different word, such as "with".

     $x = Tue but "Today";
replaces the normal or default Str value of Day::Tue with "Today".

     $x = "Today" with Day::Tue;
mixes in a new Day method where none existed before.

Saying: Tue with "Today", or "Today" but Tue, could warn you that your expectations are back to front. As well, by allowing the meanings to be closer to the English use of "but" or "with", the code can better suggest its intent.

Actually, I'm not sure where is the most practical place to draw the line. Lots of things will have default stringifications, say, that may not always merit the contrary force of "but". Maybe "but" should be needed only when a method has already been mixed in anonymously. So: $x = Tue with "Today"; $y = $x but "Tomorrow".


Reply via email to