Mantis - Squeak
Viewing Issue Advanced Details
5707 Kernel minor always 01-07-07 19:47 09-18-08 00:57
Keith_Hodges  
 
normal  
new 3.9  
open  
none    
none  
0005707: 'hello' copyFrom: 6 to: 5 returns ''
see summary.

child of 0007194new  copyReplaceFrom:to:with: strange behavior with ill bounds 

Notes
(0008849)
wiz   
01-08-07 02:54   
Hi Keith,

I don't understand.
Why is this a bug?
There are no characters between the 6th and 5th.
But there is an insertion point.
So it is not out of range.

What hapeens if you ask about character between 7th and 6th position?

If you are asserting it should be then be useful and add test code to the report.

[OT] I find a lot of your thinking obscure (to me) because of your terseness. It would help if you hold off writing a report until you have time to write enough to bring the reader along.

Yours in ser vice, --Jerome Peace
(0012673)
nicolas cellier   
09-16-08 21:40   
Maybe you'll prefer this one:

'hello' copyFrom: -3/2 to: -5/2.
(0012674)
Keith_Hodges   
09-16-08 22:15   
Jerome, think about it... I am not being terse... its obviously an "rorre".
(0012675)
nicolas cellier   
09-16-08 22:41   
Taking this to the limit, which one would you accept as valid?

'' copyFrom: 1 to: 0.
'' copyFrom: 0 to: -1.
(0012676)
Keith_Hodges   
09-16-08 22:51   
I would consider both should raise exceptions.

copyFrom: lowerIndex to: higherIndex

where lowerIndex <= higherIndex.

but then perhaps I am just Na´ve? (you don't need to answer that)
(0012677)
nicolas cellier   
09-16-08 23:19   
Whether good or not, this is a feature used in existing code base.

It enables for example to write (aSequenceableCollection copyFrom: 1 to: self size) even ifEmpty...

I see some relationship with copyReplaceFrom:to:with:
  'hello' copyReplaceFrom: 6 to: 5 with: ' world'.
  'hello' copyReplaceFrom: 1 to: 0 with: 'world '.
You cannot copyReplaceFrom: 0 to: -1, nor from: 7 to: 6.
However, you can copyFrom:to: with these bounds, and that might be arguable.
I imagine Jerome had some kind of similar idea in mind, thus the questions.

Hehe, that made me test for 0007194
(0012678)
nicolas cellier   
09-16-08 23:43   
There is also a relation with 0006535
(0012679)
wiz   
09-18-08 00:55   
Ha,

Now that this has risen to the top of the pile again, I notice I have neglected to reply.

This report needs someone to say what the user story should be. The report w/o that lacks clarity. Which is why I said it was terse. Good minds deserve to give good explainations. So slower minds can catch up quickly.

When are the arguments in range and when are they outside the range?

There are other messages that find meaning in the range 6..5 using it to indicate an insertionPoint.

When the message #copyFrom:to: is sent what are legit arguments and what are not?

Nicolas has come up with some good use cases.

There should be some sunit tests that incorperate them and then those tests should be made to work or modified to work.

So
1) What is the user story?
2) Where are the tests to check if the user story has been implemented?

Yours in curiosity and service, --Jerome Peace