Paste: stack declaration problem
Author: | JimMack1963 |
Mode: | factor |
Date: | Sun, 25 Apr 2010 19:11:33 |
Plain Text |
USING: editors fry io io.encodings.utf8 io.files io.files.temp
io.files.unique.private io.launcher io.pathnames kernel nested-comments
prettyprint sequences strings ;
IN: learn
(* I've got
"complicated stuff" [ dup print ] with-editor
working, but was hoping to be able to genericize "ed" as a debug tool to cut down on typing
and I ran into stack declaration problems I don't seem to experiment my way out of.
*)
: with-capture
[ random-name ] dip append temp-file
[ [ utf8 ] curry dip
'[ _ call ] with-file-writer ] keep ; inline
: with-editor ".txt" with-capture 0 edit-location ;
: with-browser ".html" with-capture
[ <pathname> . ]
[ [ { "cmd.exe" } ] dip "/c \"" "\"" surround suffix run-detached drop ] bi ;
GENERIC: ed
M: string ed [ print ] with-editor ;
(* can't parse:
Stack effect declaration is wrong
inferred ()
declared ()
*)
GENERIC: ed2
M: string ed2 [ dup print ] with-editor ;
(* can't parse:
Stack effect declaration is wrong
inferred ()
declared ()
*)
GENERIC: ed3
M: string ed3 [ print ] with-editor ;
(* can't run:
Quotation's stack effect does not match call site
quot [ print ]
call-site ()
*)
New Annotation