dynamic-languages

Using Groovy MetaClass to overwrite Methods

I have a POJO that uses a service to do something: public class PlainOldJavaObject { private IService service; public String publicMethod(String x) { return doCallService(x); } public String doCallService(String x) { if(service == null) { throw new RuntimeException("Service must not be null...

Any need for dependency injection in Dynamic Languages?

In order to write testable C# code, I use DI heavily. However lately I've been messing around with IronPython and found that as you can mock any methods/classes/functions etc... you like, the need for DI is gone. Is this the case for dynamic langagues such as Python? Instead of: class Person(Address) { ... You can have: class Pers...

How can I write a quick and dirty interpreter?

I have an interview where one of the areas I was told I might brush up on is "dynamic programming languages". So I figured I might spend this weekend writing one to bring as sample code. :-) Of course, given the time constraints, I plan on writing something very basic and preferably using a language and/or toolset that will make it ex...

Accessing an instance variable by name (string), kinda like dynamic languages do, in C#

Hi, i've got some C# code like this: string fieldName = ... string value = ... if (fieldName == "a") a = value; if (fieldName == "b") b = value; if (fieldName == "c") c = value; if (fieldName == "d") d = value; ... I want something like this: string fieldName = ... string value = ... SetMyInstanceVariable(fieldName, value); ... I...

C#: execute a function stored in a string variable

Is it possible to write a simple and fast function in C# that will execute arbitrary methods from a string? For example, if I set MyString="MessageBox.Show("Some Message")" and then call ExecuteString(MyString), a message box would pop up with "Some Message" in it. (I've probably made some sort of error in the above code. I don't yet kn...

Cache-oblivious data structures and dynamic languages - effective?

I've been reading recently about cache-oblivious data structures like auxiliary buffer heaps. These data structures work by keeping their most-recently-accessed elements in cache memory so any subsequent access is also quicker. Most of these data structures are implemented with a low-level language like C/C++. Is it worth it to try to p...

How do you run Da Vinci Machine?

Is there IDE support for Da Vinci Machine? How do you install and work with it? ...

When will invokedynamic be available in the standard JDK?

I'm eager to start working with dynamic languages on top of Java. How long before this is part of the standard JDK? ...

Are dynamic languages slower than static languages?

Are dynamic languages slower than static languages because, for example, the run-time has to check the type consistently? ...

Calling closest fitting method

As part of developing a small ScriptEngine, I reflectively call java methods. A call by the script engine gives me the object the method name and an array of arguments. To call the method I tried to resolve it with a call to Class.getMethod(name, argument types). This however only works when the classes of the arguments and the classes e...

[C#] How to access locals through stack trace? (Mimicking dynamic scope)

Background Even though it's possible to compile C# code at runtime, it's impossible to include and run the generated code in the current scope. Instead all variables have to be passed as explicit parameters. Compared with dynamic programming languages like Python, one could never truly replicate the complete behaviour of eval (as in th...

Why are IOC containers unnecessary with dynamic languages

Someone on the Herding Code podcast No. 68, http://herdingcode.com/?p=231, 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? ...

Do all dynamic languages have the circular import issue?

For the following Python code: first.py # first.py from second import Second class First: def __init__(self): print 'Second' second.py # second.py from first import First class Second: def __init__(self): print 'Second' After creating the files and running the following from the shell: python first.py ...

Is Automatic Refactoring Possible in Dynamic Languages?

Perhaps I am limited by my experience with dynamic languages (Ruby on Netbeans and Groovy on Eclipse), but it seems to me that the nature of dynamic languages makes it impossible to refactor (renaming methods, classes, pushing-up, pulling-down, etc.) automatically. Is it possible to refactor AUTOMATICALLY in any dynamic language (with a...

Requesting advice on persisting objects from a dynamic language to a document database

Hi, Do you have any insights into the most elegant way of persisting objects from a dynamic language in a document database? I have a solid background in C# and have just started programming in Python. At the same time I am trying to learn the ropes of MongoDB. Now I am wondering: what is the most elegant way to persist my data to t...

Which conveniences does CEDET bring to dynamic languages ?

I've been looking into CEDET, but it seems that most of its features would appeal more to developpers working in statically typed languages, and I'm kind of getting cold feet from the amount of tinkering it seems to require. As I work mainly with ruby and javascript, I'm wondering what kind of improvements it could bring when working ...

Are All Dynamic Languages Typo-friendly?

With Java on one side and Ruby/Groovy on the other, I know that in the second camp I'm free to make typos which will not get caught until run-time. Is this true of all dynamically-typed languages? Edit: I've been asked to elaborate on the type of typo. In Ruby and in Groovy, you can assign to a variable with an accidental name that is n...

Which dynamic language can easily use libraries from other languages?

Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought. To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module. In other words, which language "just works" with the most modules? ...

What are the features of dynamic languages (like Ruby or Clojure) which you are missing in Scala?

What do you lose in practice when you choose a statically-typed language such as Scala (or F#, Haskell, C#) instead of dynamically-typed ones like Ruby, Python, Clojure, Groovy (which has macros or runtime metaprogramming capabilities)? Please consider best statically-typed languages and best (in your opinion) dynamically-typed languages...

Actionscript/Flex - Is it possible to dynamically extend an object, modify functions, add functions etc

I know this question might be frowned upon, but actionscript is a dynamic language similar to javascript and in javascript I can take an object from a library written by someone else and dynamically (at runtime) add/remove/modify functions, properties, prototypes etc. this is kind of like dynamically extending an object to make it work w...