pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.17k stars 348 forks source link

Cleanup: Prefix change from "RB" to "AST" for Abstract syntax tree related classes #10815

Open astares opened 2 years ago

astares commented 2 years ago

From the historic point of view Smalltalk started I guess Smalltalk refactorings had their roots in the Refactoring Browser (RB) and can be traced back to work at UIUC (University of Illinois, Urbana-Champaign) by Don Roberts, John Brant, and Ralph Johnson

Following this history the classes like RBNode had an "RB" prefix for RefactoringBrowser.

But logically now in newer Pharo we have put them into packages for "AST" - Abstract Syntax Tree

image

If you think about it for a while it would be more logically to have them prefixed with "AST" instead of "RB". Yes - we know it is heritic and means effort and deprecation/transition/migration - but for Pharo we want to constantly improve, get clean and do for the better.

Additionally this would also help people who are comming from other (more mainstream) languages to find it in alignment with the AST concepts and namings there.

astares commented 2 years ago

Look: That cleanup had already been stated as a TODO in the class comment of RBNode which reflects the superclass for all classes represening AST Nodes (not RB nodes)

image

astares commented 2 years ago

Also a renaming of classes like RBParser into ASTParser would give a proper and more intention revealing name. At the moment the class comment says: "RBParser takes a source code string and generates an AST for it". We do not parse an "RB" - we parse source code and create an AST. So the name is somehow misleading.

image

astares commented 2 years ago

A possible way to do such a cleanup could be (if we have a class RBxxxx):

Ducasse commented 2 years ago

I agree :) Now we should plan it for P11. Or we can do it by having RB* as subclasses of their AST counterparts for now

astares commented 2 years ago

"AST-Core" Package

class category "Formatter"

RBSimpleFormatter -> ASTSimpleFormatter

class category "Matching"

RBParseTreeRule -> ASTParseTreeRule RBReplaceRule -> ASTReplaceRule RBBlockReplaceRule -> ASTBlockReplaceRule RBStringReplaceRule -> ASTStringReplaceRule RBSearchRule -> ASTSearchRule RBParseTreeSearcher -> RBParseTreeSearcher RBParseTreeRewriter -> ASTParseTreeRewriter

class category "Nodes"

RBNode -> ASTNode RBProgramNode -> ASTProgramNode RBComment -> ASTComment RBMethodNode -> ASTMethodNode RBPragmaNode -> ASTPragmaNode RBReturnNode -> ASTReturnNode RBSequenceNode -> ASTSequenceNode RBValueNode -> ASTValueNode RBArrayNode -> ASTArrayNode RBAssignmentNode -> ASTAssignmentNode RBBlockNode -> ASTBlockNode RBCascadeNode -> ASTCascadeNode RBLiteralNode -> ASTLiteralNode RBLiteralArrayNode -> ASTLiteralArrayNode RBLiteralValueNode -> ASTLiteralValueNode RBMessageNode -> ASTMessageNode RBSelectorNode -> ASTSelectorNode RBVariableNode -> ASTVariableNode RBStringReplacement -> ASTStringReplacement

class category "Nodes - ErrorNodes"

RBParseErrorNode -> ASTParseErrorNode RBEnglobingErrorNode -> ASTEnglobingErrorNode RBArrayErrorNode -> ASTArrayErrorNode RBBlockErrorNode -> ASTBlockErrorNode RBInvalidCascadeErrorNode -> ASTInvalidCascadeErrorNode RBLiteralArrayErrorNode -> ASTLiteralArrayErrorNode RBLiteralByteArrayErrorNode -> ASTLiteralByteArrayErrorNode RBMissingOpenerErrorNode -> ASTMissingOpenerErrorNode RBParenthesesErrorNode -> ASTParenthesesErrorNode RBPragmaErrorNode -> ASTPragmaErrorNode RBTemporariesErrorNode -> ASTTemporariesErrorNode RBUnfinishedStatementErrorNode -> ASTUnfinishedStatementErrorNode RBUnreachableStatementErrorNode -> ASTUnreachableStatementErrorNode

class category "Parser"

RBParser -> ASTParser RBPatternParser -> ASTPatternParser RBScanner -> ASTScanner RBPatternScanner -> ASTPatternScanner

class category "Pattern"

RBPatternBlockNode -> ASTPatternBlockNode RBPatternWrapperBlockNode -> ASTPatternWrapperBlockNode RBPatternMessageNode -> ASTPatternMessageNode RBPatternMethodNode -> ASTPatternMethodNode RBPatternPragmaNode -> ASTPatternPragmaNode RBPatternVariableNode -> ASTPatternVariableNode

class category "Tokens"

RBToken -> ASTToken RBAssignmentToken -> ASTAssignmentToken RBShortAssignmentToken -> ASTShortAssignmentToken RBEOFToken -> ASTEOFToken RBValueToken -> ASTValueToken RBBinarySelectorToken -> ASTBinarySelectorToken RBCommentToken -> ASTCommentToken RBErrorToken -> ASTErrorToken RBIdentifierToken -> ASTIdentifierToken RBKeywordToken -> ASTKeywordToken RBLiteralArrayToken -> ASTLiteralArrayToken RBLiteralToken -> ASTLiteralToken RBMultiKeywordLiteralToken -> ASTMultiKeywordLiteralToken RBNumberLiteralToken -> ASTNumberLiteralToken RBPatternBlockToken -> ASTPatternBlockToken RBSpecialCharacterToken -> ASTSpecialCharacterToken

class category "Visitors"

RBProgramNodeVisitor -> ASTProgramNodeVisitor RBAbstractBlockVisitor -> ASTAbstractBlockVisitor RBCommentNodeVisitor -> ASTCommentNodeVisitor RBGenericNodeVisitor -> ASTGenericNodeVisitor RBParseErrorNodeVisitor -> ASTParseErrorNodeVisitor RBDumpVisitor -> ASTDumpVisitor RBReadBeforeWrittenTester -> ASTReadBeforeWrittenTester

"ClassParser" package

class category "Model"

RBSlotInitializationNode -> ASTSlotInitializationNode

astares commented 2 years ago

"AST-Core-Tests" Package

class category "Formatter"

RBFormatterTest -> ASTFormatterTest

class category "Matching"

RBParseTreeRewriterTest -> ASTParseTreeRewriterTest RBParseTreeSearcherTest -> ASTParseTreeSearcherTest

class category "Nodes"

RBCommentTest -> ASTCommentTest RBMessageNodeTest -> ASTMessageNodeTest RBMethodNodeTest -> ASTMethodNodeTest RBParseErrorNodeTest -> ASTParseErrorNodeTest RBProgramNodeTest -> ASTProgramNodeTest RBSequenceNodeTest -> ASTSequenceNodeTest RBVariableNodeTest -> ASTVariableNodeTest

class category "Parser"

NumberParsingTest -> ASTNumberParsingTest RBParseTreeTest -> ASTParseTreeTest RBParserTest -> ASTParserTest RBErrorNodeParserTest -> ASTErrorNodeParserTest RBPatternParserTest -> ASTPatternParserTest RBScannerTest -> ASTScannerTest

class category "Visitors"

RBCommentNodeVisitorTest -> ASTCommentNodeVisitorTest RBDumpVisitorTest -> ASTDumpVisitorTest RBGenericNodeVisitorTest -> ASTGenericNodeVisitorTest RBReadBeforeWrittenTesterTest -> ASTReadBeforeWrittenTesterTest

deleted unused RASTTest

astares commented 2 years ago

"AST-Core-Traits" Package

TRBProgramNodeVisitor -> ASTTProgramNodeVisitor

jecisc commented 9 months ago

In order to rename the classes we should keep the old names using the new deprecated aliases feature of Pharo 12.

pavel-krivanek commented 2 months ago

while there is a newer issue handling this, what about to close this one?