[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: Re: Reporting possible BUG on string.gsub
From: Daniel van Ham Colchete <daniel.colchete () gmail ! com>
Date: 2009-01-23 20:14:54
Message-ID: 8a0c7af10901231214y9415031pcc86b4cce627a8bd () mail ! gmail ! com
[Download RAW message or body]
On Fri, Jan 23, 2009 at 2:23 PM, Kristofer Karlsson <
kristofer.karlsson@gmail.com> wrote:
> I disagree, I think it's a bug.
> Bugs aren't just about getting valid output for valid inputs, it's also
> about giving clear and understandable errors whenever possible.
> string.format throws an error if it encounters an unterminated "%", so it
> only makes sense that gsub should too.
> Silently ignoring the error and doing something completely different is nog
> very friendly behaviour.
>
> > = string.format("%")
> stdin:1: invalid option '%' to 'format'
Thanks everyone for the information. My mistake. But I agree with Kristofer,
it would have been much better to have this. In my case it was user input
that lead me to this, I didn't remember I would have to filter it first
before using it with an string.gsub(). So, it would be much nicer to have
the error message instead of the undefined behavior.
Best,
Daniel
[Attachment #3 (text/html)]
<div class="gmail_quote">On Fri, Jan 23, 2009 at 2:23 PM, Kristofer Karlsson <span \
dir="ltr"><<a href="mailto:kristofer.karlsson@gmail.com">kristofer.karlsson@gmail.com</a>></span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> I disagree, I think it's a \
bug.<br>Bugs aren't just about getting valid output for valid inputs, it's \
also about giving clear and understandable errors whenever possible.<br>string.format \
throws an error if it encounters an unterminated "%", so it only makes \
sense that gsub should too.<br>
Silently ignoring the error and doing something completely different is nog very \
friendly behaviour.<br><br>> = string.format("%")<br>stdin:1: invalid \
option '%' to 'format' </blockquote><div> <br></div></div>Thanks \
everyone for the information. My mistake. But I agree with Kristofer, it would have \
been much better to have this. In my case it was user input that lead me to this, I \
didn't remember I would have to filter it first before using it with an \
string.gsub(). So, it would be much nicer to have the error message instead of the \
undefined behavior. <br> <br>Best,<br>Daniel<br>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic