[Pharo-project] Issue 7534 LazyListMorph>>selectionFrameForRow: fails with a 'should not happen' IS BACK
http://code.google.com/p/pharo/issues/detail?id=7534 -- View this message in context: http://forum.world.st/Issue-7534-LazyListMorph-selectionFrameForRow-fails-wi... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Le 18/02/2013 22:28, Sean P. DeNigris a écrit :
http://code.google.com/p/pharo/issues/detail?id=7509 With Igor suggestions on how to correct that :) Thierry -- Thierry Goubier CEA list Laboratoire des Fondations des Systèmes Temps Réel Embarqués 91191 Gif sur Yvette Cedex France Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95
I do not know if that is standardized. But the current behavior of subStrings is that something like: '1;;2;3;4' subStrings: ';' yields: #('1' '2' '3' '4') that means the array may get longer or shorter with the same number of separators. Shouldn't there be some kind of alternative which would yield? #('1' '' '2' '3' '4') Maybe there is a reason for the first decision. If not what would be the problem with having it both ways? Regards Friedrich
';;;;' splitOn: $; On 2013-02-19, at 16:30, Friedrich Dominicus <frido@q-software-solutions.de> wrote:
I do not know if that is standardized. But the current behavior of subStrings is that something like: '1;;2;3;4' subStrings: ';'
yields: #('1' '2' '3' '4')
that means the array may get longer or shorter with the same number of separators.
Shouldn't there be some kind of alternative which would yield? #('1' '' '2' '3' '4')
Maybe there is a reason for the first decision. If not what would be the problem with having it both ways?
Regards Friedrich
On Feb 19, 2013, at 7:32 AM, Camillo Bruni <camillobruni@gmail.com> wrote:
';;;;' splitOn: $;
And your point is? I'm afraid I'm not able to interpret your message. What does an array of one or five empty strings mean? A terse reply like this suggests either an email error with an incomplete message or that you think that the information provided is so obvious that there is only one way to interpret your message. If you think that the current implementation is useful, I'd be interested in reading a realistic use case.
On 2013-02-19, at 16:30, Friedrich Dominicus <frido@q-software-solutions.de> wrote:
I do not know if that is standardized. But the current behavior of subStrings is that something like: '1;;2;3;4' subStrings: ';'
yields: #('1' '2' '3' '4')
that means the array may get longer or shorter with the same number of separators.
Shouldn't there be some kind of alternative which would yield? #('1' '' '2' '3' '4')
Maybe there is a reason for the first decision. If not what would be the problem with having it both ways?
Yes, you are quite right. Imagine that you were dealing with data structures represented by a delimited string (e.g., HL7 has been in use since 1987), where the interpretation of a field is based on its position. In this case allowing empty fields is completely reasonable and, in fact, necessary to proper interpretation of the data. Shifting all the fields because one field happens to be empty is just wrong. James Foster
On 2013-02-19, at 17:15, James Foster <Smalltalk@JGFoster.net> wrote:
On Feb 19, 2013, at 7:32 AM, Camillo Bruni <camillobruni@gmail.com> wrote:
';;;;' splitOn: $;
And your point is? I'm afraid I'm not able to interpret your message. What does an array of one or five empty strings mean? A terse reply like this suggests either an email error with an incomplete message or that you think that the information provided is so obvious that there is only one way to interpret your message. If you think that the current implementation is useful, I'd be interested in reading a realistic use case.
Apparently you like to write a lot, I don't.. so in verbose plain english: Q: "Shouldn't there be some kind of alternative which would yield?" A: Yes there is, use #splitOn: Example: -------- '1;;2;3;4' splitOn: $; yields: an OrderedCollection('1' '' '2' '3' '4') Reduced Example: ---------------- ';;;;' subStrings: ';' ===> #() ';;;;' splitOn: $; ===> an OrderedCollection('' '' '' '' '')
On 2013-02-19, at 16:30, Friedrich Dominicus <frido@q-software-solutions.de> wrote:
I do not know if that is standardized. But the current behavior of subStrings is that something like: '1;;2;3;4' subStrings: ';'
yields: #('1' '2' '3' '4')
that means the array may get longer or shorter with the same number of separators.
Shouldn't there be some kind of alternative which would yield? #('1' '' '2' '3' '4')
Maybe there is a reason for the first decision. If not what would be the problem with having it both ways?
2013/2/19 Camillo Bruni <camillobruni@gmail.com>:
On 2013-02-19, at 17:15, James Foster <Smalltalk@JGFoster.net> wrote:
On Feb 19, 2013, at 7:32 AM, Camillo Bruni <camillobruni@gmail.com> wrote:
';;;;' splitOn: $; And your point is? I'm afraid I'm not able to interpret your message. What does an array of one or five empty strings mean? A terse reply like this suggests either an email error with an incomplete message or that you think that the information provided is so obvious that there is only one way to interpret your message. If you think that the current implementation is useful, I'd be interested in reading a realistic use case.
Apparently you like to write a lot, I don't.. so in verbose plain english:
Q: "Shouldn't there be some kind of alternative which would yield?" A: Yes there is, use #splitOn:
Cool down guys, we're all friends here :) But what's the rationale behind changing the semantics of a largely used selector in other dialects also? e.g. in Dolphin and VisualAge/VAST ';;;;' subStrings: $; => ('' '' '' '') (In VA the implementation dates from 1996!) Regards, Esteban A. Maringolo
On 2013-02-19, at 18:41, "Esteban A. Maringolo" <emaringolo@gmail.com> wrote:
2013/2/19 Camillo Bruni <camillobruni@gmail.com>:
On 2013-02-19, at 17:15, James Foster <Smalltalk@JGFoster.net> wrote:
On Feb 19, 2013, at 7:32 AM, Camillo Bruni <camillobruni@gmail.com> wrote:
';;;;' splitOn: $; And your point is? I'm afraid I'm not able to interpret your message. What does an array of one or five empty strings mean? A terse reply like this suggests either an email error with an incomplete message or that you think that the information provided is so obvious that there is only one way to interpret your message. If you think that the current implementation is useful, I'd be interested in reading a realistic use case.
Apparently you like to write a lot, I don't.. so in verbose plain english:
Q: "Shouldn't there be some kind of alternative which would yield?" A: Yes there is, use #splitOn:
Cool down guys, we're all friends here :)
sorry, didn't mean to offend anybody ;)
But what's the rationale behind changing the semantics of a largely used selector in other dialects also?
e.g. in Dolphin and VisualAge/VAST ';;;;' subStrings: $; => ('' '' '' '')
(In VA the implementation dates from 1996!)
It is indeed strange behavior, but I think we inherited that from squeak. But it looks like the ANSI standard from which that method emerged is not very specific about it. And other Smalltalkses discussed the behavior as well: http://forum.world.st/New-Dolphin-Goodie-ANSI-substrings-td3362233.html So with both behaviors at hand everybody can be happy, or fight forever over the right definition :P
On 19 February 2013 22:52, Camillo Bruni <camillobruni@gmail.com> wrote:
On 2013-02-19, at 18:41, "Esteban A. Maringolo" <emaringolo@gmail.com> wrote:
2013/2/19 Camillo Bruni <camillobruni@gmail.com>:
On 2013-02-19, at 17:15, James Foster <Smalltalk@JGFoster.net> wrote:
On Feb 19, 2013, at 7:32 AM, Camillo Bruni <camillobruni@gmail.com> wrote:
';;;;' splitOn: $; And your point is? I'm afraid I'm not able to interpret your message. What does an array of one or five empty strings mean? A terse reply like this suggests either an email error with an incomplete message or that you think that the information provided is so obvious that there is only one way to interpret your message. If you think that the current implementation is useful, I'd be interested in reading a realistic use case.
Apparently you like to write a lot, I don't.. so in verbose plain english:
Q: "Shouldn't there be some kind of alternative which would yield?" A: Yes there is, use #splitOn:
Cool down guys, we're all friends here :)
sorry, didn't mean to offend anybody ;)
But what's the rationale behind changing the semantics of a largely used selector in other dialects also?
e.g. in Dolphin and VisualAge/VAST ';;;;' subStrings: $; => ('' '' '' '')
(In VA the implementation dates from 1996!)
It is indeed strange behavior, but I think we inherited that from squeak.
No, Squeak has (since 2005) had still another behaviour: ';;;;' subStrings: ';' '1;2;3' subStrings: ';' #('1' '2' '3') (Note the ';' rather than $;, because Squeak's version takes a String of separators.) frank
But it looks like the ANSI standard from which that method emerged is not very specific about it. And other Smalltalkses discussed the behavior as well:
http://forum.world.st/New-Dolphin-Goodie-ANSI-substrings-td3362233.html
So with both behaviors at hand everybody can be happy, or fight forever over the right definition :P
On Tue, Feb 19, 2013 at 3:28 PM, Frank Shearar <frank.shearar@gmail.com>wrote: <snip>
It is indeed strange behavior, but I think we inherited that from squeak.
No, Squeak has (since 2005) had still another behaviour:
';;;;' subStrings: ';' '1;2;3' subStrings: ';' #('1' '2' '3')
(Note the ';' rather than $;, because Squeak's version takes a String of separators.)
frank
Yes, but it still has the odd behavior: ';;;;' subStrings: ';' => $( ) '1;2;;3' subStrings: ';' => #('1' '2' '3') And the separators don't have to be strings - they can be any collection of characters. Chris
On 20 Feb 2013, at 0:49, Chris Cunningham <cunningham.cb@gmail.com> wrote:
On Tue, Feb 19, 2013 at 3:28 PM, Frank Shearar <frank.shearar@gmail.com> wrote: <snip>
It is indeed strange behavior, but I think we inherited that from squeak.
No, Squeak has (since 2005) had still another behaviour:
';;;;' subStrings: ';' '1;2;3' subStrings: ';' #('1' '2' '3')
(Note the ';' rather than $;, because Squeak's version takes a String of separators.)
frank
Yes, but it still has the odd behavior:
';;;;' subStrings: ';' => $( ) '1;2;;3' subStrings: ';' => #('1' '2' '3')
And the separators don't have to be strings - they can be any collection of characters.
Chris
To make my point more clearly perhaps I should have shown that in Squeak you can't use a Character argument to subStrings:, in contrast to the examples. frank
On 2013-02-20, at 09:26, Frank Shearar <frank.shearar@gmail.com> wrote:
On 20 Feb 2013, at 0:49, Chris Cunningham <cunningham.cb@gmail.com> wrote:
On Tue, Feb 19, 2013 at 3:28 PM, Frank Shearar <frank.shearar@gmail.com> wrote: <snip>
It is indeed strange behavior, but I think we inherited that from squeak.
No, Squeak has (since 2005) had still another behaviour:
';;;;' subStrings: ';' '1;2;3' subStrings: ';' #('1' '2' '3')
(Note the ';' rather than $;, because Squeak's version takes a String of separators.)
frank
Yes, but it still has the odd behavior:
';;;;' subStrings: ';' => $( ) '1;2;;3' subStrings: ';' => #('1' '2' '3')
And the separators don't have to be strings - they can be any collection of characters.
Chris
To make my point more clearly perhaps I should have shown that in Squeak you can't use a Character argument to subStrings:, in contrast to the examples.
neither in Pharo.. so they are 100% the same, since I can go back to Pharo 1.0 without any version history of the method.
On 20 February 2013 08:38, Camillo Bruni <camillobruni@gmail.com> wrote:
On 2013-02-20, at 09:26, Frank Shearar <frank.shearar@gmail.com> wrote:
On 20 Feb 2013, at 0:49, Chris Cunningham <cunningham.cb@gmail.com> wrote:
On Tue, Feb 19, 2013 at 3:28 PM, Frank Shearar <frank.shearar@gmail.com> wrote: <snip>
It is indeed strange behavior, but I think we inherited that from squeak.
No, Squeak has (since 2005) had still another behaviour:
';;;;' subStrings: ';' '1;2;3' subStrings: ';' #('1' '2' '3')
(Note the ';' rather than $;, because Squeak's version takes a String of separators.)
frank
Yes, but it still has the odd behavior:
';;;;' subStrings: ';' => $( ) '1;2;;3' subStrings: ';' => #('1' '2' '3')
And the separators don't have to be strings - they can be any collection of characters.
Chris
To make my point more clearly perhaps I should have shown that in Squeak you can't use a Character argument to subStrings:, in contrast to the examples.
neither in Pharo.. so they are 100% the same, since I can go back to Pharo 1.0 without any version history of the method.
Right. I see my mistake; I muddled the Character argument to #splitOn: with the String argument to #subStrings:. Oh well, sorry for the noise. frank
No, Squeak has (since 2005) had still another behaviour:
';;;;' subStrings: ';' '1;2;3' subStrings: ';' #('1' '2' '3')
(Note the ';' rather than $;, because Squeak's version takes a String of separators.)
so yes, exactly the same as in Pharo. => we inherited it from Squeak! => subStrings: only works with Characters => #splitOn: does it with both and yields more predictable results! (';;;;' splitOn: $;) = (';;;;' splitOn: ';') = an OrderedCollection('' '' '' '' '')
On 2013-02-20, at 08:05, Camillo Bruni <camillobruni@gmail.com> wrote:
No, Squeak has (since 2005) had still another behaviour:
';;;;' subStrings: ';' '1;2;3' subStrings: ';' #('1' '2' '3')
(Note the ';' rather than $;, because Squeak's version takes a String of separators.)
so yes, exactly the same as in Pharo. => we inherited it from Squeak! => subStrings: only works with Characters Strings of course, #subStrings: works only with Strings
=> #splitOn: does it with both and yields more predictable results!
(';;;;' splitOn: $;) = (';;;;' splitOn: ';') = an OrderedCollection('' '' '' '' '')
Thanks for the more detailed explanation. I see the point now. I hadn't read carefully enough. James On Feb 19, 2013, at 8:50 AM, Camillo Bruni <camillobruni@gmail.com> wrote:
On 2013-02-19, at 17:15, James Foster <Smalltalk@JGFoster.net> wrote:
On Feb 19, 2013, at 7:32 AM, Camillo Bruni <camillobruni@gmail.com> wrote:
';;;;' splitOn: $;
And your point is? I'm afraid I'm not able to interpret your message. What does an array of one or five empty strings mean? A terse reply like this suggests either an email error with an incomplete message or that you think that the information provided is so obvious that there is only one way to interpret your message. If you think that the current implementation is useful, I'd be interested in reading a realistic use case.
Apparently you like to write a lot, I don't.. so in verbose plain english:
Q: "Shouldn't there be some kind of alternative which would yield?" A: Yes there is, use #splitOn:
Example: --------
'1;;2;3;4' splitOn: $; yields: an OrderedCollection('1' '' '2' '3' '4')
Reduced Example: ----------------
';;;;' subStrings: ';' ===> #()
';;;;' splitOn: $; ===> an OrderedCollection('' '' '' '' '')
On 2013-02-19, at 16:30, Friedrich Dominicus <frido@q-software-solutions.de> wrote:
I do not know if that is standardized. But the current behavior of subStrings is that something like: '1;;2;3;4' subStrings: ';'
yields: #('1' '2' '3' '4')
that means the array may get longer or shorter with the same number of separators.
Shouldn't there be some kind of alternative which would yield? #('1' '' '2' '3' '4')
Maybe there is a reason for the first decision. If not what would be the problem with having it both ways?
participants (8)
-
Camillo Bruni -
Chris Cunningham -
Esteban A. Maringolo -
Frank Shearar -
Friedrich Dominicus -
Goubier Thierry -
James Foster -
Sean P. DeNigris