I want to change show for Symbol, Rational, and Bool. Till now, I simply 
overwrote the existing methods. This works great. I get what I want, even 
in warn and error and string interpolation, etc. It works flawlessly on 
v0.4, v0.5, and v0.6. But, this changes the behavior for everyone. So, I 
want to get the same effect through different means that do not affect 
other code. Any idea about how to do this ?

One solution is to copy a large amount of  base code that uses print, 
write, show, etc. renaming these functions. Other than changing 15 or 20 
lines for Symbol, etc., the code is unchanged. This is works more or less, 
but is obviously a fragile, bad solution.

Another idea is to make a subtype of IO that wraps subtypes of IO. I am 
allowed to write methods for show for this new type. This is turning out to 
be complicated and unworkable.

Another vague idea is to make a new mime type. Another is to copy IOStream 
as another type, so that I only have to write methods for Symbol, Rational 
and Bool again.

 

Reply via email to