petdance/scratch — Issue #858: src/pmc/fixedpmcarray.pmc:  get_repr() should use freeze/thaw
Author: petdance
Created: 2011-11-01 05:37:07+00:00
State: open
Labels: core, Pri-normal, Sev-medium, todo

This ticket moves an item previously discussed in the RT system at [http://rt.perl.org/rt3/Ticket/Display.html?id=46673 RT 46673] to the TT system.

{{{
179 =item C
180
181 Returns a string representation of the array contents.
182 RT #46673 implement freeze/thaw and use that instead.
183
184 =cut
185
186 */
187
188 VTABLE STRING *get_string() {
189 return Parrot_str_from_int(INTERP, SELF.elements());
190 }
191
192 VTABLE STRING *get_repr() {
193 STRING *res = CONST_STRING(INTERP, "(");
194 const INTVAL n = VTABLE_elements(INTERP, SELF);
195 INTVAL i;
196
197 for (i = 0; i < n; ++i) {
198 PMC * const val = SELF.get_pmc_keyed_int(i);
199 if (i > 0)
200 res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, ", "));
201
202 res = Parrot_str_append(INTERP, res, VTABLE_get_repr(INTERP, val ));
203 }
204
205 res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, ")"));
206
207 return res;
208 }

kid51
Trac ID #1229