generic slots and dynamic type

Mildred Ki'Lya ml.mildred593 at gmail.com
Wed Oct 7 17:04:44 UTC 2009


Hi,

(French at the end)

I'm currently working a bit on Lisaac introspection, and I just add an
idea that would make it easier to implement.

The idea is that you could write a slot with a type parameter having the
Strict keyword, like:

  - slot param:Strict E <- ...

That would execute the slot with E as the dynamic type of the argument.
For example, to know the dynamic type of an object (SELF), we can just
write:

  - dynamic_type_of object:Strict E :E <- E;

Why I want this is to be able to create an object VIEW_OBJECT_TYPE(E)
that will give introspection access to an object whose dynamic type is
E. I have something like (look at the create slots):

*Example:*

Section Header

  + name := VIEW_OBJECT;

Section Public

  - create object:Strict E :VIEW_OBJECT <-
  (
    VIEW_OBJECT_TYPE(E).create object
  );

  - dynamic_type static_type:E :E <- deferred;
  // The parameter static_type is just there to set the
  // return type as a parameter type. That can be useful
  // if the dynamic type doesn't inherit from OBJECT

  ...



Section Header

  + name := VIEW_OBJECT_TYPE(E);

Section Inherit

  + parent_view_object :Expanded VIEW_OBJECT;

Section Public

  + object :Strict E;

  - create object:Strict E :VIEW_OBJECT_TYPE(E) <-
  (
    clone.make object
  );

  - make object_:Strict E :VIEW_OBJECT_TYPE(E) <-
  (
    object := object_;
  );

  - dynamic_type static_type:F :F <-
  ( + result :F;
    result ?= E
  );

  ...


*Implementation note:*

I suppose we'd have to add a keyword to ITM_TYPE_PARAMETER, and have as
much PROFIL_SLOT per slot as there are possible dynamic type. And when
the slot is called, there would be a SWITCH for each PROFIL. That's just
supposition, and I don't know if it would really work like that.

------------------------------------------------------------------------

Je travaille sur un système d'introspection sur Lisaac, et j'avais une
idée qui permettrait d'implémenter plus facilement pleins de trucs.

L'idée serait de pouvoir écrire un slot avec un type paramétrique Strict:

  - slot param:Strict E <- ...

Cela exécuterait le slot en associant E au type dynamique du paramètre.
Cela permettrait par exemple de connaître le type dynamique d'un object
(SELF) très simplement:

  - dynamic_type_of object:Strict E :E <- E;

La raison principale pour laquelle je trouve ça intéressant, c'est que
ça me permettrait de créer un objet de type VIEW_OBJECT_TYPE(E) qui
encapsulerait une instance de E et y associerait des opérations
d'introspections. Bien sûr, E serait le type dynamique de l'objet, et
pas son type statique. Voir l'example donné plus haut (regarder les
slots create).



*Note d'implémentation:*

Cela veut dire introduire un mot clef dans ITM_TYPE_PARAMETER. Et je
suppose avoir autant de PROFIL_SLOT correspondant à un slot qu'il est
possible d'avoir de types dynamiques. et lors de l'appel, on aurait un
SWITCH sur chacun des PROFIL. Enfin, je ne sais pas si ça peux marcher
comme ça.


Mildred

-- 
Mildred Ki'Lya
╭───────── mildred593@online.fr ──────────
│ Jabber, GoogleTalk: <mildred at jabber.fr>
│ Website: <http://ki.lya.online.fr>           GPG ID: 9A7D 2E2B
│ Fingerprint: 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 9A7D 2E2B

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/lisaac-devel/attachments/20091007/d97ff9a6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/lisaac-devel/attachments/20091007/d97ff9a6/attachment.pgp>


More information about the Lisaac-devel mailing list