Akim Demaille a écrit :
> Hi Claire people!
I Akim,
A few words about the inspector :
The inspector is interactive but has some subtleties. Mostly, from the
claire interpreter you'll ask for the inspection of an entity with the
ask mark (?), for instance you can explore the definition of the slot
class :
default memory size by 2^3 and 2^3, Loglist = 21
-- CLAIRE run-time library v3.3.37 [os:Darwin-ppc-g++4.0.1, C++:g++]
--
[5044]claire> ? slot
eval[1]> 1: isa = class
2: name = claire/"slot"
3: comment = "slot"
4: slots = (isa @ object, module! @ restriction, comment @
restriction, domain @ restriction, range @ restriction,
selector @ restriction, mClaire/srange @ slot, default @ slot,
mClaire/index @ slot)
5: superclass = restriction
6: subclass = {}
7: ancestors = list<class>(void, any, object, system_object,
restriction, slot)
8: descendents = set<class>(slot)
9: mClaire/evaluate = #'self_eval_ClaireObject
10: open = 1
11: instances = (isa @ object, name @ symbol, module! @ symbol,
mClaire/definition @ symbol, value @ symbol,
mClaire/freeme? @ freeable_object, name @ class, comment @ class,
slots @ class) ...
12: mClaire/prototype = (0, 0, 0, list<type>(), any, 0, 0, unknown, 0)
13: params = ()
14: mClaire/dictionary = (unknown, unknown, unknown, self_print @
restriction, blob! @ void, Serialize/ibserialize @ restriction,
self_eval @ object, iClaire/equip @ list<type>(any, list), echo @
any) ...
15: ident? = true
16: if_write = unknown
17: mClaire/dispatcher = ()
inspect>
The 'inspect>' prompt tells you that you are in the inspector toplevel
(enter 'q' to come back the interpreter). To explore deeper through
the printed relations you can enter the associated index and then use
'up' to come back to the explored entity.
When you enter something different from an index, 'up' or 'q' then the
inspector will apply on the entity that is read without evalution. So
if its a symbol (a class name, a porperty name...) the exploration
applies on that entity, if its a bag (list, set, tuple) then you'll
explore tits content, otherwise you will inspect the meta instruction
built by the Reader before its evaluation (this later feature is only
available in XL claire).
> - do slots in Claire contain their name?
>
> - I seem to understand that not all slots are reified? So maybe I
> misunderstood and Claire's object model is more like "symbol ->
> object" and if that object turns out to be derive from "slot", then it
> has a specific handling?
>
> - can object share reified slots?
>
> More generally, where could I find a model (say UML or whatever) of
> Claire's world? The documentation pays special attention to the
> functions, and AFAICS, gives little attention to the object hierarchy.
I'm afraid there is no UML model available. Using the reflexion of the
language it could however be generated on the fly provided an
appropriate piece of code... I suggest that, for the moment, you use
the inspector to travel accross relation that exists between system
objects.
In claire, both slot and method inherit from the class relation. A
relation associates a name to a domain (a list of type). For slots,
the domain contain a single type which is the class in which the slot
is defined. The interpreted code always use the relation to evaluate a
slot access/update but the compiler will transform it either in a call
to an ad hoc deamon function or a standard C++ indirection when the
access/update does not trigger complex things.
The role of the relation class is central and drive whether it can be
extended, whether it has an inverse relation if a rule is associated
to it or even if the update is defeasible.
The model in claire is better desrcibed as an "entity -> relation"
than a "symbol -> object".
You're at the right place ! You're welcome to discuss about claire
model here.
Regards,
Sylvain