Help for generic words and classes now lists methods

db4
Slava Pestov 2008-11-22 03:37:46 -06:00
parent 1162ee6b0f
commit 208a54e08e
2 changed files with 32 additions and 6 deletions

View File

@ -58,15 +58,36 @@ M: word article-title
append append
] if ; ] if ;
M: word article-content <PRIVATE
: (word-help) ( word -- element )
[ [
\ $vocabulary over 2array , {
dup word-help % [ \ $vocabulary swap 2array , ]
\ $related over 2array , [ word-help % ]
dup get-global [ \ $value swap 2array , ] when* [ \ $related swap 2array , ]
\ $definition swap 2array , [ get-global [ \ $value swap 2array , ] when* ]
[ \ $definition swap 2array , ]
} cleave
] { } make ; ] { } make ;
M: word article-content (word-help) ;
<PRIVATE
: word-with-methods ( word -- elements )
[
[ (word-help) % ]
[ \ $methods swap 2array , ]
bi
] { } make ;
PRIVATE>
M: generic article-content word-with-methods ;
M: class article-content word-with-methods ;
M: word article-parent "help-parent" word-prop ; M: word article-parent "help-parent" word-prop ;
M: word set-article-parent swap "help-parent" set-word-prop ; M: word set-article-parent swap "help-parent" set-word-prop ;

View File

@ -285,11 +285,16 @@ M: f ($instance)
: $see ( element -- ) first [ see ] ($see) ; : $see ( element -- ) first [ see ] ($see) ;
: $see-methods ( element -- ) first [ see-methods ] ($see) ;
: $synopsis ( element -- ) first [ synopsis write ] ($see) ; : $synopsis ( element -- ) first [ synopsis write ] ($see) ;
: $definition ( element -- ) : $definition ( element -- )
"Definition" $heading $see ; "Definition" $heading $see ;
: $methods ( element -- )
"Methods" $heading $see-methods ;
: $value ( object -- ) : $value ( object -- )
"Variable value" $heading "Variable value" $heading
"Current value in global namespace:" print-element "Current value in global namespace:" print-element