Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1077.mcz
==================== Summary ====================
Name: System-mt.1077
Author: mt
Time: 2 August 2019, 9:41:45.097893 am
UUID: 17934490-ca26-3a43-8081-80f2add3bcd6
Ancestors: System-mt.1076
Extracts class/trait pattern-based lookup into system navigation. Was hidden in UIManager.
=============== Diff against System-mt.1076 ===============
Item was added:
+ ----- Method: SystemNavigation>>allClassesAndTraitsMatching: (in category 'query') -----
+ allClassesAndTraitsMatching: pattern
+ "Given a pattern and an environment, try to find a class or trait using several strategies:
+ - EXACT: If there is a class or trait whose name exactly given by pattern, return it.
+ - UPPER: If the pattern is upper-case only, find camel-case letters with that sequence.
+ - WILD: Try the pattern as-is for regular wild-card search.
+ - FEATURE: Split patterns at feature boundaries and insert wild cards between.
+ - FUZZY: Split patterns at feature boundaries BUT treat each feature as a full class name.
+ If there is only one class or trait in the given environment whose name matches pattern, return it. Otherwise, put up a menu offering the names of all classes that match pattern, and return the class chosen, else nil if nothing chosen.
+
+ !!!! In any case, separator characters in the pattern are ignored."
+
+ | toMatch potentialNames names |
+
+ "If there's a class or trait named as pattern, then return it."
+ (environment classOrTraitNamed: pattern) ifNotNil: [:classOrTrait | ^ {classOrTrait}].
+
+ "Validate pattern."
+ toMatch := pattern copyWithoutAll: Character separators.
+ toMatch := toMatch asLowercase copyWithout: $..
+ toMatch ifEmpty: [ ^ #() ].
+
+ "Fetch search space."
+ names := OrderedCollection new.
+ potentialNames := environment classAndTraitNames.
+
+ "Try uppercase-only patterns for patterns such as 'WKD' to find 'WeakIdentityKeyDictionary' etc."
+ (pattern allSatisfy: [:char | char isUppercase]) ifTrue: [
+ | patternSize |
+ patternSize := pattern size.
+ potentialNames do: [ :eachName |
+ | lookupIndex characterIndex |
+ lookupIndex := 0.
+ characterIndex := 1.
+ [ (lookupIndex := eachName
+ indexOf: (pattern at: characterIndex)
+ startingAt: lookupIndex + 1) > 0
+ and: [ (characterIndex := characterIndex + 1) <= patternSize ] ] whileTrue.
+ lookupIndex > 0 ifTrue: [ names add: eachName ] ] ].
+
+ "Try wildcard search for patterns such as 'Weak*Dict*' to find 'WeakIdentityKeyDictionary' etc."
+ names ifEmpty: [
+ potentialNames do: [ :each | (toMatch match: each) ifTrue: [ names add: each ] ].
+ "Try feature-based search for patterns such as 'WeakDict' to find 'WeakIdentityKeyDictionary' etc."
+ names ifEmpty: [
+ "1) Insert wildcards between features and at the end."
+ toMatch := ((pattern copyWithoutAll: '.*#') findFeatures joinSeparatedBy: '*'), '*'.
+ potentialNames do: [ :each | (toMatch match: each) ifTrue: [ names add: each ] ].
+ names ifEmpty: [
+ "2) Insert wildcards before, between, and after features."
+ toMatch := '*', toMatch.
+ potentialNames do: [ :each | (toMatch match: each) ifTrue: [ names add: each ] ] ] ] ].
+
+ "Try some fuzzy matching."
+ pattern suggestedTypeNames do: [ :each |
+ (potentialNames includes: each) ifTrue: [ names add: each ] ].
+
+ "Still no match?"
+ ^ names collect: [ :each | environment classOrTraitNamed: each ]
+ !
Marcel Taeumel uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-mt.414.mcz
==================== Summary ====================
Name: Tests-mt.414
Author: mt
Time: 2 August 2019, 9:22:12.059774 am
UUID: 0be66466-bc31-9d4d-bfd4-0862b63bbfcc
Ancestors: Tests-ul.413
Updates tests for system navigation. Use TGriffle instead of Griffle because only TGriffle has a method with actual sends in it. Drop the #+ filter because it has no effect and there was no other reason stated in the (missing) comments.
=============== Diff against Tests-ul.413 ===============
Item was changed:
----- Method: SystemNavigationTest>>testAllSentMessagesWithout (in category 'tests') -----
testAllSentMessagesWithout
self
assert: (#(foo bar) asIdentitySet
addAll: Smalltalk presumedSentMessages;
addAll: Smalltalk specialSelectorNames;
yourself)
+ equals: (sysNav allSentMessagesWithout: {{}. {}}).
+
+ self
+ assert: (IdentitySet new
+ addAll: Smalltalk presumedSentMessages;
+ addAll: Smalltalk specialSelectorNames;
+ yourself)
+ equals: (sysNav allSentMessagesWithout: {{env at: #TGriffle}. {}}).!
- equals: (sysNav allSentMessagesWithout: {{env at: #Griffle}. {#+}}).!
Item was changed:
----- Method: SystemNavigationTest>>testAllUnusedClassesWithout (in category 'tests') -----
testAllUnusedClassesWithout
+
+ self
+ assert: (IdentitySet with: #Unused)
+ equals: ((SystemNavigation for: env) allUnusedClassesWithout: {{}. {}}).
+
+ "The classes passed to #allUnusedClassesWithout: are not filtered from the list. They're classes whose methods are not examined for global references."
+ self
+ deny: ((SystemNavigation for: env) allUnusedClassesWithout: {{#Unused}. {}}) isEmpty
+ description: 'Where did Unused go?'.!
- self assert: (IdentitySet with: #Unused) equals: ((SystemNavigation for: env) allUnusedClassesWithout: {{}. {}}).
- "The classes passed to #allUnusedClassesWithout: are not filtered from the list. They're classes whose methods are not examined for global references."
- self deny: ((SystemNavigation for: env) allUnusedClassesWithout: {{#Unused}. {}}) isEmpty description: 'Where did Unused go?'.!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1076.mcz
==================== Summary ====================
Name: System-mt.1076
Author: mt
Time: 2 August 2019, 9:20:11.092774 am
UUID: fbc3d082-9bf6-9c4e-bbdc-68998f044637
Ancestors: System-mt.1075
Fixes sent-messages and global-refs lookup in system navigation.
=============== Diff against System-mt.1075 ===============
Item was changed:
----- Method: SystemNavigation>>allGlobalRefsWithout: (in category 'query') -----
allGlobalRefsWithout: classesAndMessagesPair
"Answer a set of symbols that may be refs to Global names. In some
sense we should only need the associations, but this will also catch, eg,
HTML tag types. This method computes its result in the absence of
specified classes and messages."
+
- "may be a problem if namespaces are introduced as for the moment
- only Smalltalk is queried. sd 29/4/03"
| globalRefs absentClasses absentSelectors |
globalRefs := IdentitySet new: CompiledMethod instanceCount.
absentClasses := classesAndMessagesPair first.
absentSelectors := classesAndMessagesPair second.
"sd 29/04/03"
Cursor execute
+ showWhile: [self environment allClassesAndTraitsDo:
+ [:cls | ((absentClasses includes: cls)
- showWhile: [self environment allClassesDo:
- [:cls | ((absentClasses includes: cls name)
ifTrue: [{}]
ifFalse: [{cls. cls class}])
do: [:cl | (absentSelectors isEmpty
ifTrue: [cl selectors]
ifFalse: [cl selectors copyWithoutAll: absentSelectors])
do: [:sel | "Include all capitalized symbols for good
measure"
(cl compiledMethodAt: sel) allLiteralsDo: [:m |
((m isSymbol)
and: [m size > 0
and: [m first canBeGlobalVarInitial]])
ifTrue: [globalRefs add: m].
]]]]].
^ globalRefs!
Item was changed:
----- Method: SystemNavigation>>allSentMessagesWithout: (in category 'query') -----
allSentMessagesWithout: classesAndMessagesPair
"Answer the set of selectors which are sent somewhere in the system,
computed in the absence of the supplied classes and messages."
| sent absentClasses absentSelectors |
sent := IdentitySet new: CompiledMethod instanceCount.
absentClasses := classesAndMessagesPair first.
absentSelectors := classesAndMessagesPair second.
"sd 29/04/03"
Cursor execute showWhile: [
self environment allClassesAndTraitsDo: [:cls |
+ ((absentClasses includes: cls)
- ((absentClasses includes: cls name)
ifTrue: [{}]
ifFalse: [{cls. cls classSide}])
do: [:each | (absentSelectors isEmpty
ifTrue: [each selectors]
ifFalse: [each selectors copyWithoutAll: absentSelectors])
do: [:sel | "Include all sels, but not if sent by self"
(each compiledMethodAt: sel) allLiteralsDo: [:m |
+ self flag: #dicuss. "mt: How to distinguish a symbol from a selector?"
+ (m isSymbol and: [m first isLowercase])
+ ifTrue: ["might be sent"
+ m == sel ifFalse: [sent add: m]].
- (m isSymbol)
- ifTrue: ["might be sent"
- m == sel
- ifFalse: [sent add: m]].
]]]]].
"The following may be sent without being in any literal frame"
Smalltalk specialSelectorNames do: [:sel | sent add: sel].
Smalltalk presumedSentMessages do: [:sel | sent add: sel].
^ sent.!
Levente Uzonyi uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-ul.413.mcz
==================== Summary ====================
Name: Tests-ul.413
Author: ul
Time: 1 August 2019, 9:51:08.722178 pm
UUID: 1e029922-e849-4e3b-8cd0-f29666968f47
Ancestors: Tests-mt.412
ShoutCore depends on Files and Chronology-Core due to the new #benchmark method of SHParserST80.
=============== Diff against Tests-mt.412 ===============
Item was changed:
----- Method: PackageDependencyTest>>testShoutCore (in category 'tests') -----
testShoutCore
self testPackage: #ShoutCore dependsExactlyOn: #(
Collections
Environments
Graphics
Kernel
Monticello
System
Compiler
Tools
+ Files
+ #'Chronology-Core'
).!
One of the interesting things that happens when you try to introduce someone new to Squeak is that you come up against all the habits you've built up about how to do stuff and how they don't necessarily match current reality.
In this case, I noticed that installing Squeak on a linux machine has some curious issues. To start with, we don't actually seem to have any advice on what to install where, which makes it hard to tell people to RTFM.
There are three plausible packages to install and each has a different shell script! The linux current 5.2b package squeak.sh is different to the all-in-one squeak.sh which is different to the version included in any locally built or grabbed from bintray package. Oh, and the version included in Raspbian is again different! We should probably try to improve that, wouldn't you say?
Once upon a time(long ago), the norm was for the .sources file to live where the vm executable did. I'd sorta-kinda noticed that it could also be in the same directory as the image too, but we seem to have drifted a bit from that earlier rule. The only install details mentioned on https://squeak.org/downloads/ actually specify only the 'same directory as image' part. This is not the best option for anyone wanting to keep images for different purposes spread in various directories. The code in SourceFileArray does actually look for a sources file in the vm path *but* with the unix approach of having date/time coded vm paths - not to mention the more general idea of the 'shared' assets directory - this isn't going to be that useful; '/usr/lib/squeak/5.0-201907192337' is ok until you update to 5.2-201908031yyyy'. Then again, anyone having several VMs in different places will have some fun if paths based on the vm location are relied upon!
I know that part of this is the result of the rather varied rules different unixes have for storing loaded applications. I don't know very much about those rules - and I really, really, don't want to have to care - so maybe somebody has ideas that might help have a decent shared location for the sources file that would fit? Could we just use vmPath/../ for 'normal' installs?
tim
--
tim Rowledge; tim(a)rowledge.org; http://www.rowledge.org/tim
A conscience is what hurts when all your other parts feel so good.
Fabio Niephaus uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-fn.231.mcz
==================== Summary ====================
Name: ToolBuilder-Morphic-fn.231
Author: fn
Time: 1 August 2019, 7:05:12.923263 pm
UUID: 8b938bad-eb6d-4af2-ac47-8699f2f1f6c7
Ancestors: ToolBuilder-Morphic-fn.230
Sort directory names in FileAbstractSelectionDialog>>subDirectoriesOf:. This makes it way easier to find things (e.g. run `UIManager default chooseDirectory`).
=============== Diff against ToolBuilder-Morphic-fn.230 ===============
Item was changed:
----- Method: FileAbstractSelectionDialog>>subDirectoriesOf: (in category 'directory tree') -----
subDirectoriesOf: aDirectory
+ ^aDirectory directoryNames sorted collect:[:each| aDirectory directoryNamed: each].!
-
- ^aDirectory directoryNames collect:[:each| aDirectory directoryNamed: each].!
A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-ct.1073.mcz
==================== Summary ====================
Name: System-ct.1073
Author: ct
Time: 30 July 2019, 5:18:34.214556 pm
UUID: 8e29c8e1-c869-c541-b274-e0beb170c532
Ancestors: System-kfr.1072
Add SmalltalkImage>>#at:ifPresent:ifAbsent:
A shorthand for SmalltalkImage globals access
=============== Diff against System-kfr.1072 ===============
Item was added:
+ ----- Method: SmalltalkImage>>at:ifPresent:ifAbsent: (in category 'accessing') -----
+ at: key ifPresent: aBlock ifAbsent: anotherBlock
+
+ ^globals at: key ifPresent: aBlock ifAbsent: anotherBlock!