http://code.google.com/p/pharo/issues/detail?id=2859
Stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Stef,
I was so happy to see somebody ringing the "don't return nil; raise an exception" alram that I completely missed the time (and date?) connection. Any #readFrom:* method will be inadequate due to formats. Dolphin tackles thiat with type converters, and I have a minimal set that I fully intend to grow. See http://squeaksource.com/PharoInbox/DolphinCompatibility-ValueAdapters-BillSchwab.1.mcz and repeat after me: Caveat Emptor. Beyond that, if the code runs w/o my streams enhancements installed, please let me know - I would consider that a horrible bug. Bill ________________________________________ From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]] Sent: Wednesday, August 25, 2010 5:00 PM To: [hidden email] Subject: Re: [Pharo-project] 'foo' asTime http://code.google.com/p/pharo/issues/detail?id=2859 Stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Nicolas Cellier
I would like to be *able* to use a read method to pull from a stream with other data in it. Whether it needs to be at the end when that is over is open for debate, perhaps left to the caller?? It is an important question. Off the top of my head, it seems that Dolphin somewhat dodges it for dates and times by taking strings. I can check on whether they raise errors if there is "stuff left over."
Again, I am fully supportive of raising errors by default. They help to fix a lot more trouble than they cause. ________________________________________ From: [hidden email] [[hidden email]] On Behalf Of Nicolas Cellier [[hidden email]] Sent: Wednesday, August 25, 2010 4:50 PM To: [hidden email] Subject: Re: [Pharo-project] 'foo' asTime 2010/8/25 Stéphane Ducasse <[hidden email]>: > Hi nicolas > > If I understand you correctly we are in sync. > Yes readFrom: should read or fails raising an Error > and we should use Integer readFrom: 'foo' ifFail: [the default value that the client knows that he wants] > > Now we integrated your number parsers so this is strange that the behavior is not like you mention > did you make them backwards compatible? > > So I would give a try to get readFrom: clean. > Johan please give a try > > Stef > Yes, all the infrastructure is there, just change the top message to be awkward-uncompatible ;) like Guillermo is suggesting. See also my other suggestion: implement #readFrom:ifFail: in every class instead of #readFrom: and let readFrom default implementation to just be ^self readFrom: aStream ifFail: [self error: 'invalid format'] One question I'm not sure about is whether we should distinguish 2 API's: - one for reading a single object and bark on extra-characters - IMO, this would be the correct Behaviour of #readFromString: - one for reading an object in a longer sequence of objects (just keep the stream positionned after last character read) - this would be readFrom: aStream Nicolas > > >> In squeak, (Integer readFromString: 'foo') ->Error >> >> Use: >> - Integer readFrom: 'foo' ifFail: [0], tp get backward compatibility, >> - (Integer readFrom: 'foo' ifFail: []), to get nil >> >> Though it is possible, I dislike anwsering nil, because it would mean >> a bunch of #readFrom: send should be protected by #ifNil: Blocks... >> 1) That's nonsense, readFrom:ifFail: already does the work. >> 2) you cripple the code with Error conditions and end up with >> unreadable C-looking like code >> (3 lines of Error condition crap for 1 line of underlying algorithm >> at every function call) >> 3) Exception handling can avoid long chains of ifFail: / ifNil: tests >> >> But that conversation already took place many times... >> >> I'd like the readFrom:ifFail: form to be generalized to other objects, >> with default behaviour raising an Error. What do you think ? >> >> Nicolas >> >> 2010/8/24 Johan Brichau <[hidden email]>: >>> >>> On 24 Aug 2010, at 15:19, Stéphane Ducasse wrote: >>> >>>> I thought that readFromString: was raising an error and that guessNumber* was returning zero >>> >>> I thought that too. I even have application code that shows that this used to return nil in some version of Pharo... >>> But: >>> >>> 'foo' asInteger = nil >>> Integer readFromString: 'foo' = 0 >>> 'foo' asNumber -> Error >>> >>> aargh :-( >>> >>> disclaimer: currently testing this in pharo1.1 >>> >>> Johan >>> _______________________________________________ >>> Pharo-project mailing list >>> [hidden email] >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >>> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
And now, because of fixing Integer>>readFrom:, 'foo' asTime throws an exception and we all are a bit happier :D.
On Wed, Aug 25, 2010 at 7:55 PM, Schwab,Wilhelm K <[hidden email]> wrote: I would like to be *able* to use a read method to pull from a stream with other data in it. Whether it needs to be at the end when that is over is open for debate, perhaps left to the caller?? It is an important question. Off the top of my head, it seems that Dolphin somewhat dodges it for dates and times by taking strings. I can check on whether they raise errors if there is "stuff left over." _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
On 26 Aug 2010, at 04:47, Guillermo Polito wrote: > And now, because of fixing Integer>>readFrom:, 'foo' asTime throws an exception and we all are a bit happier :D. Indeed. thanks. And just to make sure that we keep being happy, I added some unit tests to verify that in the KernelTests package ;-) Johan _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Schwab,Wilhelm K
I should look at your code. Just busy and dead tired.
Stef On Aug 25, 2010, at 11:51 PM, Schwab,Wilhelm K wrote: > Stef, > > I was so happy to see somebody ringing the "don't return nil; raise an exception" alram that I completely missed the time (and date?) connection. Any #readFrom:* method will be inadequate due to formats. Dolphin tackles thiat with type converters, and I have a minimal set that I fully intend to grow. See > > http://squeaksource.com/PharoInbox/DolphinCompatibility-ValueAdapters-BillSchwab.1.mcz > > and repeat after me: Caveat Emptor. Beyond that, if the code runs w/o my streams enhancements installed, please let me know - I would consider that a horrible bug. > > Bill > > > ________________________________________ > From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]] > Sent: Wednesday, August 25, 2010 5:00 PM > To: [hidden email] > Subject: Re: [Pharo-project] 'foo' asTime > > http://code.google.com/p/pharo/issues/detail?id=2859 > > Stef > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Stef,
It took me a while to check and release it (browser environments+Shout to the rescue), so you have some time yet :) Bill ________________________________________ From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]] Sent: Thursday, August 26, 2010 3:53 PM To: [hidden email] Subject: Re: [Pharo-project] 'foo' asTime I should look at your code. Just busy and dead tired. Stef On Aug 25, 2010, at 11:51 PM, Schwab,Wilhelm K wrote: > Stef, > > I was so happy to see somebody ringing the "don't return nil; raise an exception" alram that I completely missed the time (and date?) connection. Any #readFrom:* method will be inadequate due to formats. Dolphin tackles thiat with type converters, and I have a minimal set that I fully intend to grow. See > > http://squeaksource.com/PharoInbox/DolphinCompatibility-ValueAdapters-BillSchwab.1.mcz > > and repeat after me: Caveat Emptor. Beyond that, if the code runs w/o my streams enhancements installed, please let me know - I would consider that a horrible bug. > > Bill > > > ________________________________________ > From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]] > Sent: Wednesday, August 25, 2010 5:00 PM > To: [hidden email] > Subject: Re: [Pharo-project] 'foo' asTime > > http://code.google.com/p/pharo/issues/detail?id=2859 > > Stef > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Johan Brichau-2
johan
thanks Now get the reflex to create an issue else we get flooded of information. I will integrate them now. Stef On Aug 26, 2010, at 2:34 PM, Johan Brichau wrote: > > On 26 Aug 2010, at 04:47, Guillermo Polito wrote: > >> And now, because of fixing Integer>>readFrom:, 'foo' asTime throws an exception and we all are a bit happier :D. > > Indeed. thanks. > And just to make sure that we keep being happy, I added some unit tests to verify that in the KernelTests package ;-) > > Johan > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
err, yes it actually still is this one: http://code.google.com/p/pharo/issues/detail?id=2854
:-) On 27 Aug 2010, at 10:16, Stéphane Ducasse wrote: > johan > > thanks > Now get the reflex to create an issue else we get flooded of information. > I will integrate them now. > > Stef > > On Aug 26, 2010, at 2:34 PM, Johan Brichau wrote: > >> >> On 26 Aug 2010, at 04:47, Guillermo Polito wrote: >> >>> And now, because of fixing Integer>>readFrom:, 'foo' asTime throws an exception and we all are a bit happier :D. >> >> Indeed. thanks. >> And just to make sure that we keep being happy, I added some unit tests to verify that in the KernelTests package ;-) >> >> Johan >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Ok normally this is integrated now.
On Aug 27, 2010, at 12:11 PM, Johan Brichau wrote: > err, yes it actually still is this one: http://code.google.com/p/pharo/issues/detail?id=2854 > :-) > > On 27 Aug 2010, at 10:16, Stéphane Ducasse wrote: > >> johan >> >> thanks >> Now get the reflex to create an issue else we get flooded of information. >> I will integrate them now. >> >> Stef >> >> On Aug 26, 2010, at 2:34 PM, Johan Brichau wrote: >> >>> >>> On 26 Aug 2010, at 04:47, Guillermo Polito wrote: >>> >>>> And now, because of fixing Integer>>readFrom:, 'foo' asTime throws an exception and we all are a bit happier :D. >>> >>> Indeed. thanks. >>> And just to make sure that we keep being happy, I added some unit tests to verify that in the KernelTests package ;-) >>> >>> Johan >>> _______________________________________________ >>> Pharo-project mailing list >>> [hidden email] >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |