icioo man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

icioo(1)							      icioo(1)

NAME
       icioo - ICI object-oriented programming

DESCRIPTION
       <I>This	page  is out of date. A whole new OO mechanism has been avail‐
       able since ICI 3.0.</I>

       Ici's support for object-oriented programming is very simple.   Inheri‐
       tance is already provided through the ability to extend one structure's
       scope by defining a super structure for it.  This can  be  done	either
       with the notation:

	   static  my_instance = [struct:my_parent x, y ];

       or with the functional notation

	   static  my_instance = super(my_parent, x, y);

       although	 it's  probably	 better to set up an atomic (`class') variable
       for the super structure, and use that:

	   @my_parent

       to refer to an atomic (unchanging) version of your `class' struct.

       The method call is achieved by an extension of the normal function call
       operator	 "()".	 When  the  "()" operand is a function identifier, the
       function is called in the usual way with the supplied  parameter	 list.
       But if the "()" operand is a pointer object keyed by a function identi‐
       fier, the function is called with the object pointed-to	passed	as  an
       implicit first parameter.

       The  binary  operator `@' forms such a pointer from an aggregate object
       (usually a struct) and an identifier (i.e. a  member  of	 the  struct).
       This is the same basic technique used for dynamic dispatch in languages
       like Smalltalk and Objective-C.

       Here is a little example showing a few ways this can be used.  Note the
       occasional use of literal functions.

       static
       showtype(any, label)
       {
	   printf("%s is a %s\n", label, typeof(any));
       }

       /*
	* Class definition.
	*/
       static Point =
       [struct
	   p_x	   = 0.0,
	   p_y	   = 0.0,
	   p_swap  = [func (self) { self.p_x <=> self.p_y; } ],
	   p_print = [func (s) { printf("Pt <%g %g>\n", s.p_x, s.p_y);} ],
	   p_what  = showtype,
       ];

       static p1 = struct(@Point);  /* Set super struct to be atomic Point */

	   p1.p_x = 1.2;
	   p1.p_y = 3.4;

	   p1@p_what("p1");
	   p1@p_print();
	   p1@p_swap();
	   p1@p_print();

       Which produces this output when run:

       p1 is a struct
       Pt <1.2 3.4>
       Pt <3.4 1.2>

       In summary, method calls depend on:

       ·       Ici's  super  linkage to provide the normal OO inheritance name
	       search mechanism.

       ·       The `@' binary operator to  form	 a  keyed  pointer  that  will
	       select the named member of the struct.

       ·       The  "()"  (call)  operator's  special treatment of a function-
	       keyed pointer.

       The syntax is the natural result of using ici's normal language facili‐
       ties.

								      icioo(1)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net