lib/standard/string: introduce (an use) `plain_to_s`
authorJean Privat <jean@pryen.org>
Sun, 24 May 2015 02:32:39 +0000 (22:32 -0400)
committerJean Privat <jean@pryen.org>
Fri, 29 May 2015 01:47:08 +0000 (21:47 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

lib/standard/file.nit
lib/standard/string.nit
src/interpreter/naive_interpreter.nit

index 1490ee7..f68bae9 100644 (file)
@@ -1230,7 +1230,7 @@ end
 # Print `objects` on the standard output (`stdout`).
 fun printn(objects: Object...)
 do
-       sys.stdout.write(objects.to_s)
+       sys.stdout.write(objects.plain_to_s)
 end
 
 # Print an `object` on the standard output (`stdout`) and add a newline.
index 2344659..aa757b7 100644 (file)
@@ -2220,6 +2220,12 @@ redef class Collection[E]
        # Concatenate elements.
        redef fun to_s
        do
+               return plain_to_s
+       end
+
+       # Concatenate element without separators
+       fun plain_to_s: String
+       do
                var s = new FlatBuffer
                for e in self do if e != null then s.append(e.to_s)
                return s.to_s
@@ -2255,7 +2261,7 @@ end
 redef class Array[E]
 
        # Fast implementation
-       redef fun to_s
+       redef fun plain_to_s
        do
                var l = length
                if l == 0 then return ""
index b444dd8..9708f3f 100644 (file)
@@ -1629,7 +1629,7 @@ redef class ASuperstringExpr
                        array.add(i)
                end
                var i = v.array_instance(array, v.mainmodule.object_type)
-               var res = v.send(v.force_get_primitive_method("to_s", i.mtype), [i])
+               var res = v.send(v.force_get_primitive_method("plain_to_s", i.mtype), [i])
                assert res != null
                return res
        end