[913] in Coldmud discussion meeting

root meeting help first previous next last

[COLD] Using Data Libraries

daemon@ATHENA.MIT.EDU (Sun Jan 28 21:32:28 1996 )

Date: Sun, 28 Jan 1996 19:14:19 -0700 (MST)
From: Brandon Gillespie <brandon@tombstone.sunrem.com>
To: coldstuff@tombstone.sunrem.com
In-Reply-To: <199601280644.WAA07751@yam.tenetwork.com>
Reply-To: coldstuff@tombstone.sunrem.com

> A question by the way.  I can';t figure $list out.  it SEEMS like all 
> [ ] list objects end up as $list objects.  How does this magic 
> happen?  What am I missing?

Jordan added this nifty bit of functionality for ease of using ColdC 
libraries based off a specific data type.  Basically, when the 
interpreter encounters a data type other than OBJNUM as the target where 
the method is found it looks up an object based off the type of data (ie 
type())  Simply put, type(list) => 'list, and lookup('list) => $list (if 
you are using a 0-3 core, with 'lookup()).  The data is then set as the 
first argument to the method, with subsequent arguments following it.  
Therefore:

    [1,2,3].reverse();
    "foo".capitalize();

Are the same as:

    $list.reverse([1,2,3]);
    $string.reverse("foo");

This is one of the 'practical' features of ColdC (as Larry Wall would put
it ;)