Peter Bortas @ Pike  developers forum wrote:
>It's so quirky that we might want to consider a warning for that.

What about this:

        (string)({65,66,"abc",67,"def",68})

Can we turn it into: "ABabcCdefD" ?
Currently this doesn't work (obviously).
The reason I would like to have this is that in order to
parse strings and accumulate results, in Pike I tend to
either pick the characters apart as integers, or use strings of
characters whenever the parsing allows me to go faster.

The result is that I would like to accumulate the results piecemeal
in an array.  This array gets filled like in the example above.
Then I'd like to return a single string to the function caller,
in which case I could cast it to string (as done above).

>From a language purity standpoint I realise that implementing the cast like
this is not quite proper.  Then again, I can't think of any other reasonable
result the cast should have (except throw an error).  Thus in essence it's
a DWIM (Do What I Mean) behaviour and conforms to the principle of least
surprise.

Comments?
-- 
Sincerely,
           Stephen R. van den Berg.
"I don't have to take this abuse from you --
 I've got hundreds of people waiting to abuse me."
  • Support for array(str... Stephen R. van den Berg
    • Support for arra... Martin Stjernholm, Roxen IS @ Pike developers forum
      • Support for ... Peter Bortas @ Pike developers forum
        • Re: Supp... Stephen R. van den Berg
          • Re: ... Per Hedbor () @ Pike (-) developers forum
            • ... Stephen R. van den Berg
              • ... Marc Dirix
                • ... Stephen R. van den Berg
              • ... Mirar @ Pike developers forum
                • ... Marc Dirix
                • ... Mirar @ Pike developers forum
                • ... Stephen R. van den Berg
                • ... Peter Bortas @ Pike developers forum
                • ... Stephen R. van den Berg

Reply via email to