In using Cuis, I discover that unused literals in a method, otherwise
known as "poor-mans pragmas" are optimized away in compiledMethod. Does anyone know when this happened? (or was I using some other method to find them) Keith |
keith wrote:
> In using Cuis, I discover that unused literals in a method, otherwise > known as "poor-mans pragmas" are optimized away in compiledMethod. > Does anyone know when this happened? (or was I using some other method > to find them) > > Keith Well, the same also happens in Squeak, Pharo and Cuis 1.0 (pre-closures). I'd say it has always been like this. See #flag: . It is dated 4/28/2000, and serves your purpose. Cheers, Juan Vuletich |
On 13 Feb 2010, at 21:11, Juan Vuletich wrote: > keith wrote: >> In using Cuis, I discover that unused literals in a method, >> otherwise known as "poor-mans pragmas" are optimized away in >> compiledMethod. Does anyone know when this happened? (or was I >> using some other method to find them) >> >> Keith > > Well, the same also happens in Squeak, Pharo and Cuis 1.0 (pre- > closures). I'd say it has always been like this. See #flag: . It is > dated 4/28/2000, and serves your purpose. > > Cheers, > Juan Vuletich It didn't happen in squeak 3.9 Keith |
In reply to this post by Juan Vuletich-4
So flag: it is! In the process of making things more modular, with less dependencies I am removing the manual registration of selectors in #presumedSentMessages using the following conventions. #methodsToKeep and: self flag: #presumeSentSelector. cheers Keith |
In reply to this post by keith1y
keith wrote:
> > On 13 Feb 2010, at 21:11, Juan Vuletich wrote: > >> keith wrote: >>> In using Cuis, I discover that unused literals in a method, >>> otherwise known as "poor-mans pragmas" are optimized away in >>> compiledMethod. Does anyone know when this happened? (or was I using >>> some other method to find them) >>> >>> Keith >> >> Well, the same also happens in Squeak, Pharo and Cuis 1.0 >> (pre-closures). I'd say it has always been like this. See #flag: . It >> is dated 4/28/2000, and serves your purpose. >> >> Cheers, >> Juan Vuletich > > It didn't happen in squeak 3.9 > > Keith > Cheers, Juan Vuletich |
In reply to this post by keith1y
keith wrote:
>>> In using Cuis, I discover that unused literals in a method, >>> otherwise known as "poor-mans pragmas" are optimized away in >>> compiledMethod. Does anyone know when this happened? (or was I using >>> some other method to find them) >>> >>> Keith >> >> Well, the same also happens in Squeak, Pharo and Cuis 1.0 >> (pre-closures). I'd say it has always been like this. See #flag: . It >> is dated 4/28/2000, and serves your purpose. >> >> Cheers, >> Juan Vuletich > > So flag: it is! > > In the process of making things more modular, with less dependencies I > am removing the manual registration of selectors in > #presumedSentMessages using the following conventions. #methodsToKeep and: > > self flag: #presumeSentSelector. > > cheers > > Keith Good idea! Cheers, Juan Vuletich |
Juan,
I just found a bug in StandardFileStream upTo: that seems to be recent. Keith |
In reply to this post by Juan Vuletich-4
On 13 Feb 2010, at 22:04, Juan Vuletich wrote:
That is puzzling, I used to search on unused literals as markers for tests. Keith |
In reply to this post by keith1y
keith wrote:
> Juan, > > I just found a bug in StandardFileStream upTo: that seems to be recent. > > Keith > Could you post a script that shows the incorrect behavior? I test would be even better. Cheers, Juan Vuletich |
On 13 Feb 2010, at 23:13, Juan Vuletich wrote: > keith wrote: >> Juan, >> >> I just found a bug in StandardFileStream upTo: that seems to be >> recent. >> >> Keith >> > Could you post a script that shows the incorrect behavior? I test > would be even better. > > Cheers, > Juan Vuletich Ok, it was not as obvious as I thought. peek messes things up. (FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close. (FileStream concreteStream readOnlyFileNamed: 'test') position: 0; peek; upTo: $*. peek appears to set readLimit, and then the following part of upTo: is invoked. collection ifNotNil: [ (position < readLimit and: [ (count := collection indexOf: delim startingAt: position + 1) <= readLimit and: [ count > 0 ] ]) ifTrue: [ ^collection copyFrom: position + 1 to: (position := position + count) ] ]. this gets it wrong, I think it should be something like, to: (position := position + count -1) - 1 Keith |
On Sat, 13 Feb 2010, keith wrote:
> > On 13 Feb 2010, at 23:13, Juan Vuletich wrote: > >> keith wrote: >>> Juan, >>> >>> I just found a bug in StandardFileStream upTo: that seems to be recent. >>> >>> Keith >>> >> Could you post a script that shows the incorrect behavior? I test would be >> even better. >> >> Cheers, >> Juan Vuletich > > Ok, it was not as obvious as I thought. peek messes things up. > > (FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close. > (FileStream concreteStream readOnlyFileNamed: 'test') position: 0; peek; > upTo: $*. > > peek appears to set readLimit, and then the following part of upTo: is > invoked. > > collection ifNotNil: [ > (position < readLimit and: [ > (count := collection indexOf: delim startingAt: > position + 1) <= readLimit and: [ > count > 0 ] ]) ifTrue: [ > ^collection copyFrom: position + 1 > to: (position := position + count) ] ]. > > this gets it wrong, I think it should be something like, to: (position := > position + count -1) - 1 Seems like Cuis has an older version of the filestream buffering. This bug was fixed later in the Trunk, here's the current version: collection ifNotNil: [ (position < readLimit and: [ (pos := collection indexOf: delim startingAt: position + 1) <= readLimit and: [ pos > 0 ] ]) ifTrue: [ ^collection copyFrom: position + 1 to: (position := pos) - 1 ] ]. Levente > > Keith > > > > |
In reply to this post by keith1y
keith wrote:
> > On 13 Feb 2010, at 23:13, Juan Vuletich wrote: > >> keith wrote: >>> Juan, >>> >>> I just found a bug in StandardFileStream upTo: that seems to be >>> recent. >>> >>> Keith >>> >> Could you post a script that shows the incorrect behavior? I test >> would be even better. >> >> Cheers, >> Juan Vuletich > > Ok, it was not as obvious as I thought. peek messes things up. > > (FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close. > (FileStream concreteStream readOnlyFileNamed: 'test') position: 0; > peek; upTo: $*. > > peek appears to set readLimit, and then the following part of upTo: is > invoked. > > collection ifNotNil: [ > (position < readLimit and: [ > (count := collection indexOf: delim startingAt: position + > 1) <= readLimit and: [ > count > 0 ] ]) ifTrue: [ > ^collection copyFrom: position + 1 to: (position > := position + count) ] ]. > > this gets it wrong, I think it should be something like, to: > (position := position + count -1) - 1 > > Keith Oh! Thanks for the report! I'll update the FileStream code to latest in trunk ASAP. Cheers, Juan Vuletich |
In reply to this post by Levente Uzonyi-2
Levente Uzonyi wrote:
> On Sat, 13 Feb 2010, keith wrote: > >> >> On 13 Feb 2010, at 23:13, Juan Vuletich wrote: >> >>> keith wrote: >>>> Juan, >>>> >>>> I just found a bug in StandardFileStream upTo: that seems to be >>>> recent. >>>> >>>> Keith >>>> >>> Could you post a script that shows the incorrect behavior? I test >>> would be even better. >>> >>> Cheers, >>> Juan Vuletich >> >> Ok, it was not as obvious as I thought. peek messes things up. >> >> (FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close. >> (FileStream concreteStream readOnlyFileNamed: 'test') position: 0; >> peek; upTo: $*. >> >> peek appears to set readLimit, and then the following part of upTo: >> is invoked. >> >> collection ifNotNil: [ >> (position < readLimit and: [ >> (count := collection indexOf: delim startingAt: position >> + 1) <= readLimit and: [ >> count > 0 ] ]) ifTrue: [ >> ^collection copyFrom: position + 1 to: (position >> := position + count) ] ]. >> >> this gets it wrong, I think it should be something like, to: >> (position := position + count -1) - 1 > > Seems like Cuis has an older version of the filestream buffering. This > bug was fixed later in the Trunk, here's the current version: > > collection ifNotNil: [ > (position < readLimit and: [ > (pos := collection indexOf: delim startingAt: position + > 1) <= readLimit and: [ > pos > 0 ] ]) ifTrue: [ > ^collection copyFrom: position + 1 to: (position > := pos) - 1 ] ]. > > > Levente methods that I need to load in Cuis. Will have this ready soon. Cheers, Juan Vuletich |
Free forum by Nabble | Edit this page |