[Cuis-dev] creating a Dictionary

Juan Vuletich juan at cuis.st
Mon Jul 8 05:38:51 PDT 2024


On 7/7/2024 6:06 PM, Mark Volkmann via Cuis-dev wrote:
> It seems that `Dictionary newFrom:` works with a run-time literal 
> Array of Association objects and does not work with a compile-time 
> literal Array or Association objects. For example, this works:
>
> as := {#a -> 'apple'. #b -> 'banana'. #c -> 'cherry'}.
> d2 := Dictionary newFrom: as.
>
> but this gives the error "MessageNotUnderstood: Symbol>>key".
>
> as := #(#a -> 'apple' #b -> 'banana' #c -> 'cherry').
> d2 := Dictionary newFrom: as.
>
> Can someone explain why?

It would really be the best for YOU to start flexing your Smalltalk 
muscles. A quick dive with the debugger, and use of inspectors and 
browsers, will give you waaaaay more insight that the best explanation 
anyone could write.

> -- 
> R. Mark Volkmann
> Object Computing, Inc.

HTH,

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240708/e3d30caa/attachment.htm>


More information about the Cuis-dev mailing list