枚举对象的属性

时间:2014-06-25 07:21:42

标签: rebol rebol2

我有一个对象,我希望查看所有属性,但使用probe打印出我无法读取的页面和信息页面,并使用mold仅打印出第一个位。

>> mold input
== {make object! [
    type: 'face
    offset: 20x20
    size: 400x150
    span: none
    pane: none
    text: "Text"
    color: 25...

2 个答案:

答案 0 :(得分:1)

我习惯在对象上使用help,如

>> help system
SYSTEM is an object of value:
   version         tuple!    2.7.8.3.1
   build           date!     1-Jan-2011/16:39:07-8:00
   product         word!     View
   core            tuple!    2.7.8
   components      block!    length: 60
   words           object!   [unset! error! datatype! context! native! action! ...
   license         string!   {REBOL End User License Agreement IMPORTANT. READ ...
   options         object!   [home script path boot args do-arg link-url server...
   user            object!   [name email home words]
   script          object!   [title header parent path args words]
   console         object!   [history keys prompt result escape busy tab-size b...
   ports           object!   [input output echo system serial wait-list]
   network         object!   [host host-address]
   schemes         object!   [default Finger Whois Daytime SMTP ESMTP POP IMAP ...
   error           object!   [throw note syntax script math access command resv...
   standard        object!   [script port port-flags email face sound error por...
   view            object!   [screen-face focal-face caret highlight-start high...
   stats           native!   System statistics. Default is to return total memo...
   locale          object!   [months days]
   user-license    object!   [name email id message]

而不是第一个对象,您现在应该使用 words-of

>> help words-of
USAGE:
    WORDS-OF value

DESCRIPTION:
     Returns a copy of the words of a function or object.
     WORDS-OF is a function value.

ARGUMENTS:
     value -- (Type: any)
>> probe words-of system
== [version build product core components words license options user script console ports network schemes error standard view
   stats locale user-license]

答案 1 :(得分:0)

您可以使用first获取对象的所有属性,>> ? first USAGE: FIRST series DESCRIPTION: Returns the first value of a series. FIRST is an action value. ARGUMENTS: series -- (Type: series pair event money date object port time tuple any-function library struct event) 可以处理大量类型,包括对象。传递对象时,它返回表示属性的单词列表。

first input

所以在我的例子中,>> probe first input [self type offset size span pane text color image effect data edge font para feel saved-area rate show? options parent-face old-offset old-size line-list changes face-flags action state access style alt-action facets related words colors texts images file var keycode reset styles init multi blinker pane-size dirty? help user-data flag s doc] 给出了以下内容:

{{1}}