help: make all relevant words infer

db4
Slava Pestov 2009-02-09 01:47:31 -06:00
parent e3f6ee0792
commit fe59b4d24d
3 changed files with 9 additions and 6 deletions

View File

@ -1,11 +1,11 @@
! Copyright (C) 2005, 2008 Slava Pestov. ! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays io io.styles kernel namespaces make USING: accessors arrays io io.styles kernel namespaces make
parser prettyprint sequences words words.symbol assocs parser prettyprint sequences words words.symbol assocs
definitions generic quotations effects slots continuations definitions generic quotations effects slots continuations
classes.tuple debugger combinators vocabs help.stylesheet classes.tuple debugger combinators vocabs help.stylesheet
help.topics help.crossref help.markup sorting classes help.topics help.crossref help.markup sorting classes
vocabs.loader ; vocabs.loader call ;
IN: help IN: help
GENERIC: word-help* ( word -- content ) GENERIC: word-help* ( word -- content )
@ -125,7 +125,7 @@ SYMBOL: help-hook
help-hook global [ [ print-topic ] or ] change-at help-hook global [ [ print-topic ] or ] change-at
: help ( topic -- ) : help ( topic -- )
help-hook get call ; help-hook get call( topic -- ) ;
: about ( vocab -- ) : about ( vocab -- )
dup require dup require

View File

@ -25,3 +25,6 @@ TUPLE: blahblah quux ;
[ "a string, a fixnum, or an integer" ] [ "a string, a fixnum, or an integer" ]
[ [ { $or string fixnum integer } print-element ] with-string-writer ] unit-test [ [ { $or string fixnum integer } print-element ] with-string-writer ] unit-test
\ print-element must-infer
\ print-topic must-infer

View File

@ -4,7 +4,7 @@ USING: accessors arrays definitions generic io kernel assocs
hashtables namespaces make parser prettyprint sequences strings hashtables namespaces make parser prettyprint sequences strings
io.styles vectors words math sorting splitting classes slots fry io.styles vectors words math sorting splitting classes slots fry
sets vocabs help.stylesheet help.topics vocabs.loader quotations sets vocabs help.stylesheet help.topics vocabs.loader quotations
combinators ; combinators call ;
IN: help.markup IN: help.markup
PREDICATE: simple-element < array PREDICATE: simple-element < array
@ -27,8 +27,8 @@ GENERIC: print-element ( element -- )
M: simple-element print-element [ print-element ] each ; M: simple-element print-element [ print-element ] each ;
M: string print-element [ write ] ($span) ; M: string print-element [ write ] ($span) ;
M: array print-element unclip execute ; M: array print-element unclip execute( arg -- ) ;
M: word print-element { } swap execute ; M: word print-element { } swap execute( arg -- ) ;
M: f print-element drop ; M: f print-element drop ;
: print-element* ( element style -- ) : print-element* ( element style -- )