FYI - I've spent a few hours investigating this. I can't write an email without sounding irritated and making it very long-winded, so I'm just going to keep it short: This Irritates Me.
I'll try to amend the docs so that our new readers' expectations for get_dataref and upd_data are not higher than they ought to be. David On Thu, Sep 13, 2012 at 8:36 AM, Chris Marshall <[email protected]> wrote: > On Wed, Sep 12, 2012 at 11:55 PM, David Mertens > <[email protected]> wrote: >> >> At any rate, if a slice gets modified by PDL::PP code, there is >> machinery to flow those changes both to the slice's parent and to any >> of the slice's children. I had assumed that the data-flow machinery >> behind the $P() macro access in PDL::PP was the same as the stuff >> behind upd_data, just as you had, but clearly we were both wrong. This >> smells like a bug to me and something worth investigating whenever >> core diving happens. > > This is covered in the PDL::API docs. As mentioned > previously in this thread, get_dataref and upd_data are > used to access/move piddle data to/from perl routines. > > get_dataref gives you a reference to a perl scalar value > containing the data in the piddle. > > upd_data updates the data pointer in the pdl struct to > match the associated SV (since manipulation at the > perl level could result in memory re-allocations). > > If there is some clarification that could be added to the > docs or the book to avoid this confusion going forward, > please do so. It should be unambiguous where the > perl world stops and the PDL::PP one begins. :-) > > --Chris -- "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." -- Brian Kernighan _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
