Dear GAP-Forum,

I am a little bit confused about protecting variables.
Is it possible in all cases, and if not, will this be possible in future versions of GAP?

For example, I failed to protect a 'Property':


######################################
exampleRec := rec();
exampleRec.IsShape := NewProperty("IsShape",IsObject);
InstallMethod(exampleRec.IsShape , "" ,[IsObject],
function(obj)
    return false;
end
);

exampleRec.IsShape := MakeImmutable(exampleRec.IsShape);
exampleRec := MakeImmutable(exampleRec);

IsMutable(exampleRec);
IsMutable(exampleRec.IsShape);

InstallMethod(exampleRec.IsShape , "" ,[IsObject],
function(obj)
    return true;
end
);
# I would expect an error , but there is none!

exampleRec.IsShape(4);
######################################


My second question is, how to define  local constants?
For example, I would like to protect  'constantInt':

######################################
    local constantInt;
    constantInt := 5;
    # how to protect  constantInt?
######################################


Thanks,


Jakob

_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to