[plt-scheme] v299 scheme_make_cptr

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Oct 22 17:28:10 EDT 2004

On Oct 22, Ron Stanonik wrote:
> In v299 the second argument to scheme_make_cptr changed from (char *)
> to (Scheme_Object *).  So, instead of
> 
>   scheme_make_cptr(rectp, "rectangle")
> 
> I guess I should
> 
>   scheme_make_cptr(rectp, scheme_intern_symbol("rectangle"))
> 
> or
> 
>   scheme_make_cptr(rectp, scheme_make_byte_string("rectangle"))

Yes.


> Any reason to prefer one over the other?

Yes -- the tag was something that you'd use only in C, but now it is
accessible in Scheme, and used to implement pointer functionality.
Because it is a Scheme object that is used, you can create pointer
tags that are hidden from users, so code becomes safer.  Right now,
symbol and string values for the tag have an extra functionality --
they are printed as #<pointer:...>, but this might be extended.  (For
example, one way to implement `sub-structs' would be to use a tag that
is a list of strings which identify other structs as the current one.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.