Perl 6.x , please offer PREPEND as well as APPEND




Dear Damian, Larry, et al:

The asymetric PREPEND and APPEND should be addressed in 6.x:

# append a string, very nice
$song .= ' Her Majesty The Queen';

# prepend a string - YUK, ugly, [1]
$song = ' Her Majesty The Queen ' . $song;

# new and improved prepend a string - YAY, posh
$song =. 'Her Majesty The Queen ';
# or to be consistent with other $a x= $b syntax, perhaps something
like...
$song |= 'Her Majesty The Queen ';


******************************************************

If you offer tea you should serve crumpets as well!

Thank-You for your kind attention,

Mr P

[1] - every mathmatician or logician has to flinch everytime they
encounter this syntax. As programmers we understand what it's up to of
course, but in general terms:

a = b + a

is ONLY true for b=0, (or b='' in the case of a string) which in our
case is NOT true.

.



Relevant Pages

  • Re: Using CreateDirectory problems
    ... "To extend this limit to 32,767 wide characters, call the Unicode version of the function ... looks to me like you've got the wrong string prepended and you need to be sure your ... "finecats" wrote in message ...
    (microsoft.public.win32.programmer.kernel)
  • Re: prepend operator?
    ... So, with that in mind, what is wrong with: ... "Is there an operator where I can prepend a string to a string, ... Why not unshift it on an array, then join the array with ''? ...
    (comp.lang.php)
  • Re: prepend operator?
    ... Paul Lautman wrote: ... So, with that in mind, what is wrong with: ... "Is there an operator where I can prepend a string to a string, ...
    (comp.lang.php)
  • Re: [PATCH 1/4] Net device error logging, revised
    ... > wouldn't need space for the potentially large resulting string, ... > enough room for the expanded format string. ... prepend args to a va_list. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: how to prepend string to a string?
    ... from the devs. ... concept of prepend for a string is meaningless. ... providing implementations equivalent to prepend or append, ...
    (comp.lang.python)