Prev: FAQ Topic - How can I access the client-side filesystem? (2010-05-11)
Next: apparently wrong function.
From: Matt Kruse on 11 May 2010 17:31 On May 11, 4:24 pm, Asen Bozhilov <asen.bozhi...(a)gmail.com> wrote: > At all you miss the point and wrote in arrogant way that reply. I don't think the reply was at all arrogant, but we may have a separation in language. > Could you show an implementation which works with: > var obj = { > property : { > '.property.' : { > '[property]' : true > } > } > > }; > $prop(obj, 'property[.property.][[property]]'); > I expect `true' instead of `undefined'. So when you show that > implementation we can again talk about the complex of the problem > which you try to solve. That is a more complex problem, yes. But it's one that _you_ are proposing to solve, not me ;) I will gladly limit the potential situations for which my solution will apply, which for my case will probably cover 99.9% of the cases. In the rare cases where it doesn't, I'm happier with writing context- specific code rather than extending my solution to a more general, obscure case. Matt Kruse
From: Garrett Smith on 11 May 2010 17:31 Thomas 'PointedEars' Lahn wrote: > Garrett Smith wrote: > >> Asen Bozhilov wrote: [...] > You want to re-read the thread and re-think your question. I want you to stop taking your personal frustrations out on this NG. -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Thomas 'PointedEars' Lahn on 11 May 2010 17:43 Matt Kruse wrote: > Scott Sauyet wrote: >> this seems cleaner to me: >> deep(context, 'property1', 'property2', 'propertyN'); > > Would it handle this: > > deep(context, 'prop1[0]') > > if 'context' has no property named 'prop1'? No, for it would be looking for a property named `prop1[0]'. To look up the `0' property of the object referred to by the `prop1' property, you would of course call it so: deep(context, 'prop1', 0) > And what if 'context' has a property named 'myarray[0]' which is an > array? > > deep(context, 'myarray[0][0]') > > ? deep(context, 'myarray[0]', 0) or deep(context, ['myarray[0]', 0]) Which one you prefer would depend on the purpose. For example, for JSX:isMethod/areMethods() I used additional arguments for property names that are part of the same member expression, and a trailing additional array argument for names of properties that are properties of the same object, i.e. jsx.object.areMethods(foo, 'bar', ['baz', 'bla']) returns `true' iff both `foo.bar.baz' and `foo.bar.bla' refer to supposedly callable objects that are referred to by properties of an object (in short: methods). PointedEars -- var bugRiddenCrashPronePieceOfJunk = ( navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac') != -1 ) // Plone, register_function.js:16
From: Thomas 'PointedEars' Lahn on 11 May 2010 17:45 Garrett Smith wrote: > Thomas 'PointedEars' Lahn wrote: >> Garrett Smith wrote: >>> Asen Bozhilov wrote: > [...] >> You want to re-read the thread and re-think your question. > > I want you to stop taking your personal frustrations out on this NG. It was merely a hint, stupid, and you managed to miss it. PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, <cife6q$253$1$8300dec7(a)news.demon.co.uk> (2004)
From: Garrett Smith on 11 May 2010 17:48
Thomas 'PointedEars' Lahn wrote: > Garrett Smith wrote: > >> Thomas 'PointedEars' Lahn wrote: >>> Garrett Smith wrote: >>>> Asen Bozhilov wrote: >> [...] >>> You want to re-read the thread and re-think your question. >> I want you to stop taking your personal frustrations out on this NG. > > It was merely a hint, stupid, and you managed to miss it. > That is exactly what I am talking about. -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/ |