From 84768e70f696d7e0df8ff2c65a41c33d66e60010 Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Thu, 12 Oct 2023 08:45:44 -0400 Subject: [PATCH] [PreSmalltalks] Allow lowercase classnames --- PreSmalltalks-Pharo/String.extension.st | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 PreSmalltalks-Pharo/String.extension.st diff --git a/PreSmalltalks-Pharo/String.extension.st b/PreSmalltalks-Pharo/String.extension.st new file mode 100644 index 000000000..796b0cbc7 --- /dev/null +++ b/PreSmalltalks-Pharo/String.extension.st @@ -0,0 +1,15 @@ +Extension { #name : #String } + +{ #category : #'*PreSmalltalks-Pharo' } +String >> isValidGlobalName [ + + self ifEmpty: [ ^ false ]. + + "reserverd default names" + self = 'NameOfSubclass' ifTrue: [ ^ false ]. + self = 'TNameOfTrait' ifTrue: [ ^ false ]. + + ^ self first isLetter + and: [ self allSatisfy: [:character | + character isAlphaNumeric or: [ character = $_ ]]] +]