[Cuis-dev] [Ann] Serialization of BlockClosures
Juan Vuletich
juan at jvuletich.org
Mon Sep 30 20:24:31 PDT 2019
Please, let's restart this discussion with a different focus. Let's
forget for a while about #species, that is a private message, and lets
focus on external behavior. Let's go to #species or an alternative
implementation strategy afterwards. Also, please let's use examples.
Take a fresh image. Evaluate:
Color red select: [ :v | v > 0.5 ].
Color red collect: [ :v | v printString ].
Both fail. #select: fails because it might answer less than 3 elements,
and a Color must have 3 elements. #collect: fails because the answer
elements might be of any class, but Color components must be Float.
Possible solutions might be answering FloatArray (fixes #select: but not
#collect:) or Array (fixes both). Changesets #3889 and #3890 attempt to
fix #select: by looking for some superclass that doesn't enforce a
specific number of elements, in #species. In this implementation, the
answer of #species only changes for classes that do enforce a specific
number of elements.
As another example of the #collect: problem, see
'Hello' collect: [ :c | c numericValue ]
String chooses to reimplement #collect: . A more general solution would
be desirable.
Please provide other actual examples that I can try in a Cuis image
where the assumptions made for Color become invalid, and your code
breaks. Or provide examples I can try of how you use #species, and your
code breaks with #3889 and #3890. I really want to understand the
problems you see, and I find it very difficult with only an abstract
description.
Thanks,
--
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich
More information about the Cuis-dev
mailing list