Rewrite Tool Conundrum

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

Rewrite Tool Conundrum

Peter Suk

Howdy folks,

 

The use of “`@statements” type meta variables in the Rewrite Tool is nto doing what I’d expect.

 

I created a subclass of Object named Thingy, with a single method.  For the purpose of this example, I just left it in the Base VisualWorks bundle.

 

initialize

            self yourself.

            self printString.

            self perform: #yourself.

            self halt.

            self yourself.

            ^self

 

 

Then, I click on the Base bundle in the browser, go to the Rewrite tab and do the following search:

 

`obj perform: `#symbol.

 

 

The pattern matches and finds my initialize method.  However, if I search for:

 

`obj perform: `#symbol.

`@.statements2

 

 

Or

 

`@.statements1

`obj perform: `#symbol.

`@.statements2

 

 

Then I find nothing.  What gives? 

 

--Peter

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Rewrite Tool Conundrum

Charles A. Monteiro-2
I so wish there was a terse, clean Smalltalky way of asking these things  
of the Re-write framework. I know that it can be done programmatically but  
last I looked at examples it was a bit more involved than what I would  
like.

-Charles

On Thu, 23 Mar 2006 12:15:08 -0500, Peter Suk <[hidden email]> wrote:

> Howdy folks,
>
>
> The use of "`@statements" type meta variables in the Rewrite Tool is nto
> doing what I'd expect.
>
>
> I created a subclass of Object named Thingy, with a single method.  For
> the purpose of this example, I just left it in the Base VisualWorks
> bundle.
>
>
> initialize
>
>             self yourself.
>
>             self printString.
>
>             self perform: #yourself.
>
>             self halt.
>
>             self yourself.
>
>             ^self
>
>
>
> Then, I click on the Base bundle in the browser, go to the Rewrite tab
> and do the following search:
>
>
> `obj perform: `#symbol.
>
>
>
> The pattern matches and finds my initialize method.  However, if I
> search for:
>
>
> `obj perform: `#symbol.
>
> `@.statements2
>
>
>
> Or
>
>
> `@.statements1
>
> `obj perform: `#symbol.
>
> `@.statements2
>
>
>
> Then I find nothing.  What gives?
>
>
> --Peter
>
>
>



--
Charles A. Monteiro

Reply | Threaded
Open this post in threaded view
|

RE: Rewrite Tool Conundrum

Peter Suk
In reply to this post by Peter Suk
It is a modified Smalltalk syntax, after all, and you also have direct
access to the parse tree if you compose a { } block.  The API for the
parse tree seems hairy -- you have to jack around with Dictionaries for
example.  

Don't know if it's so much that it's not Smalltalky.  More that it's
just hairy to begin with.  

--Peter


> -----Original Message-----
> From: Charles A. Monteiro [mailto:[hidden email]]
> Sent: Thursday, March 23, 2006 12:06 PM
> To: Peter Suk; [hidden email]
> Subject: Re: Rewrite Tool Conundrum
>
> I so wish there was a terse, clean Smalltalky way of asking these
things
> of the Re-write framework. I know that it can be done programmatically
but

> last I looked at examples it was a bit more involved than what I would
> like.
>
> -Charles
>
> On Thu, 23 Mar 2006 12:15:08 -0500, Peter Suk <[hidden email]> wrote:
>
> > Howdy folks,
> >
> >
> > The use of "`@statements" type meta variables in the Rewrite Tool is
nto
> > doing what I'd expect.
> >
> >
> > I created a subclass of Object named Thingy, with a single method.
For

> > the purpose of this example, I just left it in the Base VisualWorks
> > bundle.
> >
> >
> > initialize
> >
> >             self yourself.
> >
> >             self printString.
> >
> >             self perform: #yourself.
> >
> >             self halt.
> >
> >             self yourself.
> >
> >             ^self
> >
> >
> >
> > Then, I click on the Base bundle in the browser, go to the Rewrite
tab

> > and do the following search:
> >
> >
> > `obj perform: `#symbol.
> >
> >
> >
> > The pattern matches and finds my initialize method.  However, if I
> > search for:
> >
> >
> > `obj perform: `#symbol.
> >
> > `@.statements2
> >
> >
> >
> > Or
> >
> >
> > `@.statements1
> >
> > `obj perform: `#symbol.
> >
> > `@.statements2
> >
> >
> >
> > Then I find nothing.  What gives?
> >
> >
> > --Peter
> >
> >
> >
>
>
>
> --
> Charles A. Monteiro

Reply | Threaded
Open this post in threaded view
|

RE: Rewrite Tool Conundrum

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Peter Suk
Its not *that* bad :) You were just missing a period at the end of the first
line,

`@.statements1.
`obj perform: `#symbol.
`@.statements2

That'll work.

Cheers!

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: Peter Suk [mailto:[hidden email]]
Sent: Thursday, March 23, 2006 10:07 AM
To: [hidden email]
Subject: RE: Rewrite Tool Conundrum

It is a modified Smalltalk syntax, after all, and you also have direct
access to the parse tree if you compose a { } block.  The API for the
parse tree seems hairy -- you have to jack around with Dictionaries for
example.  

Don't know if it's so much that it's not Smalltalky.  More that it's
just hairy to begin with.  

--Peter


> -----Original Message-----
> From: Charles A. Monteiro [mailto:[hidden email]]
> Sent: Thursday, March 23, 2006 12:06 PM
> To: Peter Suk; [hidden email]
> Subject: Re: Rewrite Tool Conundrum
>
> I so wish there was a terse, clean Smalltalky way of asking these
things
> of the Re-write framework. I know that it can be done programmatically
but

> last I looked at examples it was a bit more involved than what I would
> like.
>
> -Charles
>
> On Thu, 23 Mar 2006 12:15:08 -0500, Peter Suk <[hidden email]> wrote:
>
> > Howdy folks,
> >
> >
> > The use of "`@statements" type meta variables in the Rewrite Tool is
nto
> > doing what I'd expect.
> >
> >
> > I created a subclass of Object named Thingy, with a single method.
For

> > the purpose of this example, I just left it in the Base VisualWorks
> > bundle.
> >
> >
> > initialize
> >
> >             self yourself.
> >
> >             self printString.
> >
> >             self perform: #yourself.
> >
> >             self halt.
> >
> >             self yourself.
> >
> >             ^self
> >
> >
> >
> > Then, I click on the Base bundle in the browser, go to the Rewrite
tab

> > and do the following search:
> >
> >
> > `obj perform: `#symbol.
> >
> >
> >
> > The pattern matches and finds my initialize method.  However, if I
> > search for:
> >
> >
> > `obj perform: `#symbol.
> >
> > `@.statements2
> >
> >
> >
> > Or
> >
> >
> > `@.statements1
> >
> > `obj perform: `#symbol.
> >
> > `@.statements2
> >
> >
> >
> > Then I find nothing.  What gives?
> >
> >
> > --Peter
> >
> >
> >
>
>
>
> --
> Charles A. Monteiro


smime.p7s (4K) Download Attachment