Hi Maciej,
A very short answer is "never use _immutable_ it's very confusing".
that I found out the hard way already. :)
_immutable_fields_ is better (for subclassing) Wildcards mean "array
on the instance is immutable" so a[*] means x.a[3] will be constant
folded, if x is a constant.
I've also seen an '?' appended to field names? But it is the last set of
rules that I'm interested in (the "if" portion of the rule in particular).
Something like it seems to have bit me: there was a field that was constant
only by inheritance of _immutable_ = True, but it didn't hurt until the
container variable received a jit.promote(). With both in place, I got
wrong results. With the promote() removed, I got:
[bogus _immutable_field_ declaration: <FieldU
pypy.module.cppyy.executor.BasicRefExecutor.inst_do_assign 12>]
which was very nice (as a diagnostic). Removing the _immutable_ = True,
however, did not resolve the issue like I expected, as (I think, still
investigating) the object was part of an object that also had _immutable_
set to True, making it immutable still.
My current guess is that I should selectively use _immutable_fields_ only,
and not promote whole objects, but only fields of objects.
The other issue that I have, is that it seems to be okay to make a field
immutable if it will be set once on first use (i.e. if guaranteed to be set
before the JIT kicks in)? If true, that'd be a nice feature.
Looking forward to those docs. :)
Best regards,
Wim
--
[email protected] -- +1 (510) 486 6411 -- www.lavrijsen.net
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev