[DGD]removing elements from mappings

Gregory D Lewis glewis at maths.adelaide.edu.au
Fri Dec 15 00:18:14 CET 2000


Boris J wrote:
> I wondering what is the proper way of removing elements (indices/values) from 
> a mapping in DGD ?

In 1.1 you just assign zero to them, e.g. mapping[index] = 0, in 1.2 thats
extended to using nil as you note below.

> Shouldn't this work:
> 
>     foo_mapping -= bar_indices;
> 
> which would remove 'bar_indices' indice and it's value from the 'foo_mapping' 
> mapping ?

Why should that work?  It looks completely unintuitive to me.

> I discovered also that setting value of an indice to 'nil', e.g.
> 
>     foo_mapping[bar_indices] = nil;
> 
> makes the 'bar_indices' entry to disappear from the mapping. Does this mean 
> that it's impossible to store nil values in DGD mappings, or is it a 
> configurable option ? ( Like changing 'typechecking' in driver config file or 
> something... )

Not sure if its configurable or not, will leave that to someone with more
familiarity with recent driver versions.

-- 
Greg Lewis                              Applied Maths Department
Email : glewis at maths.adelaide.edu.au    University of Adelaide
--

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list