InlineObjectClassDescription.st
changeset 24240 5a8ca163fbfc
parent 24239 41cb789c936e
child 24517 5aaa5e876057
equal deleted inserted replaced
24239:41cb789c936e 24240:5a8ca163fbfc
    40 
    40 
    41 documentation
    41 documentation
    42 "
    42 "
    43     inline objects are an experimental feature in ST/X
    43     inline objects are an experimental feature in ST/X
    44     (and currently not used by the system).
    44     (and currently not used by the system).
    45     The are created by the parsers/compilers with the following
    45     Inline literal objects are created by the parsers/compilers with the following
    46     syntax:
    46     syntax:
    47         #{
    47         #{
    48             <slotName1>: value-expression .
    48             <slotName1>: value .
    49             <slotName2>: value-expression .
    49             <slotName2>: value .
    50             ...
    50             ...
    51         }
    51         }
    52     where value-expressions are separated by periods   
    52     where each value is a literal, separated by period from the next   
    53     i.e. similar to the brace-array construct { expr1 . expre2... }
    53     i.e. similar to the brace-array construct { expr1 . expr2... }
    54 
    54 
    55     For every inline object, an anonymous class is created,
    55     For every inline object, an anonymous class is created,
    56     providing getters and setters for the slots.
    56     providing getters and setters for the slots.
    57     (if literal objects are immutable (which is the default), 
    57     (if literal objects are immutable (which is the default), 
    58      no setters are generated)
    58      no setters are generated)
    64     All such created classes will be subclasses of me.
    64     All such created classes will be subclasses of me.
    65 
    65 
    66     [example:]
    66     [example:]
    67         |foo|
    67         |foo|
    68 
    68 
    69         foo := #{ foo: 'foo value' .
    69         foo := #{ 
       
    70                  foo: 'foo value' .
    70                  bar: 'bar value' .
    71                  bar: 'bar value' .
    71                  baz: 'and obviously: a baz value' }.
    72                  baz: 'and obviously: a baz value' .
       
    73                 }.
    72         foo bar.
    74         foo bar.
    73         foo baz.
    75         foo baz.
    74         foo inspect.
    76         foo inspect.
    75 "
    77 "
    76 ! !
    78 ! !