searching for Classes defining inst/class var named

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

searching for Classes defining inst/class var named

jtuchel
I just stumbled across something that left me stunned: I wanted to search for Class(es) that define an instance variable named #fileContents

I knew there is such a Class and it is loaded in the image. And I know that class is neither implementing a getter nor setter for this variable.
But I found no way to search for it.

I tried "References" but that only finds another implementor of a method named #fileContents.

I can hardly believe I never had this problem before, and I also can hardly believe there is no way to find Classes defining a variable by the variable's name. Or am I missing something here? I looked all that's available in my Transcript's Tools Menu - and found... nothing! In the Query submenu there is "Classes Using Pool...", but nothing that allows me to search vor variable names... The only thing that comes close is VA Assist's "Browse Methods Including String..." but it is a bit slow...

Strange, isn't it? *scratching head*


Joachim


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/3b21ed2b-3e2c-4cee-a727-7ebc0e4574a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching for Classes defining inst/class var named

Seth Berman
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

On Friday, May 17, 2019 at 5:11:43 AM UTC-4, Joachim Tuchel wrote:
I just stumbled across something that left me stunned: I wanted to search for Class(es) that define an instance variable named #fileContents

I knew there is such a Class and it is loaded in the image. And I know that class is neither implementing a getter nor setter for this variable.
But I found no way to search for it.

I tried "References" but that only finds another implementor of a method named #fileContents.

I can hardly believe I never had this problem before, and I also can hardly believe there is no way to find Classes defining a variable by the variable's name. Or am I missing something here? I looked all that's available in my Transcript's Tools Menu - and found... nothing! In the Query submenu there is "Classes Using Pool...", but nothing that allows me to search vor variable names... The only thing that comes close is VA Assist's "Browse Methods Including String..." but it is a bit slow...

Strange, isn't it? *scratching head*


Joachim


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/22570e08-f5b7-44d8-b2dd-cf02f0b0c6f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching for Classes defining inst/class var named

Richard Sargent
Administrator
On Friday, May 17, 2019 at 8:45:13 AM UTC-7, Seth Berman wrote:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect


We can forget just how easily Smalltalk code can be searched! 

But, I wouldn't use #allInstVarNames, since that will also give you the subclasses of the one which declared the instance variable.


- Seth

On Friday, May 17, 2019 at 5:11:43 AM UTC-4, Joachim Tuchel wrote:
I just stumbled across something that left me stunned: I wanted to search for Class(es) that define an instance variable named #fileContents

I knew there is such a Class and it is loaded in the image. And I know that class is neither implementing a getter nor setter for this variable.
But I found no way to search for it.

I tried "References" but that only finds another implementor of a method named #fileContents.

I can hardly believe I never had this problem before, and I also can hardly believe there is no way to find Classes defining a variable by the variable's name. Or am I missing something here? I looked all that's available in my Transcript's Tools Menu - and found... nothing! In the Query submenu there is "Classes Using Pool...", but nothing that allows me to search vor variable names... The only thing that comes close is VA Assist's "Browse Methods Including String..." but it is a bit slow...

Strange, isn't it? *scratching head*


Joachim


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/ae6499e0-da04-4d22-995d-4d51a8dc5269%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching for Classes defining inst/class var named

Seth Berman
Nice catch!

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'elements'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls instVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

On Friday, May 17, 2019 at 1:20:03 PM UTC-4, Richard Sargent wrote:
On Friday, May 17, 2019 at 8:45:13 AM UTC-7, Seth Berman wrote:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect


We can forget just how easily Smalltalk code can be searched! 

But, I wouldn't use #allInstVarNames, since that will also give you the subclasses of the one which declared the instance variable.


- Seth

On Friday, May 17, 2019 at 5:11:43 AM UTC-4, Joachim Tuchel wrote:
I just stumbled across something that left me stunned: I wanted to search for Class(es) that define an instance variable named #fileContents

I knew there is such a Class and it is loaded in the image. And I know that class is neither implementing a getter nor setter for this variable.
But I found no way to search for it.

I tried "References" but that only finds another implementor of a method named #fileContents.

I can hardly believe I never had this problem before, and I also can hardly believe there is no way to find Classes defining a variable by the variable's name. Or am I missing something here? I looked all that's available in my Transcript's Tools Menu - and found... nothing! In the Query submenu there is "Classes Using Pool...", but nothing that allows me to search vor variable names... The only thing that comes close is VA Assist's "Browse Methods Including String..." but it is a bit slow...

Strange, isn't it? *scratching head*


Joachim


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/959f4ed2-df6a-492b-a2ea-a484d7b5d44d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching for Classes defining inst/class var named

jtuchel
In reply to this post by Seth Berman
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

On Friday, May 17, 2019 at 5:11:43 AM UTC-4, Joachim Tuchel wrote:
I just stumbled across something that left me stunned: I wanted to search for Class(es) that define an instance variable named #fileContents

I knew there is such a Class and it is loaded in the image. And I know that class is neither implementing a getter nor setter for this variable.
But I found no way to search for it.

I tried "References" but that only finds another implementor of a method named #fileContents.

I can hardly believe I never had this problem before, and I also can hardly believe there is no way to find Classes defining a variable by the variable's name. Or am I missing something here? I looked all that's available in my Transcript's Tools Menu - and found... nothing! In the Query submenu there is "Classes Using Pool...", but nothing that allows me to search vor variable names... The only thing that comes close is VA Assist's "Browse Methods Including String..." but it is a bit slow...

Strange, isn't it? *scratching head*


Joachim


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/5ea82d33-6452-4fc8-b905-49e3a4db95f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching for Classes defining inst/class var named

Mariano Martinez Peck-2


On Sat, May 18, 2019 at 2:11 AM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!



So, you have the material for your next blog post? 

:)


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAOUkibF6BpSPLMGdCjFDjXYa1g%2BrZMhEC9kjuh7Drp4eAkSTLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching for Classes defining inst/class var named

jtuchel
Oh, you mean the one for last week... ?


;-)

Am Montag, 20. Mai 2019 17:40:42 UTC+2 schrieb Mariano Martinez Peck:


On Sat, May 18, 2019 at 2:11 AM Joachim Tuchel <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="MLFZZrUWBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jtu...@...> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!



So, you have the material for your next blog post? 

:)


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.
Email: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="MLFZZrUWBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mp...@instantiations.com
Twitter: <a href="https://twitter.com/MartinezPeck" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftwitter.com%2FMartinezPeck\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFPV-7Bnc-U6phGEh-VZU0iUtY7vw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftwitter.com%2FMartinezPeck\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFPV-7Bnc-U6phGEh-VZU0iUtY7vw&#39;;return true;">https://twitter.com/MartinezPeck
LinkedIn: <a href="https://www.linkedin.com/in/mariano-mart%C3%ADnez-peck/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.linkedin.com%2Fin%2Fmariano-mart%25C3%25ADnez-peck%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyJTUAWXPstaw4J3OpFUYRyFAqmw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.linkedin.com%2Fin%2Fmariano-mart%25C3%25ADnez-peck%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyJTUAWXPstaw4J3OpFUYRyFAqmw&#39;;return true;">www.linkedin.com/in/mariano-martinez-peck
Blog: <a href="https://marianopeck.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmarianopeck.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHAOaIsyMIYgmQWdQZRuKRdD6gBfw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmarianopeck.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHAOaIsyMIYgmQWdQZRuKRdD6gBfw&#39;;return true;">https://marianopeck.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/289f71c4-d9d8-4e68-bef4-e5b31e97ca8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Searching for Classes defining #aSymbol

peter.ode
In reply to this post by jtuchel
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CANnR5L2N6nKXV7tuvQPeRUXoweitrLFYrQvB2tjjQ-5Qz-F0Lg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Searching for Classes defining #aSymbol

Seth Berman
Hi Peter,

To find a symbol literal, you should be able to use the "Browse References" menu item
Transcript -> Tools -> Browse References...

You can do more exhaustive regex searches using VA Assist "Find String"
Class Browser Menu -> Classes -> VA Assist Pro Tools -> Find String -> In System...
then type a pattern.

Is this what you are looking for?

- Seth

On Monday, May 27, 2019 at 4:29:25 PM UTC-4, Peter Ode wrote:
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Searching for Classes defining #aSymbol

peter.ode
Hi Seth,

Thank you for the suggestions.
I'm using an older version of VAST so don't have VA Assist Pro Tools and Browse References does not return anything.

I've installed Class Text Finder (by Runar Jordahl) but that doesn't help for finding symbols.

Any suggestions?
Thank you.

Peter




On Mon, May 27, 2019 at 1:37 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

To find a symbol literal, you should be able to use the "Browse References" menu item
Transcript -> Tools -> Browse References...

You can do more exhaustive regex searches using VA Assist "Find String"
Class Browser Menu -> Classes -> VA Assist Pro Tools -> Find String -> In System...
then type a pattern.

Is this what you are looking for?

- Seth

On Monday, May 27, 2019 at 4:29:25 PM UTC-4, Peter Ode wrote:
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CANnR5L1jgk%3DJPXHPaBeU_HonQj1v%2B0XGZvZTDEOLbUC1%3DOXDWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Searching for Classes defining #aSymbol

Seth Berman
Hi Peter,

Perhaps the following?
| result findMe query |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | 
cls methodsDo: [:m | 
(query value: m) ifTrue: [col add: m]]]. col].
result inspect

On Monday, May 27, 2019 at 4:51:44 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you for the suggestions.
I'm using an older version of VAST so don't have VA Assist Pro Tools and Browse References does not return anything.

I've installed Class Text Finder (by Runar Jordahl) but that doesn't help for finding symbols.

Any suggestions?
Thank you.

Peter




On Mon, May 27, 2019 at 1:37 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

To find a symbol literal, you should be able to use the "Browse References" menu item
Transcript -> Tools -> Browse References...

You can do more exhaustive regex searches using VA Assist "Find String"
Class Browser Menu -> Classes -> VA Assist Pro Tools -> Find String -> In System...
then type a pattern.

Is this what you are looking for?

- Seth

On Monday, May 27, 2019 at 4:29:25 PM UTC-4, Peter Ode wrote:
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Searching for Classes defining #aSymbol

peter.ode
Hi Seth,

Thank you. The code you provided did find many symbols after I did a minor fix (added symbolLiteralQuery to the variables declarations in the 1st line) as follows:

| result findMe query symbolLiteralQuery |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls |
cls methodsDo: [:m |
(query value: m) ifTrue: [col add: m]]]. col].
result inspect.


Although the above worked for many symbols, there are some specific symbols that it does not find.
Therefore, I'm still trying to find certain methods based on #aSymbol.

Peter



On Mon, May 27, 2019 at 2:03 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Perhaps the following?
| result findMe query |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | 
cls methodsDo: [:m | 
(query value: m) ifTrue: [col add: m]]]. col].
result inspect

On Monday, May 27, 2019 at 4:51:44 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you for the suggestions.
I'm using an older version of VAST so don't have VA Assist Pro Tools and Browse References does not return anything.

I've installed Class Text Finder (by Runar Jordahl) but that doesn't help for finding symbols.

Any suggestions?
Thank you.

Peter




On Mon, May 27, 2019 at 1:37 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

To find a symbol literal, you should be able to use the "Browse References" menu item
Transcript -> Tools -> Browse References...

You can do more exhaustive regex searches using VA Assist "Find String"
Class Browser Menu -> Classes -> VA Assist Pro Tools -> Find String -> In System...
then type a pattern.

Is this what you are looking for?

- Seth

On Monday, May 27, 2019 at 4:29:25 PM UTC-4, Peter Ode wrote:
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CANnR5L3B5Mz_SshyDDVOt9QkB-_7ms_ORZotxyo7mk38PBN9OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Searching for Classes defining #aSymbol

Seth Berman
Hi Peter,

Can you give me an example?  If so, I can probably expand it, but I don't know what this might refer to.
The code I provided assumes that this code that has been loaded into the image.
Traversing an envy repository (including code not in your local image) was not provided.

- Seth

On Monday, May 27, 2019 at 5:14:56 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you. The code you provided did find many symbols after I did a minor fix (added symbolLiteralQuery to the variables declarations in the 1st line) as follows:

| result findMe query symbolLiteralQuery |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls |
cls methodsDo: [:m |
(query value: m) ifTrue: [col add: m]]]. col].
result inspect.


Although the above worked for many symbols, there are some specific symbols that it does not find.
Therefore, I'm still trying to find certain methods based on #aSymbol.

Peter



On Mon, May 27, 2019 at 2:03 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Perhaps the following?
| result findMe query |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | 
cls methodsDo: [:m | 
(query value: m) ifTrue: [col add: m]]]. col].
result inspect

On Monday, May 27, 2019 at 4:51:44 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you for the suggestions.
I'm using an older version of VAST so don't have VA Assist Pro Tools and Browse References does not return anything.

I've installed Class Text Finder (by Runar Jordahl) but that doesn't help for finding symbols.

Any suggestions?
Thank you.

Peter




On Mon, May 27, 2019 at 1:37 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

To find a symbol literal, you should be able to use the "Browse References" menu item
Transcript -> Tools -> Browse References...

You can do more exhaustive regex searches using VA Assist "Find String"
Class Browser Menu -> Classes -> VA Assist Pro Tools -> Find String -> In System...
then type a pattern.

Is this what you are looking for?

- Seth

On Monday, May 27, 2019 at 4:29:25 PM UTC-4, Peter Ode wrote:
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/b96faa3e-9843-4ee3-903c-3c1ed4b237f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Searching for Classes defining #aSymbol

peter.ode
Hi Seth,

Thanks again. Here's an example for our VA Smalltalk based eCommerce system. 
We have developed a template system for dynamic web pages, static pages and email messages. Below is a snipped from an email message template that includes #theSymbols I'm looking for.

<#include _order_top.txt>
*** <#atWebLabel> Confirmation # <#atId> ***

You should retain a copy of this Order Confirmation for your records.

Dear <#atProfileEntityFullNameStartingWithFirstName>,

Thank you for your Internet Order.
...

Using your "findMe" code snippet, I'm able to find #atId and #atWebLabel but 
can't find: #atProfileEntityFullNameStartingWithFirstName

This is a production system that I've inherited (in terms of support) and need to make some changes to the code. 
The image must have the code loaded somewhere that contains: #atProfileEntityFullNameStartingWithFirstName

Many thanks.

Peter

On Mon, May 27, 2019 at 2:20 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Can you give me an example?  If so, I can probably expand it, but I don't know what this might refer to.
The code I provided assumes that this code that has been loaded into the image.
Traversing an envy repository (including code not in your local image) was not provided.

- Seth

On Monday, May 27, 2019 at 5:14:56 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you. The code you provided did find many symbols after I did a minor fix (added symbolLiteralQuery to the variables declarations in the 1st line) as follows:

| result findMe query symbolLiteralQuery |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls |
cls methodsDo: [:m |
(query value: m) ifTrue: [col add: m]]]. col].
result inspect.


Although the above worked for many symbols, there are some specific symbols that it does not find.
Therefore, I'm still trying to find certain methods based on #aSymbol.

Peter



On Mon, May 27, 2019 at 2:03 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Perhaps the following?
| result findMe query |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | 
cls methodsDo: [:m | 
(query value: m) ifTrue: [col add: m]]]. col].
result inspect

On Monday, May 27, 2019 at 4:51:44 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you for the suggestions.
I'm using an older version of VAST so don't have VA Assist Pro Tools and Browse References does not return anything.

I've installed Class Text Finder (by Runar Jordahl) but that doesn't help for finding symbols.

Any suggestions?
Thank you.

Peter




On Mon, May 27, 2019 at 1:37 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

To find a symbol literal, you should be able to use the "Browse References" menu item
Transcript -> Tools -> Browse References...

You can do more exhaustive regex searches using VA Assist "Find String"
Class Browser Menu -> Classes -> VA Assist Pro Tools -> Find String -> In System...
then type a pattern.

Is this what you are looking for?

- Seth

On Monday, May 27, 2019 at 4:29:25 PM UTC-4, Peter Ode wrote:
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/b96faa3e-9843-4ee3-903c-3c1ed4b237f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CANnR5L2Q5YjEQBMhAnPvxqMj%2BnLgXCQhj6LLMRRe1%2BNZrUWSew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Searching for Classes defining #aSymbol

Seth Berman
Hi Peter,

Ok, so those look like symbols in that they have a leading #, but I'm guessing they are not literal symbols (as in instances of the Symbol class)...at least not at compile time.
So, it seems like what you really need is just source text search?
How is this template stored?  Is it stored as just a String in a method...or is there something else going on.
In the meantime, I can just put together a simple string search for your purposes.
See if this one gets what you need.

| result findMe query symbolLiteralQuery strTemplateQuery |

findMe := #aSymbol.

symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
strTemplateQuery := [:cm | | stream findStr done found  |
stream := cm sourceString readStream.
findStr := findMe asString.
done := stream atEnd.
found := false.
[done] whileFalse: [
((stream skipTo: $#) 
and: [((stream contents size - stream position) >= findMe size)
and: [(stream next: findMe size) = findStr]])
ifTrue: [done := found := true] ifFalse: [done := stream atEnd]]. found].

result := System classHierarchyRoots
inject: Set new
into: [:col :root | root withAllSubclassesDo: [:cls | 
cls methodsDo: [:m |  ((symbolLiteralQuery value: m) or: [strTemplateQuery value: m]) ifTrue: [col add: m]]]. col].
result asOrderedCollection inspect.

- Seth

On Monday, May 27, 2019 at 6:13:11 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thanks again. Here's an example for our VA Smalltalk based eCommerce system. 
We have developed a template system for dynamic web pages, static pages and email messages. Below is a snipped from an email message template that includes #theSymbols I'm looking for.

<#include _order_top.txt>
*** <#atWebLabel> Confirmation # <#atId> ***

You should retain a copy of this Order Confirmation for your records.

Dear <#atProfileEntityFullNameStartingWithFirstName>,

Thank you for your Internet Order.
...

Using your "findMe" code snippet, I'm able to find #atId and #atWebLabel but 
can't find: #atProfileEntityFullNameStartingWithFirstName

This is a production system that I've inherited (in terms of support) and need to make some changes to the code. 
The image must have the code loaded somewhere that contains: #atProfileEntityFullNameStartingWithFirstName

Many thanks.

Peter

On Mon, May 27, 2019 at 2:20 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Can you give me an example?  If so, I can probably expand it, but I don't know what this might refer to.
The code I provided assumes that this code that has been loaded into the image.
Traversing an envy repository (including code not in your local image) was not provided.

- Seth

On Monday, May 27, 2019 at 5:14:56 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you. The code you provided did find many symbols after I did a minor fix (added symbolLiteralQuery to the variables declarations in the 1st line) as follows:

| result findMe query symbolLiteralQuery |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls |
cls methodsDo: [:m |
(query value: m) ifTrue: [col add: m]]]. col].
result inspect.


Although the above worked for many symbols, there are some specific symbols that it does not find.
Therefore, I'm still trying to find certain methods based on #aSymbol.

Peter



On Mon, May 27, 2019 at 2:03 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Perhaps the following?
| result findMe query |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | 
cls methodsDo: [:m | 
(query value: m) ifTrue: [col add: m]]]. col].
result inspect

On Monday, May 27, 2019 at 4:51:44 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you for the suggestions.
I'm using an older version of VAST so don't have VA Assist Pro Tools and Browse References does not return anything.

I've installed Class Text Finder (by Runar Jordahl) but that doesn't help for finding symbols.

Any suggestions?
Thank you.

Peter




On Mon, May 27, 2019 at 1:37 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

To find a symbol literal, you should be able to use the "Browse References" menu item
Transcript -> Tools -> Browse References...

You can do more exhaustive regex searches using VA Assist "Find String"
Class Browser Menu -> Classes -> VA Assist Pro Tools -> Find String -> In System...
then type a pattern.

Is this what you are looking for?

- Seth

On Monday, May 27, 2019 at 4:29:25 PM UTC-4, Peter Ode wrote:
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/b96faa3e-9843-4ee3-903c-3c1ed4b237f7%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/b96faa3e-9843-4ee3-903c-3c1ed4b237f7%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/b96faa3e-9843-4ee3-903c-3c1ed4b237f7%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/b96faa3e-9843-4ee3-903c-3c1ed4b237f7%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/5ada5326-be19-4f67-82d5-f591ceaa16ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Searching for Classes defining #aSymbol

peter.ode
Hi Seth,

The templates are stored as text files on disk. For example: order.txt

But, I do not need to search the templates.

I only need to search for methods in the image that process the "tags" that look like symbols.
You are correct, #atProfileEntityFullNameStartingWithFirstName may not be a real #symbol.

I'm now checking the last code snippet you provided. Thanks.

Peter



On Mon, May 27, 2019 at 3:57 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Ok, so those look like symbols in that they have a leading #, but I'm guessing they are not literal symbols (as in instances of the Symbol class)...at least not at compile time.
So, it seems like what you really need is just source text search?
How is this template stored?  Is it stored as just a String in a method...or is there something else going on.
In the meantime, I can just put together a simple string search for your purposes.
See if this one gets what you need.

| result findMe query symbolLiteralQuery strTemplateQuery |

findMe := #aSymbol.

symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
strTemplateQuery := [:cm | | stream findStr done found  |
stream := cm sourceString readStream.
findStr := findMe asString.
done := stream atEnd.
found := false.
[done] whileFalse: [
((stream skipTo: $#) 
and: [((stream contents size - stream position) >= findMe size)
and: [(stream next: findMe size) = findStr]])
ifTrue: [done := found := true] ifFalse: [done := stream atEnd]]. found].

result := System classHierarchyRoots
inject: Set new
into: [:col :root | root withAllSubclassesDo: [:cls | 
cls methodsDo: [:m |  ((symbolLiteralQuery value: m) or: [strTemplateQuery value: m]) ifTrue: [col add: m]]]. col].
result asOrderedCollection inspect.

- Seth

On Monday, May 27, 2019 at 6:13:11 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thanks again. Here's an example for our VA Smalltalk based eCommerce system. 
We have developed a template system for dynamic web pages, static pages and email messages. Below is a snipped from an email message template that includes #theSymbols I'm looking for.

<#include _order_top.txt>
*** <#atWebLabel> Confirmation # <#atId> ***

You should retain a copy of this Order Confirmation for your records.

Dear <#atProfileEntityFullNameStartingWithFirstName>,

Thank you for your Internet Order.
...

Using your "findMe" code snippet, I'm able to find #atId and #atWebLabel but 
can't find: #atProfileEntityFullNameStartingWithFirstName

This is a production system that I've inherited (in terms of support) and need to make some changes to the code. 
The image must have the code loaded somewhere that contains: #atProfileEntityFullNameStartingWithFirstName

Many thanks.

Peter

On Mon, May 27, 2019 at 2:20 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Can you give me an example?  If so, I can probably expand it, but I don't know what this might refer to.
The code I provided assumes that this code that has been loaded into the image.
Traversing an envy repository (including code not in your local image) was not provided.

- Seth

On Monday, May 27, 2019 at 5:14:56 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you. The code you provided did find many symbols after I did a minor fix (added symbolLiteralQuery to the variables declarations in the 1st line) as follows:

| result findMe query symbolLiteralQuery |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls |
cls methodsDo: [:m |
(query value: m) ifTrue: [col add: m]]]. col].
result inspect.


Although the above worked for many symbols, there are some specific symbols that it does not find.
Therefore, I'm still trying to find certain methods based on #aSymbol.

Peter



On Mon, May 27, 2019 at 2:03 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

Perhaps the following?
| result findMe query |

findMe := #aSymbol.

"Place your selected query block in the 'query' var"
symbolLiteralQuery := [:cm | cm allLiterals anySatisfy: [:lit | lit == findMe]].
query := symbolLiteralQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | 
cls methodsDo: [:m | 
(query value: m) ifTrue: [col add: m]]]. col].
result inspect

On Monday, May 27, 2019 at 4:51:44 PM UTC-4, Peter Ode wrote:
Hi Seth,

Thank you for the suggestions.
I'm using an older version of VAST so don't have VA Assist Pro Tools and Browse References does not return anything.

I've installed Class Text Finder (by Runar Jordahl) but that doesn't help for finding symbols.

Any suggestions?
Thank you.

Peter




On Mon, May 27, 2019 at 1:37 PM 'Seth Berman' via VA Smalltalk <[hidden email]> wrote:
Hi Peter,

To find a symbol literal, you should be able to use the "Browse References" menu item
Transcript -> Tools -> Browse References...

You can do more exhaustive regex searches using VA Assist "Find String"
Class Browser Menu -> Classes -> VA Assist Pro Tools -> Find String -> In System...
then type a pattern.

Is this what you are looking for?

- Seth

On Monday, May 27, 2019 at 4:29:25 PM UTC-4, Peter Ode wrote:
I read your code search posts with interest. 
I have been trying to find methods with #aSymbol
without success.

The code provided for your snippet search does not work for this purpose.

Are there other ways to search an entire image for specific source code text?
Specifically, I need to find certain symbols?

Thank you.

Peter




On Fri, May 17, 2019 at 10:11 PM Joachim Tuchel <[hidden email]> wrote:
HI Seth,

first of all, thanks for your code example. Works well and is much faster than "Methods including text".

I agree this is not a common search. And the menus in VAST are presenting a vast selection of options, so I fully agree we don't want or need another battery of search options in the menus.
My comment was not so much a complaint about a missing feature. I mostly wanted to share my surprise about the fact I almost never needed it before (or maybe did, but can't remember) and that here really is no way to do it (unless with a code snippet) although Smalltalk allows for such queries easily - as you just proved with your code.

Your code is a nice prototype for a system-wide, multi-purpose search field ;-)

Again, thanks a lot!




Am Freitag, 17. Mai 2019 17:45:13 UTC+2 schrieb Seth Berman:
Hi Joachim,

It seems like you answered your own question when you stated "I can hardly believe I never had this problem before".
I don't think your alone in this, because I don't think its a very common query.  Or if it is, I can't recall the last time I needed
to locate, from a global scope, a class on the basis of a property name...be it a instVar, classVar or classInstVar.

I'm not saying its never happened...and each to their own style of thinking of course, but it just doesn't seem like a very common query to me
and therefore not something we've been asked to add to the menus.
It seems reasonable that not every combination of query Object meta-state is going to be captured in menu items.
If we go down this route...I think the better solution is to have a more generic query construction capability that allows for querying
any combination of state such as instVar, classVar, classInstVar names or counts, shape (i.e. bytes, words, longs, pointer), byte size and so forth ....
There's lots of others that I could come up with.

But, in the interest of being helpful, I provide the following which I hope will get you the information you need.

| result findMe instVarQuery classVarQuery classInstVarQuery query |

findMe := 'instVar'.

"Place your selected query block in the 'query' var"
instVarQuery := [:cls | (cls allInstVarNames indexOf: findMe) > 0].
classVarQuery := [:cls | cls classPool includesKey: findMe].
classInstVarQuery := [:cls | instVarQuery value: cls class].
query := instVarQuery.

result := System classHierarchyRoots
inject: OrderedCollection new
into: [:col :root | root withAllSubclassesDo: [:cls | (query value: cls) ifTrue: [col add: cls asClass]]. col].
result inspect

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/9d9cdc84-dd38-4f4d-9f8a-316631b73027%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/928171e6-8f77-42b5-9ed7-03949424f586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/b96faa3e-9843-4ee3-903c-3c1ed4b237f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/5ada5326-be19-4f67-82d5-f591ceaa16ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CANnR5L2icf-CQ5V6xhd6n11YY4R--OHT06u9Xt3CVfEvzHBG_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.