Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #7635

Re: Get value of named object

Newsgroups comp.lang.javascript
Subject Re: Get value of named object
References <a185a7pdddj3ui58j7a8rrtuivpe4gu92l@4ax.com> <39ekeff9.fsf@gmail.com> <d0i7a7hduiusddc08ldrhl3l3tvc8h47fe@4ax.com>
From Lasse Reichstein Nielsen <lrn.unread@gmail.com>
Date 2011-10-23 11:57 +0200
Message-ID <sjmkkp2z.fsf@gmail.com> (permalink)
Organization TDC Totalloesninger

Show all headers | View raw


Swifty <steve.j.swift@gmail.com> writes:

> On Sun, 23 Oct 2011 02:10:18 +0200, Lasse Reichstein Nielsen
> <lrn.unread@gmail.com> wrote:
>
>>I still think it's a bad idea.
>
> Is it bad as used at http://swiftys.org.uk/jsvars.html ?

That page is so simple and, probably, only really for your own usage.
Performance is irrelevant. Complexity is minimal. You control all strings
that are being passed to eval.
By all means, use eval.

The only problem is that someone might see it an think it's an acceptable
method to use in real production code, where complexity is higher, you 
might not know which strings will end up there, and performance might matter.

> It delivers the correct answers. 

It does. And it's simple to read. 

> This reminds me of my mathematics teacher, Mr Olver. If I got an
> answer right, but through faulty reasoning, he would say "Right answer
> for the wrong reason, Swift. No points".

He had a point.
Now imagine that all mathematics answers were posted on the web, and new
mathamtics students would find a random solution and learn their methods
from that. In that case, not marking bad solutions as bad is actually
harmfull.
That's where we've been, and still is, with javascript coding on the web.

It's not that "eval" can't be useful, or even essential, in a few select
cases *if you know what you're doing*. It's just that for each of those
cases, there are thousands of "programmers" that add "eval" calls that
are, at best, unnecessary, and that all have safer, faster and simpler
solutions without eval.

/L
-- 
Lasse Reichstein Holst Nielsen
 'Javascript frameworks is a disruptive technology'
  

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-22 11:56 +0100
  Re: Get value of named object "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-10-22 11:20 +0000
    Re: Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-22 18:57 +0100
      Re: Get value of named object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-22 21:20 +0200
  Re: Get value of named object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-22 14:35 +0200
    Re: Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-22 18:59 +0100
      Re: Get value of named object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-22 21:22 +0200
  Re: Get value of named object Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-22 12:53 -0700
  Re: Get value of named object Lasse Reichstein Nielsen <lrn.unread@gmail.com> - 2011-10-23 02:10 +0200
    Re: Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-23 09:01 +0100
      Re: Get value of named object Lasse Reichstein Nielsen <lrn.unread@gmail.com> - 2011-10-23 11:57 +0200
        Re: Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-24 14:11 +0100
  Re: Get value of named object Dr J R Stockton <reply1142@merlyn.demon.co.uk> - 2011-10-23 21:16 +0100

csiph-web