> how should byte array streams taken an encoding?
They don't take an encoding from the stack. You set the encoding.
GENERIC: ascii ( object -- object )
M: path ascii ( path -- path ) \ ascii >>encoding ;
M: stream ascii ( stream -- stream ) \ ascii >>encoding ;
M: string ascii ( string -- path ) <path> ascii ;
If you have a stream on the stack you can set it's encoding.
You can improve upon the above code:
GENERIC: set-encoding
M: set-encoding { path encoding -- path } >>encoding ;
M: set-encoding { stream encoding -- stream } >>encoding ;
M: set-encoding { string encoding -- path } >r <path> r> set-encoding ;
Then, for each encoding you simply have:
: ascii ( object -- object ) \ ascii set-encoding ;
Ed
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk