Hello --

On Wed, 4 Jul 2001, Yukihiro Matsumoto wrote:

> Hi,
>
> In message "[ruby-talk:17198] enhancing Ruby error messages for out of the bound constant Fixnum?"
>     on 01/07/04, Guillaume Cottenceau <gc / mandrakesoft.com> writes:
>
> |When you try to use out-of-the-bound octal values with Perl, you get a
> |warning when -w, see:
>
> <snip>
>
> |But with Ruby here, it silently does, well, I don't know:
>
> <snip>
>
> It considers the pattern /\068/ as \06 (octal 6) and following "8".
> Sould it parse like Perl's?

Actually I'm not sure there's any difference, except that Perl gives
the warning under -w:

candle:~$ echo "_678_" | perl -wpe 's/\0678/x/'
_6x_
candle:~$ echo "_678_" | perl -wpe 's/\678/x/'
Illegal octal digit ignored at -e line 1.
Illegal octal digit ignored at -e line 1.
_6x_
candle:~$ echo "_678_" | ruby -wpe 'sub(/\0678/, "x")'
_6x_
candle:~$ echo "_678_" | ruby -wpe 'sub(/\678/, "x")'
_6x_


I think when Perl says it's ignoring the illegal octal digit, it means
that it's treating it as a separate character, as Ruby does.

As for whether there should be a warning... I imagine that if one is
writing /\678/, one probably wants to, but I could be wrong.


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav