Description
This has been touched upon in triage today when discussing #2721: Many times one has properties of an object which are potentially expensive to compute; one example being the dimension of an ideal. For MPolyQuoIdeal
s this is not known a priori. Yet one eventually wants to make an informed decision based on whether this property is known.
A dirty way to do this is to look whether or not a (hopefully corresponding) attribute is set; like for instance
if has_attribute(I, :dim) && dim(I) == 0
# do something which takes advantage of the information that we have a 0-dimensional ideal
else
# do something else
end
This has the disadvantage that not every concrete type of ideals has the information stored as an attribute. Maybe some of them use fields in the struct? So what one really wants to have is an official way to ask whether this information is present; just like
if has_known_dim(I) && dim(I) == 0
# do something which takes advantage of the information that we have a 0-dimensional ideal
else
# do something else
end
I would propose exactly this syntax: has_known_XYZ
where XYZ
is the name of the usual getter for the respective property.
But I'm afraid that similar things already have emerged and spread over OSCAR in other areas and people have used other names. If you are aware of such instances: Could you point them out here, so that we can gather them?
Then we could eventually make progress towards some informed decision whether we really want this feature and if so, in which form.