dynamic-languages

How does JavaScript .prototype work?

I'm not that in to dynamic programming but I've written my fair share of JavaScript code. I never really got my head around this prototype-based programming, does any one who know how this works? var obj = new Object(); obj.prototype.test = function() { alert('Hello?'); }; var obj2 = new obj(); obj2.test(); I remember a lot talk I ha...

Under what circumstances are dynamic languages appropriate?

I have used static languages such as C#, Java, C and some done some work in Javascript which is a dynamic language. Contrary to the popular belief, I find myself writing code faster in C# than in Javascript (and that could be because I have more experience in C# compared to javascript) So, what I want to understand is that what are the...

Does static typing mean that you have to cast a variable if you want to change its type?

Are there any other ways of changing a variable's type in a statically typed language like Java and C++, except 'casting'? I'm trying to figure out what the main difference is in practical terms between dynamic and static typing and keep finding very academic definitions. I'm wondering what it means in terms of what my code looks like. ...

Can Design-by-Contract be applied to dynamic languages as easily/well as to statically-typed ones?

The title pretty much sums up the gist. I'm interested in whether it is possible to enable/disable contract enforcement(s) when using a dynamic language without running a serious risk of poorly/un-diagnosed failure? If not, the crux seems (to me) to be that any enforcements are a required part of the component's logic, rather than opti...

Method parameters seem dynamic, not sure how this works

Hello, If I have a delegate and a method public delegate void SomeDelegate(String p); void aMethod(String p) { } And then I try to invoke this on a new thread like so SomeDelegate sd = new SomeDelegate(aMethod()); sd.BeginInvoke("heyhey", callBack, null) The BeginInvoke method call now accepts a string as the first parameter, how...

How to Make sure the code is still working after refactoring ( Dynamic language)

How to make sure that code is still working after refactoring ( i.e, after variable name change)? In static language, if a class is renamed but other referring class is not, then I will get a compilation error. But in dynamic language there is no such safety net, and your code can break during refactoring if you are not careful enoug...

Is CouchDB best suited for dynamic languages?

I´m in touch with CouchDB and the idea of mapping its results to Scala objects, as well as find some natural way to iteract with it, came immediatly. But I see that Dynamic languages such as Ruby and Javascript do things very well with the json/document-centric/shchema-free aproach of CouchDB. Any good aproach to do things with Couch i...

How do I attach a method to a dynamically-created C# type at runtime?

I have been saddled with using an in-house data access library that is effectively XML passed to a stored procedure, which returns XML. There is nothing I can do about this. I tried to get ActiveRecord approved, but my request was declined. However, using the excellent code provided at http://blog.bodurov.com/Post.aspx?postID=27, I added...

Why do dynamic languages like Ruby and Python not have the concept of interfaces like in Java or C# ?

To my surprise as I am developing more interest towards dynamic languages like Ruby and Python. The claim is that they are 100% object oriented but as I read on several basic concepts like interfaces, method overloading, operator overloading are missing. Is it somehow in-built under the cover or do these languages just not need it? If t...

Besides dynamic typing, what makes Ruby "more flexible" than Java?

I've been using Java almost since it first came out but have over the last five years gotten burnt out with how complex it's become to get even the simplest things done. I'm starting to learn Ruby at the recommendation of my psychiatrist, uh, I mean my coworkers (younger, cooler coworkers - they use Macs!). Anyway, one of the things they...

Why C# is not dynamic language?

I heard on some podcast that C# is not dynamic language, but Ruby is. I searched online to understand why, but no success. So here is my question; what is “Dynamic Language”? Is this means there’s a static language? Why C# is a dynamic language and what other languages are dynamic? If C# is not dynamic, so why Microsoft is pushing is ...

Python/Ruby as mobile OS

I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I unders...

Dynamic Languages and Variable Allocation

How does a dynamic language decide how much memory to allocate for a variable? eg. How does the compiler change variable= 5 to variable ="xxx" without too much memory overhead? When does it use the hardware stack and when does it use the memory heap? ...

What scripting languages are similar to ECMA?

I am looking for an ECMAScript alternative to work as a scripting language for custom application logic. There are things I like about ECMA, especially the syntax for the newer spec(like AS3). Unfortunately, the AS3 engine is not open source to be able to integrate in a project. I would like a scripting language that was designed for ...

Dynamic Language Features and Meta-Programming Used in Django

Any good summary articles of the dynamic language and meta-programming features of Python that get utilized by Django? Or can we build that out here? Setting this up as a wiki-style entry. ...

Overload Resolution in C# 4.0 using dynamic types

I don't have access to the C# 4.0 preview yet. But I am curious, what does the C# 4.0 runtime do when invoking an overloaded method in the following case. Does it resolve to the generic overload ... or the specialized overload. public class Foo<T> { protected string BarImpl( T value ) { return "Bar(T) says: " + value.ToString(); } ...

What makes Ruby slow?

Ruby is slow at certain things. But what parts of it are the most problematic? How much does the garbage collector affect performance? I know I've had times when running the garbage collector alone took several seconds, especially when working with OpenGL libraries. I've used matrix math libraries with Ruby that were particularly slo...

Dynamic languages - which one should I choose?

Dynamic languages are on the rise and there are plenty of them: e.g. Ruby, Groovy, Jython, Scala (static, but has the look and feel of a dynamic language) etc etc. My background is in Java SE and EE programming and I want to extend my knowledge into one of these dynamic languages to be better prepared for the future. But which dynamic l...

Real Life Benefits of Dynamic Languages?

Hi, I'm exploring several possibilities for developing a new system (web application). I'm an "old fashioned" kinda guy, object oriented in nature (converted from procedural many years ago). I played around with Python and studied a bit Ruby, but frankly I'm attracted back to using Microsoft's tools (C#, ASP.NET MVC). All this run-time...

What is the difference between dynamic languages and functional languages?

Hi, I often find developers use the terms functional language and dynamic language together, and wonder why are they always being put together. What are the differences between them? Can a language be both dynamic and functional? Do they complement each other? Why do we need them anyway? I'm a C# programmer and don't yet understand this...