[squeak-dev] The Trunk: Collections-fn.825.mcz

Chris Muller asqueaker at gmail.com
Fri Apr 12 21:55:34 UTC 2019


> > On 12.04.2019, at 19:14, tim Rowledge <tim at rowledge.org> wrote:
> >
> >
> >
> >> On 2019-04-12, at 12:30 AM, commits at source.squeak.org wrote:
> >>
> >>
> >> Just like strings, characters should convert themselves to an integer when involved in arithmetic with a number.
> >
> > Well, ok I guess. BUT why is the conversion simply to the internal bits of the character representation? Surely digit characters ought to convert to the number they directly represent? And wouldn't it be more correct to convert all the other chars via the encoding in use? Unless, I suppose we are actually using unicode already in which case one might make a decent argument that that is The Right One.
>
> I think this is just for symmetry. and yes, asInteger on a character currently gives the unicode codepoint…

We've still got a problem with symmetry.

{   99 < 99.0.
   99 > 99.0.
   99 = 99.0 }       #(false false true)

but,

{$c < 99.
$c > 99.
$c = 99. }       #(false false false)

Symmetry can only be achieved by moving in the other direction, e.g.,
signal an error in both cases.

Is it good for the language to be this loose with Character
comparisons?  Honest question, I don't know the definitive answer,
however, it seems like we should match strictness with comparisons as
with our strictness over equivalence.  I can understand in a
lower-level language like C where there is a tighter coupling between
the representation of the two.  And in Squeak, yes, we do enjoy
messaging to decouple us from dependence on types, but where do we
define the boundaries of the looseness?  :)

Also prudent to consider that we toy with a one-way street here.  I
didn't study the details, but I assume any application can add an
these overrides to make this possible, leaving Squeak as a system
capable of serving the needs of both relaxed and tight comparing.  But
if we commit to this in the core and start depending it, loose is all
we'll have and no one will be able to have tight anymore.

Anyone know how other Smalltalk's handle this comparison?  The ANSI standard?

Best,
  Chris


More information about the Squeak-dev mailing list