dynamic-languages

Using -performSelector: vs. just calling the method

半世苍凉 提交于 2019-11-26 23:24:44
I'm still kind of new to Objective-C and I'm wondering what is the difference between the following two statements? [object performSelector:@selector(doSomething)]; [object doSomething]; ennuikiller Basically performSelector allows you to dynamically determine which selector to call a selector on the given object. In other words the selector need not be determined before runtime. Thus even though these are equivalent: [anObject aMethod]; [anObject performSelector:@selector(aMethod)]; The second form allows you to do this: SEL aSelector = findTheAppropriateSelectorForTheCurrentSituation();

Why are IOC containers unnecessary with dynamic languages

ⅰ亾dé卋堺 提交于 2019-11-26 19:08:20
问题 Someone on the Herding Code podcast No. 68, http://herdingcode.com/herding-code-68-new-year-shenanigans/, stated that IOC containers had no place with Python or Javascript, or words to that effect. I'm assuming this is conventional wisdom and that it applies to all dynamic languages. Why? What is it about dynamic languages that makes IOC containers unnecessary? 回答1: IoC provides a mechanism to break the coupling you get when an object calls 'new' on another class. This coupling ties the

What do people find so appealing about dynamic languages? [closed]

眉间皱痕 提交于 2019-11-26 16:47:07
It seems that everybody is jumping on the dynamic, non-compiled bandwagon lately. I've mostly only worked in compiled, static typed languages (C, Java, .Net). The experience I have with dynamic languages is stuff like ASP (Vb Script), JavaScript, and PHP. Using these technologies has left a bad taste in my mouth when thinking about dynamic languages. Things that usually would have been caught by the compiler such as misspelled variable names and assigning an value of the wrong type to a variable don't occur until runtime. And even then, you may not notice an error, as it just creates a new

dynamic object construction in javascript?

一世执手 提交于 2019-11-26 16:15:54
问题 When I want to call a function in javascript with arguments supplied from elsewhere I can use the apply method of the function like: array = ["arg1", 5, "arg3"] ... someFunc.apply(null, array); but what if I need to call a constructor in a similar fashion? This does not seem to work: array = ["arg1", 5, "arg3"] ... someConstructor.apply({}, array); at least not as I am attempting: template = ['string1', string2, 'etc']; var resultTpl = Ext.XTemplate.apply({}, template); this does not work

Using -performSelector: vs. just calling the method

别说谁变了你拦得住时间么 提交于 2019-11-26 08:43:48
问题 I\'m still kind of new to Objective-C and I\'m wondering what is the difference between the following two statements? [object performSelector:@selector(doSomething)]; [object doSomething]; 回答1: Basically performSelector allows you to dynamically determine which selector to call a selector on the given object. In other words the selector need not be determined before runtime. Thus even though these are equivalent: [anObject aMethod]; [anObject performSelector:@selector(aMethod)]; The second

What do people find so appealing about dynamic languages? [closed]

僤鯓⒐⒋嵵緔 提交于 2019-11-26 06:03:36
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not

Dynamic type languages versus static type languages

六眼飞鱼酱① 提交于 2019-11-26 00:39:10
问题 What are the advantages and limitations of dynamic type languages compared to static type languages? See also : whats with the love of dynamic languages (a far more argumentative thread...) 回答1: The ability of the interpreter to deduce type and type conversions makes development time faster, but it also can provoke runtime failures which you just cannot get in a statically typed language where you catch them at compile time. But which one's better (or even if that's always true) is hotly

Short description of the scoping rules?

自闭症网瘾萝莉.ら 提交于 2019-11-25 22:50:58
问题 What exactly are the Python scoping rules? If I have some code: code1 class Foo: code2 def spam..... code3 for code4..: code5 x() Where is x found? Some possible choices include the list below: In the enclosing source file In the class namespace In the function definition In the for loop index variable Inside the for loop Also there is the context during execution, when the function spam is passed somewhere else. And maybe lambda functions pass a bit differently? There must be a simple

How does JavaScript .prototype work?

牧云@^-^@ 提交于 2019-11-25 22:11:35
问题 I\'m not that into dynamic programming languages but I\'ve written my fair share of JavaScript code. I never really got my head around this prototype-based programming, does any one know how this works? var obj = new Object(); obj.prototype.test = function() { alert(\'Hello?\'); }; var obj2 = new obj(); obj2.test(); I remember a lot discussion I had with people a while back (I\'m not exactly sure what I\'m doing) but as I understand it, there\'s no concept of a class. It\'s just an object,