Re: [OE vs Phix] assigning atom to a slice is different
- Posted by katsmeow Feb 15, 2018
- 1233 views
PS I trust you will recall that Phix supports variable length slice substitution, which OE does not, eg
string s = "fed" s[2..2] = "ee" -- s is now "feed"
Respectfully, why? Or maybe, how? Doesn't this break things? Can you give a real-world case where this would be useful? Can you please give an url into the readme for this capability? I am not claiming this is a mistake, but praps you have something i cannot wrap my head around yet, and i'd like to understand the how and why of it. Thanks, Pete.
It's a shortcut for inserting a string into a string (queue fights about strings in Eu?), but doesn't it break the idea that a one-dimensional sequence is a sequence of atoms, where s is "fed" then s[2] is an atom, and if you make it a sequence, then you have a two-dimensional (nested) sequence {'f',"ee",'d'}?
Does it work like
string s = "fed" s[2..2] = "ee" -- s is now "feed" -- given seq p = "ee" s[2] = p -- s is now "'f',"ee",'d'" ? s[2..3] = "12" -- s is now "f12" ? s[2..-2] = "12" -- s is now "f21d" ?
I tried using Phix a couple years ago, but it failed to run, i do not remember why. I would be testing this myself if i could, as this post is more work than throwing together the tests.