[squeak-dev] 6-Paned browser fixed

tim Rowledge tim at rowledge.org
Wed Jan 25 22:55:17 UTC 2023



> On 2023-01-25, at 1:35 PM, tim Rowledge <tim at rowledge.org> wrote:
> 
> As a really trivial example, the browser's systemCategoryList includes a category that does not actually exist -  #'-- all --'. As another, consider PackagePaneBrowser>>#packageList which does a very simple scan for the hyphen to break things up.
> 
> It could do anything we want at this point; more sophisticated scanning to find the first capitalised letter after the first letter might be one option to add. That might have the advantage of catching things like the Cryptography packages where there seems to be about a gazillion entries with no hyphens to spare. I'd love it to drop the empty categories that seem to proliferate after loading code via 'ConfigurationOf...' stuff.

As an extremely simplistic example that most certainly doesn't completely solve anything, consider these two method changes - 

PackagePaneBrowser>>#packageList
	"Answer a list of the packages in the current system organization."

	| str stream |
	str := Set new: 100.
	stream := WriteStream on: (Array new: 100).
	systemOrganizer categories do:
		[ :categ | | cats |
		cats:= String streamContents: [:strm| |rStrm ch seenLower|
			seenLower := false.
			rStrm := categ readStream.
			strm nextPut: rStrm next.
			[(ch :=rStrm next)
				ifNil:[true]
				ifNotNil:
					[seenLower := seenLower or: [ch isLowercase].
					ch = $- or:[ch isUppercase and:[seenLower]]]] whileFalse:
						[strm nextPut: ch]].
		(str includes: cats) ifFalse: 
			[str add: cats.
			stream nextPut: cats]].
	^stream contents

and 

PackagePaneBrowser>>#systemCategoryList
	"Answer the sequenceable collection containing the class categories that 
	the receiver accesses."

	| prefix |
	packageListIndex = 0 ifTrue: [^ systemOrganizer categories].
	prefix := self package.
	^ Array streamContents:
		[:strm |
		systemOrganizer categories do: 
			[ :cat | (cat beginsWith: prefix) ifTrue:
				[|newCat|
				newCat := cat copyFrom: prefix size + 1 to: cat size.
				newCat ifNotEmpty:
					[newCat first = $- ifTrue:
						[newCat := newCat allButFirst].
					strm nextPut: newCat]]]]

What this reveals is that in some cases we actually would prefer to not stop at the first uppercase that isn't the first letter, but in others, we would because the hyphen comes way too late to be helpful. Or in other words, there are a lot of very inconveniently named categories!

Another way of looking at this is that in practice I don't think I look at class categories at all in normal day to day working. In that sense I don't care at all about how an extra pane might be considered to simplify anything; it just has no meaning to my life.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
"Bother" said Pooh, as the Vice Squad took his GIFS ..




More information about the Squeak-dev mailing list