Dot notation and a crazy idea

Doug Way dway at mat.net
Mon Mar 22 07:27:45 UTC 1999


On Fri, 19 Mar 1999, Marcel Weiher wrote:

> I also am reminded of C-- etc. when I see all those dots, so are
> there ideas for another equivalent path-separator or do we just have
> to overcome our collective phobia?  (Spaces don't cut it because
> then you don't have the close binding of the path expression.  Well,
> at least my eyes have difficulties picking it out).

While I think that Travis Grigg's description of the various Smalltalk
symbols on his webpage was excellent, I think it can be argued that the
dot "." (period) separator is actually slightly better for namespaces than
a slash "/" symbol, for a few reasons:

- The dot is vaguely familiar as a separator for several different
reasons, whereas the slash separator in a series is really only familiar
for one reason, as a pathname separator.  I think this might tend to
mislead people into thinking that these slashed namespaces were actual
file pathnames (although I suppose they would get over it).  Dot are used
as separators for a variety of different things, not just in C/Java, but
also they're familiar from filename extensions (Squeak2.3.image), internet
domain name addresses (www.squeak.org), etc.  So I don't think there would
be an immediate confusion with any particular convention outside of
Squeak.

- The dot seems like a less "severe" separator than the slash, and thus
names including dots read better as a single entity... probably simply
because dots are smaller.  The filename extension comparison works here
too... Squeak2.3.image still feels like a single name, whereas
Squeak2/3/image is more broken up into parts. (Or could it be argued that
being broken up is better?)

It's true that the dot is already used for two other purposes in
Smalltalk, as a statement ender and as a decimal point... definitely a
reason for caution.  But these two other uses are unrelated enough so that
at least there wouldn't be confusion between a namespace separator dot and
a statement ending dot when looking at actual code.  You get into real
trouble (with C++ etc.) when a symbol has a few related but still
different meanings.

> However, the '.' was proposed for another purpose, namespace
> support.  My idea was that once you have it, why not make it general
> and use it to simplify another part of the syntax that can get really
> ugly really quickly?

Not a bad idea... any syntax change in Smalltalk needs to "carry its
weight", so it might as well be as general as possible.  Probably an idea
to keep on the back burner for awhile (blue plane) before replacing all of
the calls to select:/collect: in the Squeak image, though. :-)

I've also always thought that the @ sign was underutilized in Smalltalk...
changing at: to a binary @ would be great also for the higher precedence
of a binary operator.  Although replacing at:put: is more of a
challenge... I wouldn't go so far as adding new syntax (such as the
suggested a[1] := b[3] etc.).

- Doug Way
  EAI/Transom Technogies, Ann Arbor, MI
  dway at eai.com, dway at mat.net
  http://www.transom.com

  Smalltalk: Guaranteed Y2T Compliant





More information about the Squeak-dev mailing list