From: Dave Aronson Date: 2013-07-27T23:25:29+09:00 Subject: Re: Calculate input - numbers --047d7b2e0c1182599604e27f066a Content-Type: text/plain; charset=UTF-8 On Saturday, July 27, 2013, Marc Heiler wrote: > > Right now I use eval() and it works, but I am wondering if there is a > better alternative for it? Depends what you mean by "better". As others have shown, there are certainly more /secure/ ways, and ways that are much more able to handle things other than Ruby (i.e., you can make a parser to parse pretty much anything). On things that you know to be simple non-dangerous Ruby code, sure, eval wins /if/ your criterion is ease of use (and you're already in IRB). For most other purposes, yes, there's some thing better, but which way is best, depends on what you want out of it. -Dave -- Sent from Gmail Mobile; please excuse top posting, typos, etc. :-( --047d7b2e0c1182599604e27f066a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Saturday, July 27, 2013, Marc Heiler wrote:

Right now I use eval() and it works, but I am wondering if there is a
better alternative for it?

Depends what you mean by "better". =C2=A0A= s others have shown, there are certainly more /secure/ ways, and ways that = are much more able to handle things other than Ruby (i.e., you can make a p= arser to parse pretty much anything).

On things that you know to be simple non-dangerous Ruby code= , sure, eval wins /if/ your criterion is ease of use (and you're alread= y in IRB). =C2=A0For most other purposes, yes, there's some=C2=A0thing = better, but which way is best, depends on what you want out of it.

-Dave


--
Sent from Gmail = Mobile; please excuse top posting, typos, etc. :-(
--047d7b2e0c1182599604e27f066a--