[Grace-core] Fwd: Query on built-in objects

Michael Homer mwh at ecs.vuw.ac.nz
Mon Jun 18 23:53:34 PDT 2012


On Tue, Jun 19, 2012 at 6:34 PM, Kim Bruce <kim at cs.pomona.edu> wrote:
> That seems fine with me, as the only place I feel we must have the ++
> operation is when we have strings that need to be continued on a new line.
>  Thus I could go with either ++ only for strings or for any sequence, but
> leave the implicit conversions to the string interpolations.
So I can take both the operator's implicit asString call and the
implementations on non-Strings (which I didn't realise were there)
out?

To clarify the current state: where ++ is defined, it behaves like:
  method ++(other : Any) {
    self.asString ++ other.asString // or "{self}{other}"
  }
It is defined on Strings, Numbers, Blocks, Ellipses, MatchResults, my
internal Octets type (without coercion), the prelude, and all user
objects, mostly by inheritance. It's notably missing from Booleans and
Lists.

So the two questions bundled up there are:
1) Should ++ be defined on non-sequences? People are saying no.
2) Should String.++ invoke asString? I'm not sure anyone has said
anything directly on that here, but there have been mixed views in the
past, and there is interpolation.
-Michael


More information about the Grace-core mailing list