[plt-scheme] string properties

From: ifconfig nslookup [plt] (plt at ifconfig.homelinux.net)
Date: Sun Jun 20 19:05:55 EDT 2004

How about
(define-struct unreal-string (str secret))
and extending string-procedures to support it?
I know it's a bit (or a lot) more work, but I believe it's more
straight-forward, because it actually puts your secret data inside the
string.
Of course, if you're not going to use it hard-core, hash tables would be
more appropriate.

ifconfig.

> -----Original Message-----
> From: plt-scheme-admin at list.cs.brown.edu 
> [mailto:plt-scheme-admin at list.cs.brown.edu] On Behalf Of Neil 
> W. Van Dyke
> Sent: Sunday, June 20, 2004 10:39 PM
> To: plt-scheme at list.cs.brown.edu
> Subject: [plt-scheme] string properties
> 
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> 
> I'd like to secretly associate data with normal string values.
> 
> The interface could be like this:
> 
>     (set-string-property! STR VALUE)  -->  #<void>
>     (string-property      STR)        -->  VALUE
> 
> Or like this:
> 
>     (make-string-property NAME)                -->  STR-PROP
>     (set-string-property! STR STR-PROP VALUE)  -->  #<void>
>     (string-property      STR STR-PROP)        -->  VALUE
> 
> For my current application, it would be OK if the property 
> value applied
> to all strings "equal?" rather than "eq?".
> 
> I'm thinking a PLT hash table with weakly-held keys, mapping 
> strings to
> values, would work for this purpose.
> 
> Is there a better way?
> 


Posted on the users mailing list.