The Trunk: 45Deprecated-nice.22.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: 45Deprecated-nice.22.mcz

commits-2
Nicolas Cellier uploaded a new version of 45Deprecated to project The Trunk:
http://source.squeak.org/trunk/45Deprecated-nice.22.mcz

==================== Summary ====================

Name: 45Deprecated-nice.22
Author: nice
Time: 13 December 2013, 12:46:20.984 am
UUID: 6d95f31a-c2fc-44ed-8d57-bf17f0ec1a0e
Ancestors: 45Deprecated-fbs.21

Properly deprecate Parser>>initPattern:notifying:return: and provide a deserved explanation.

=============== Diff against 45Deprecated-fbs.21 ===============

Item was added:
+ ----- Method: Parser>>initPattern:notifying:return: (in category '*45Deprecated') -----
+ initPattern: aString notifying: req return: aBlock
+
+ req
+ ifNil:
+ [self deprecated: 'Notifying nil is unnecessary, simply use #initPattern:return:'.
+ ^self initPattern: aString notifying: req return: aBlock]
+ ifNotNil:
+ [| result |
+ self deprecated: '#initPattern:return: was preferred because everybody was notifying nil, but you.
+ You could ask for re-integration of this message'.
+ self
+ init: (ReadStream on: aString asString)
+ cue: (CompilationCue source: aString requestor: req)
+ failBlock: [^nil].
+ encoder := self.
+ result := aBlock value: (self pattern: false inContext: nil).
+ encoder := failBlock := nil.  "break cycles"
+ ^result]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: 45Deprecated-nice.22.mcz

Frank Shearar-3
I really like that ifNotNil: deprecation message :)

frank

On 12 Dec 2013, at 23:46, [hidden email] wrote:

> Nicolas Cellier uploaded a new version of 45Deprecated to project The Trunk:
> http://source.squeak.org/trunk/45Deprecated-nice.22.mcz
>
> ==================== Summary ====================
>
> Name: 45Deprecated-nice.22
> Author: nice
> Time: 13 December 2013, 12:46:20.984 am
> UUID: 6d95f31a-c2fc-44ed-8d57-bf17f0ec1a0e
> Ancestors: 45Deprecated-fbs.21
>
> Properly deprecate Parser>>initPattern:notifying:return: and provide a deserved explanation.
>
> =============== Diff against 45Deprecated-fbs.21 ===============
>
> Item was added:
> + ----- Method: Parser>>initPattern:notifying:return: (in category '*45Deprecated') -----
> + initPattern: aString notifying: req return: aBlock
> +
> +    req
> +        ifNil:
> +            [self deprecated: 'Notifying nil is unnecessary, simply use #initPattern:return:'.
> +            ^self initPattern: aString notifying: req return: aBlock]
> +        ifNotNil:
> +            [| result |
> +            self deprecated: '#initPattern:return: was preferred because everybody was notifying nil, but you.
> + You could ask for re-integration of this message'.
> +            self
> +                init: (ReadStream on: aString asString)
> +                cue: (CompilationCue source: aString requestor: req)
> +                failBlock: [^nil].
> +            encoder := self.
> +            result := aBlock value: (self pattern: false inContext: nil).
> +            encoder := failBlock := nil.  "break cycles"
> +            ^result]!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: 45Deprecated-nice.22.mcz

Tony Garnock-Jones-3
On 12/13/2013 03:44 AM, Frank Shearar wrote:
> I really like that ifNotNil: deprecation message :)

Which piqued my interest, so I looked, and...

>> + initPattern: aString notifying: req return: aBlock
>> [...]
>> +            ^self initPattern: aString notifying: req return: aBlock]

... isn't that an infinite (recursive) loop?

Tony

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: 45Deprecated-nice.22.mcz

Frank Shearar-3
On 13 December 2013 15:04, Tony Garnock-Jones <[hidden email]> wrote:

> On 12/13/2013 03:44 AM, Frank Shearar wrote:
>> I really like that ifNotNil: deprecation message :)
>
> Which piqued my interest, so I looked, and...
>
>>> + initPattern: aString notifying: req return: aBlock
>>> [...]
>>> +            ^self initPattern: aString notifying: req return: aBlock]
>
> ... isn't that an infinite (recursive) loop?

Yes, I do believe it is! It looks like the line should say

    ^ self initPattern: aString return: aBlock

frank

> Tony
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: 45Deprecated-nice.22.mcz

Nicolas Cellier
Oh, blush, never publish untested code... My attention was focused on ifNotNil: handling.


2013/12/13 Frank Shearar <[hidden email]>
On 13 December 2013 15:04, Tony Garnock-Jones <[hidden email]> wrote:
> On 12/13/2013 03:44 AM, Frank Shearar wrote:
>> I really like that ifNotNil: deprecation message :)
>
> Which piqued my interest, so I looked, and...
>
>>> + initPattern: aString notifying: req return: aBlock
>>> [...]
>>> +            ^self initPattern: aString notifying: req return: aBlock]
>
> ... isn't that an infinite (recursive) loop?

Yes, I do believe it is! It looks like the line should say

    ^ self initPattern: aString return: aBlock

frank

> Tony
>