eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'InlineObject::InlineObjectClassDescription':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: InlineObjectClassDescription (private in InlineObject

This class is only visible from within InlineObject.

Inheritance:

   Object
   |
   +--Behavior
      |
      +--ClassDescription
         |
         +--InlineObject::InlineObjectClassDescription

Package:
stx:libbasic
Category:
Kernel-Classes
Owner:
InlineObject

Description:


inline objects are an experimental feature in ST/X
(and currently not used by the system).
Inline literal objects are created by the parsers/compilers with the following
syntax:
    #{
        <slotName1>: value .
        <slotName2>: value .
        ...
    }
where each value is a literal, separated by period from the next   
i.e. similar to the brace-array construct { expr1 . expr2... }

For every inline object, an anonymous class is created,
providing getters and setters for the slots.
(if literal objects are immutable (which is the default), 
 no setters are generated)

You cannot add any semantic (i.e. methods) to inline objects -
they are only useful as containers with a nicer protocol
as compared to dictionaries or arrays.

All such created classes will be subclasses of me.

[example:]
    |foo|

    foo := #{ 
             foo: 'foo value' .
             bar: 'bar value' .
             baz: 'and obviously: a baz value' .
            }.
    foo bar.
    foo baz.
    foo inspect.

copyright

COPYRIGHT (c) 2009 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Instance protocol:

accessing
o  setName: newName
because classes are shared, multiple uses may try to use different names.
I am anonymous anyway, so the name is only kept for the user's convenience
(i.e. to provide a nicer printString)
Only remember the very first one.
(maybe we should concatenate names instead).

Usage example(s):

     |o1 o2|

     o1 := InlineObject slotNames:#('foo' 'bar' 'baz' 'bla') values:#(1 2 3 4).
     o1 class setName:'myFoo'.
     o2 := InlineObject slotNames:#('foo' 'bar' 'baz' 'bla') values:#(1 2 3 4).
     o2 class setName:'myFoo2'.
     o1 inspect.
     o2 inspect.

instance creation
o  values: slotValues
return a new inline object instance of myself,
given slot values (must be in my inst-slot order).
I must be the class of an existing concrete inline object,
not the (abstract) InlineObject class itself.

Usage example(s):

     |proto protoClass|

     proto := InlineObject slotNames:#('foo' 'bar' 'baz') values:#(1 2 3).
     protoClass := proto class.
     protoClass setName:'Foo'.
     (protoClass values:#( 10 20 30 )) inspect.

queries
o  name
although inline objects usually have no name, we return something
useful here - there are many places (inspectors) where
a classes name is asked for.

o  nameSpace
(comment from inherited method)
should be redefined in concrete subclass(es)

o  package
return libbasic, so the methods of my subclass-instances (i.e. the inline objects)
are not seen as extensions in the browser)



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:23:23 GMT