setarg/3 in a metacalled do/2

From: Stefano Novello <stefano.novello_at_parc-technologies.com>
Date: Tue 30 Jul 2002 09:47:06 AM GMT
Message-ID: <3E899FAFBF56D611B6A500508B9A9DA206DFFA@LON-SRV2>
Well actually Its not Param. The body of the do is term copied to get fresh
variables on each iteration.
If the body contained a hash table, and this was instantiated before calling
the do/2 loop, the table gets copied.

Given this implementation the 'bug' seems unavoidable, unless you transform
the code before starting the metacall.

One idea is that a structure that can be modified could be marked as
special. Copy term would not copy such a structure. So a module like hash,
it would create hash tables using such a special structure and know they are
never copied. (I think sicstus has something like this, and uses it to
disallow setarg on all but specially marked structures).

As a resultof this, modules like hash would probably have to define some
copy functionality.

I guess heap copies would not be affected by this mark. The mark would also
survive the heap copy.

Stefano

2nd Floor The Tower Building	EMAIL: Stefano.Novello@parc-technologies.com
11 York Road                      TEL: +44 (0)20 72614068
SE1 7NX LONDON                    

This e-mail message is for the sole use of the intended recipient(s) - its
contents are the property of Parc Technologies Limited (or its licensors)
and are confidential. Please do not copy, review, use (except for the
intended purposes), disclose or distribute the e-mail or its contents or
allow anyone else to do so without our prior permission. 
Parc Technologies Limited does not guarantee that this e-mail has not been
intercepted and amended nor that it is virus-free. You should carry out your
own virus checks before opening any attachment. Any opinions expressed in
this e-mail message are those of the author and not necessarily Parc
Technologies Limited.

 
Received on Tue Jul 30 10:45:43 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:17 PM GMT GMT