From 2e53c8723707e893db6f50470038ccb9b3cbafd7 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Thu, 29 Jun 2023 13:47:17 +0200 Subject: [PATCH] Make zprintf actually produce correct values Looks like I forgot to change the calling semantics of zprintf to Formatter. Note: "zprintf" is a temporary invention to be able to use legacy sprintf and new Formatter based logic side-by-side in the same language version. --- src/core.e/Format.pm6 | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/core.e/Format.pm6 b/src/core.e/Format.pm6 index e82a060fa20..3ff56d96f23 100644 --- a/src/core.e/Format.pm6 +++ b/src/core.e/Format.pm6 @@ -116,25 +116,19 @@ my class Format is Str { # the procedural frontend of sprintf functionality multi sub sprintf(Format:D $format, *@args) { # until zprintf gone - $format(@args) + $format(|@args) } proto sub zprintf($, |) {*} multi sub zprintf(Str(Cool) $format, \value) { - Formatter.new($format)(nqp::list(value)) + Formatter.new($format)(value) } -multi sub zprintf(Str(Cool) $format, @args) { - Formatter.new($format)(@args) -} -multi sub zprintf(Str(Cool) $format, *@args) { - Formatter.new($format)(@args) -} -multi sub zprintf(Format:D $format, *@args) { - $format(@args) +multi sub zprintf(Str(Cool) $format, |c) { + Formatter.new($format)(|c) } augment class Cool { - method zprintf(*@args) { zprintf(self, @args) } + method zprintf(|c) { zprintf(self,|c) } } # vim: expandtab shiftwidth=4