New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.splice loses containerization on replacement value #6194
Comments
From @lizmatActually reported as a SO question by brian d foy: <lizmat> m: my @a = [1,1],[2,2],[3,3]; dd @a; @a.splice: 0, 2, $[4,4]; dd @a # feels like a bug that the containerization of [4,4] is being ignored |
From tomentiruran@gmail.com
I got hit by this with: @a.splice: 0, 0, Any xx 2
|
From @smlsOn Fri, 08 Sep 2017 18:37:50 -0700, tomentiruran@gmail.com wrote:
Good find. It's also not specific to `Seq` - it looks like it happens whenever the replacement elements are passed to `splice` as a nested structure rather than as flat arguments: my @h; dd @h; # Array @h = ["a", "b"] Conceptually¹⁺², the `splice` routine takes the replacements as a `*@` slurpy, so whether they're passed in nested or flat form should not matter. But Rakudo currently implements the routine with a `| is raw` signature: say Array.^find_method("splice").signature; # (Mu $: | is raw) ...and apparently does the parameter flattening manually, in a way that introduces this bug. Until it is fixed, a work-around is to flatten the replacement elements into the argument list of `splice` using `|`: @a.splice: 0, 0, |(Any xx 2); [1] https://docs.perl6.org/routine/splice |
The RT System itself - Status changed from 'new' to 'open' |
From @skidsOn Sun, 16 Apr 2017 12:56:58 -0700, elizabeth wrote:
This ticket and RT#132047 may be merged. Please find an experimental tree at: commit 998738620d1ca327e1b2d7727b7a0f28b9bce542 GLR-ize splice's @replacement argument Collapse **@ and @ candidates into +@ candidates. (I also tried **@ and it did not fair very well. There are many splice's prototype never got touched during GLR, if you look at git blame If someone who is tooled to do an ecosystem-wide/multiplatform test could Figuring out where this sits WRT 6.d, both feature-wise and technically No performance tests have been done on this. I notice we still keep some |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#131162 (status was 'open')
Searchable as RT131162$
The text was updated successfully, but these errors were encountered: