pharo-spec / NewTools

All development tools for Pharo, developed with Spec
21 stars 52 forks source link

Categorise rewriter rules by pragma to allow easy extension #770

Closed macta closed 1 month ago

macta commented 1 month ago

Simple change to allow easy way to add extra rules that can appear in the UI

macta commented 1 month ago

The ticket associate with this PR is https://github.com/pharo-project/pharo/issues/16753

macta commented 1 month ago

How would we feel about renaming StRewriterDemoRules to StRewriterTemplateRules, as they are more than demo rules, there are some great ones in there and potentially other libraries could add to them ? Could do it in this PR or create a new issue - whatever is easier

Ducasse commented 1 month ago

Yes tell me when you need that I have a look.

macta commented 1 month ago

@Ducasse

Yes tell me when you need that I have a look.

Not sure what you are referring to here ? And I'm not quite sure how to complete the idea in this thread and move things forward.

I think we all agree its a good idea to make the rules more extensible - so making them pragma based is an easy enhancement to what we have.

The question is what to call the pragma (the feeling seems to be that its name should match the class holding the rules) - so should I just rename that Demo class to StRewriterTemplateRules, and the pragma all in this PR?

Happy to do that and then we can move on.

In a seperate PR I can also update the docs for Rewriter - and potentially move them from a window into the normal PharoDocs format and add a paragraph with an example from my email that really helped me better understand and pull the ideas together.

I've realised the rewriter is a much underused feature - and its very cool.

Ducasse commented 1 month ago

Call it ruleDemo?

macta commented 1 month ago

Call it ruleDemo?

I think the word Demo trivialises what they do/are - many of the rules in that list are real things, you can use them now - I would say they are templates and we want projects to included templates that others should use. Thats why I think that holding class is badly named as well - particularly as the real RewriteTool links in to show them?

macta commented 1 month ago

But if you prefer I can adjust it, and at least its done.

astares commented 1 month ago

This topic confirms to me again: if one takes it serious the hardest part in programming is to find proper (intention revealing) names :)

Ducasse commented 1 month ago

Then call them exampleRule

jordanmontt commented 1 month ago

The StRewriterDemoRules class (which is badly named - and should be called StRewriterSampleRules or StRewriterTemplateRules)

I agree, we can find a better name. StRewriterSampleRules seems better for me.