File langprocs.icn

Summary


 $Id: langprocs.icn,v 1.8 2009-10-28 21:07:18 to_jafar Exp $

 This file is in the public domain.

 Author: Robert Parlett (parlett@dial.pipex.com)
   Addition of call_by_name by Steve Wampler (sbw@tapestry.tucson.az.us)
   Changes to use standard Unicon functions.

Procedures:
call_by_name, cast, clone, equals, find_method, generate_class_members, generate_member_names, generate_record_names, get_class, get_class_member, get_class_name, get_id, get_name, get_type, hash_code, hash_string, is_instance, object_clone, object_equals, object_hash_code, object_to_string, to_string

Imports:
util

This file is part of the lang package.

Source code.

Details
Procedures:

call_by_name(f_name, f_args)


 Invoke a procedure by string name.
 This is a convenience procedure for invoking a procedure given its
   string name.  The primary convenience is that it maps external
   package procedure names into internal form for string-invocation.
   An example of its use would be to call the constructor for some
   class identified by its string name at runtime.

 @param f_name -- Name of procedure
 @param f_args... -- arguments to pass to the procedure, if any
 @return result of invocation


cast(object, other)


 Cast the fields of this object to another object o.


clone(o, seen)


 Clone the given object


equals(x, y, seen)


 Compare this object with another by recursively comparing all
 members of the object.


find_method(obj, method_name)


 Look for the method in the given object.

 @param obj         The object in which to find the method
 @param method_name The name of the method
 @return            a procedure object, being the method
 @fail              if the method cannot be found.


generate_class_members(object)


 Generate the values of the member variables of an object.  All other values/objects
 will cause failure.


generate_member_names(object)


 Generate the names of the member variables of an object. All other values/objects
 will cause failure.


generate_record_names(object)


 Generate the record names for a record.  All other values/objects will cause
 failure.


get_class(object)


 Get the Class object for this object


get_class_member(object, n)


 Return the value of the {n}th member variable of an object.
 The results are undefined for a non-class object.


get_class_name(o)


 Return the class name for the instance o

 <i>Deprecated in favor of function <tt>classname(o)</tt>.</i>


get_id(object)


 Return the id of the object, based on the string returned by {image()}.  For
 types that do not produce such a value, this method will fail for values that
 do not have a serial number.

 <i>Deprecated in favor of function <tt>serial()</tt>.</i>

 @example
 @ x := [1, 2 ,3]
 @ write(::image(x))
 @ write(get_id(x))
 @
 @ Output:
 @ list_5(3)
 @ 5


get_name(object)


 Return the name of the object.  For a record this is the type name;
 for a class it is the class name, for a procedure the procedure name,
 for a file the filename and for a window the window name.  For all other
 types, this method fails.


get_type(object)


 Return the type of the object, as a string.  For standard Icon types,
 this is the value returned by the {type()} function.  For records, it
 is the string "record" and for classes it is the string "class".


hash_code(x, depth, seen)


 Return a hash code for this object.  For any two objects for which {equals} indicates
 equality, the returned hash code should be the same.


hash_string(s)


is_instance(obj, name)


 Succeed iff the given object is an instance of the class with the given name.


object_clone(o, seen)


 The default behaviour for Object.clone


object_equals(obj, other, seen)


 The default behaviour for Object.equals


object_hash_code(o, depth, seen)


 The default behaviour for Object.hash_code


object_to_string(o, depth, seen)


 The default behaviour for Object.to_string


to_string(o, depth, seen)


 Convert the object to string ,descending structures to the given depth

 @param o       The object to be converted.
 @param depth   The depth of recursion; default is all levels



This page produced by UniDoc on 2021/04/15 @ 23:59:54.