[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: [ANN] LuaOAuth 0.0.5
From:       Ignacio_BurgueƱo <iburgueno () gmail ! com>
Date:       2013-09-26 20:30:59
Message-ID: CAHPMtKTfFozDQRC3UMBcHBct3+NSMAPED43Yvg5+HQoq2FggRA () mail ! gmail ! com
[Download RAW message or body]

On Thu, Sep 26, 2013 at 5:32 AM, Pierre Chapuis <catwell@archlinux.us>wrote:
>
>>
>>
>> So I think this makes the code more fragile. I would rather just deal with
>> numbers and keep erroring out in other cases (maybe not using error() if
>> you prefer to handle errors differently in your code, e.g. by returning
>> nil).
>>
>

I see. I guess I'll just add a special case for numbers and booleans.
I could do what you suggest for functions, and check its return type (and
enforce strings, numbers and booleans).
If it is a userdata, see if it has a __tostring metamethod. But I'm not
sure I'm willing to go into that much complexity.

So, basically, I will do what you suggested (and return nil plus error
message).

[Attachment #3 (text/html)]

<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote"><blockquote \
class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 <div dir="ltr"><span style="color:rgb(80,0,80)">On Thu, Sep 26, 2013 at 5:32 AM, \
Pierre Chapuis </span><span dir="ltr" style="color:rgb(80,0,80)">&lt;<a \
href="mailto:catwell@archlinux.us" \
target="_blank">catwell@archlinux.us</a>&gt;</span><span style="color:rgb(80,0,80)"> \
wrote:</span><br> </div><div class=""><div class="h5"><div class="gmail_extra"><div \
class="gmail_quote"> <blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><br></div><br>
 So I think this makes the code more fragile. I would rather just deal with<br>
numbers and keep erroring out in other cases (maybe not using error() if<br>
you prefer to handle errors differently in your code, e.g. by returning<br>
nil).<br></blockquote></div></div></div></div></blockquote><div><br></div><div><br></div><div>I \
see. I guess I&#39;ll just add a special case for numbers and booleans.<div>I could \
do what you suggest for functions, and check its return type (and enforce strings, \
numbers and booleans).  </div> <div>If it is a userdata, see if it has a __tostring \
metamethod. But I&#39;m not sure I&#39;m willing to go into that much \
complexity.</div><div><br></div><div>So, basically, I will do what you suggested (and \
return nil plus error message).</div> </div><div>  </div></div></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic