[squeak-dev] Symbol class>>findInterned: deprecated???
Eliot Miranda
eliot.miranda at gmail.com
Thu Jun 16 05:06:12 UTC 2022
Hi Marcel, all,
_,,,^..^,,,_ (phone)
> On Jun 14, 2022, at 11:59 PM, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
>
>
> Hi Eliot --
>
> > But lookup: *always* interns:
>
> No, it does not. You should use #lookup: instead. It has the very same semantics as #findInterned:.
I got hopelessly confused between lookup: and intern: and wanted to reply “ignore me” but I managed to lose my outgoing message instead. Apologies for the noise.
>
> In any case, I will re-load 60Deprecated again into Trunk so that you can keep your code unchanged. We can then discuss the benefit of having two identical methods for the same thing.
No need.
>
> #lookup: has the better wording and hides implementation details.
> #findInterned: leaks the implementation detail of "internalization"
>
> #asSymbol always interns. #lookup: does not.
>
> Best,
> Marcel
>> Am 15.06.2022 00:27:54 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
>>
>> Hi All,
>>
>> I've just run into what I think is a bad mistake. My understanding of Symbol class>>findInterned: is that it answers a Symbol if its (string) argument already exists as a Symbol, and answers nil otherwise. Indeed looking at Collections-mt.935, 13 April 2021, this is the case:
>>
>> Symbol class>>findInterned:aString
>>
>> self hasInterned:aString ifTrue:[:symbol| ^symbol].
>> ^nil.
>>
>> In Collections-nice.936,13 April 2021 it was deprecated, but the new method in 60Deprecated-nice.95, 13 April 2021 reads:
>>
>> Symbol class>>findInterned:aString
>> self flag: #deprecated. "use lookup: instead, they are synonym"
>> ^self lookup: aString
>>
>> But lookup: *always* interns:
>>
>> Symbol intern: 'union {
>> sqIntptr_t valword;
>> struct { int low, high; } valleint64;
>> struct { int high, low; } valbeint64;
>> double valflt64;
>> struct { void *addr; sqIntptr_t size; } valstruct;
>> }' #'union {
>> sqIntptr_t valword;
>> struct { int low, high; } valleint64;
>> struct { int high, low; } valbeint64;
>> double valflt64;
>> struct { void *addr; sqIntptr_t size; } valstruct;
>> }'
>>
>> So I think it is *urgent* that we undeprecate findInterne3d: and restore its old meaning. I apologixze for not finding this earlier. i just ran VMMaker today after an update and that triggered the bug for the first time. I'm guessing the update flushed symbols.
>>
>> I'm going to make this change now.
>>
>> _,,,^..^,,,_
>> best, Eliot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220615/39e1e55a/attachment.html>
More information about the Squeak-dev
mailing list
|