[squeak-dev] The Trunk: Kernel-fn.1223.mcz

Fabio Niephaus lists at fniephaus.com
Tue Jul 23 18:12:31 UTC 2019


Hi Chris,

On Mon, Apr 29, 2019 at 9:58 PM Chris Muller <ma.chris.m at gmail.com> wrote:

> >> Hey Fabio, would you mind consulting your peers a bit more on some of
> >> these things prior to trunk?
> >
> >
> > Sure, sorry for the lack of explanation.
> >
> >>
> >>
> >> Because I see a problem with "consistency" here.  #postCopy is a no-op
> >> if there's nothing to do, not an error.
> >
> >
> > SmallIntegers and SmallFoat64 are immediates and cannot be copied.
> > This change ensures #postCopy cannot be sent to them, because it does
> > not make any sense.
> >
> >>
> >>
> >> In your main #copy entry method, you silently ignore, but here you
> >> want to throw an error.  What are you trying to accomplish here?
> >
> >
> > I don't quite understand. What do you mean by "main #copy entry
> > method"? SmallInteger and SmallFloat64 override #copy to return `self`.
>
> Right.  That's the inconsistency.  In fact, there's inconsistency
> along two dimensions, the first being against the behaviors of other
> #postCopy's (none of which signal an error), the second being between
> the response behavior we implement in #copy to simply ^self.
>
> A lot of objects inherit #copy, and therefore get sent #postCopy.
> Canonical objects like the ones you're addressing, as well as Symbol,
> should override the *lowest-level method they can*, and nothing more,
> to accomplish the necessary requirement(s).  In the case of #deepCopy,
> that's #deepCopy, but in the case of #copy, #shallowCopy is all that's
> needed, and we should just leave it at that.  From an API-design
> perspective, SmallInteger>>#copy is unnecessary.  It just makes extra
> methods to see and scroll through in the browser, instead of letting
> inheritance do its work.
>

Sorry for following up so late, but at least I haven't forgotten.
What do you think about these two:
http://forum.world.st/The-Inbox-Kernel-fn-1248-mcz-td5101545.html
http://forum.world.st/The-Inbox-Collections-fn-847-mcz-td5101546.html

Cheers,
Fabio


> If this postCopy code you've written will ever execute, it's changed the
> behavior of systems which send #copy to a heterogeneous collection of
> objects without having to check each one whether its a SmallInteger or
> not.  If it won't ever execute, then it's bloat.
>
> Best,
>   Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190723/9c814876/attachment.html>


More information about the Squeak-dev mailing list