[squeak-dev] The Trunk: Morphic-mt.1491.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Thu Jul 11 10:41:06 UTC 2019


What about adding #lookup:ifFound:?
Am 11.07.2019 11:47:37 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>:
Hi Levente,

hmmm... yet, the "ifNil:"-check needed for #lookup: impedes readability in my opinion. :-)

Best,
Marcel
Am 11.07.2019 11:02:13 schrieb Levente Uzonyi <leves at caesar.elte.hu>:
Hi Marcel,

These changes should go the other way around. #hasInterned:ifTrue: is
private and more specific. #lookup: is more general (#hasInterned:ifTrue:
uses lookup) and faster.
In my opinion, #hasInterned:ifTrue: should be deprecated, then removed.

Levente

On Thu, 11 Jul 2019, commits at source.squeak.org wrote:

> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1491.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1491
> Author: mt
> Time: 11 July 2019, 7:43:26.133838 am
> UUID: 8e7d61cb-067a-d145-a86e-3484bfb38617
> Ancestors: Morphic-cmfcmf.1490
>
> Replaces one use of Symbol class >> #lookup: with the more common (i.e., more senders) idiom Symbol class >> #hasInterned:ifTrue:.
>
> =============== Diff against Morphic-cmfcmf.1490 ===============
>
> Item was changed:
> ----- Method: SearchBar>>smartSearch:in: (in category 'searching') -----
> smartSearch: text in: morph
> "Take the user input and perform an appropriate search"
> | input newContents |
> self removeResultsWidget.
> input := text asString ifEmpty:[^self].
> self class useSmartSearch ifFalse: [^ ToolSet default browseMessageNames: input].
>
> "If it is a global or a full class name, browse that class."
> (Smalltalk bindingOf: input) ifNotNil:[:assoc| | global |
> global := assoc value.
> ^ToolSet browse: (global isBehavior ifTrue:[global] ifFalse:[global class]) selector: nil].
>
> "If it is a symbol and there are implementors of it, browse those implementors."
> + Symbol hasInterned: input ifTrue: [:selector |
> - (Symbol lookup: input) ifNotNil: [:selector |
> (SystemNavigation new allImplementorsOf: selector) ifNotEmpty:[:list|
> ^SystemNavigation new
> browseMessageList: list
> name: 'Implementors of ' , input]].
>
> "If it starts uppercase, browse classes if any. Otherwise, just search for messages."
> input first isUppercase
> ifTrue: [
> (UIManager default classFromPattern: input withCaption: '')
> ifNotNil:[:aClass| ^ToolSet browse: aClass selector: nil]
> ifNil: [
> newContents := input, ' -- not found.'.
> self searchTerm: newContents.
> self selection: (input size+1 to: newContents size).
> self currentHand newKeyboardFocus: morph textMorph.
> ^ self]]
> ifFalse: [
> ToolSet default browseMessageNames: input].!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190711/2ce709a2/attachment.html>


More information about the Squeak-dev mailing list