Is it possible to extend write or str with new types?
So you can write:
var x: TMyType;
writeln(x:1:3);
No. Note that Write[Ln] is mapped to compilerproc for the type of every given expression (argument). So, for:
WriteLn(1,'str');
it will be translated to:
fpc_writetext_shortint(1);
fpc_writetext_shortstr('str');
fpc_writeln_end;
real name might differ, but the concept is the same. Use fpc -al to know the actual translation.