Dynamic Typing is a property of a programming language where type checks are performed mostly at run time.

learn more… | top users | synonyms

5
votes
2answers
949 views

Does this code follow duck typing?

The principle of duck typing says that you shouldn't care what type of object you have - just whether or not you can do the required action with your object. For this reason the isinstance keyword ...
0
votes
0answers
35 views

Is listing Types in documentation a code smell

I'm documenting a ruby application and looking closely at YARD. I like the increased structure provided over RDoc, but I'm unsure about the Type declaration. In YARD, you can do something like ...
4
votes
1answer
115 views

With sufficiently advanced static typing, what are the advantages of dynamic type systems? [closed]

This question appears to be fairly well tread, for example: Do dynamic typed languages deserve all the criticism? What is the supposed productivity gain of dynamic typing? etc. However, most ...
0
votes
2answers
140 views

What is the best type to represent a number in java and why? [closed]

I am developing a dynamically typed, interpreted programming language, which is interpreted by a runtime written in Java. As Java is statically typed, I need to define how the numbers used in the ...
12
votes
2answers
248 views

Is an Optional/Maybe type useful in dynamic languages?

Optional is useful in an obvious way in a statically typed language, but I'm wondering if it's also useful in dynamic languages. Usually there's no compiler telling you, "hey, you used this ...
0
votes
2answers
231 views

What's the benefit of having everything as an object in dynamically typed programming language? [closed]

modern dynamic programming languages like Python, Ruby and Javascript all take the approach of treating everything as an object, what's the benefit of this approach, and what's the curse of it? ...
13
votes
4answers
2k views

Are there programming languages that support both static and dynamic typing? [duplicate]

Being either static or dynamic should be something completely supported in the language. Static vs dynamic shouldn't be something that you have to turn on and off, switching between basically 2 ...
3
votes
2answers
412 views

C# static practices coming from dynamic background

I have been dappling in C# after coming from several years in PHP. I don't find the language particularly difficult, although there are considerably more constructs for me to get used to. My question ...
1
vote
3answers
573 views

Is it possible to have a dynamically typed language without duck typing? [closed]

This question has been asked here, but received poor answers and didn't clarify the issue. I believe it justifies asking it again. I understand that you can have duck typing with either dynamically ...
0
votes
1answer
231 views

Is there a way to prevent variables from changing their type in Python?

It is useful to have the interpreter derive the type of a variable automatically. This on its own is similar to the auto keyword in C++11. However, in Python variables can change their type after ...
1
vote
4answers
889 views

When to not use dynamic in C# [closed]

I'm making a class similar to the following: public class KeyValue { public readonly string key; public readonly object value; } Value could be of any object type as a result of this ...
1
vote
1answer
660 views

Static typing vs. dynamic typing [closed]

I'm developing my own programming language in my spare time as a hobby. It's an interpreted language. Currently the syntax for variables is this: %<variable> = <value> Here are some ...
4
votes
6answers
1k views

How can a statically typed language support duck typing?

I understand what dynamic and static type systems are, and what duck typing is. But I don't understand how you can have a static language that supports duck typing. To my understanding only a ...
3
votes
1answer
138 views

A question about static types

How would you statically type the following JavaScript program function c(str) { c = eval(str); return c(str); } I'm not trying to start a flame war but I'm genuinely curious. I've always ...
25
votes
3answers
2k views

Is there a real advantage to dynamic languages? [closed]

First I want to say Java is the only language I ever used, so please excuse my ignorance on this subject. Dynamically typed languages allow you to put any value in any variable. So for example you ...
1
vote
2answers
316 views

is JS a gradually typed language?

I was researching on statically typed and dynamically typed concepts and found out there is another type system called gradually typed. From wikipedia Gradual typing is a type system in which ...
4
votes
0answers
85 views

How significant is the impact of the type system (static/dynamic) on the overall design of programs? [duplicate]

Coming from Java, I've never used a language with dynamic typing. I'm very used to the static-typing way of thinking. My question is, how much does the use of dynamic typing as opposed to static ...
4
votes
3answers
338 views

Classes in OOP , methods and attributes memory internals [closed]

I would assume that instances of the same class would actually share their methods, and just have save different attributes in their namespace. How often do you arbitrary add methods to a single ...
2
votes
3answers
104 views

How do statically typed languages handle test discovery? [closed]

I come from a Python background, so I'm used to pretty automatic test discovery. For example, the py.test library automatically locates any files which begin with test, finds classes whose names start ...
4
votes
1answer
181 views

How are atomic operations are a dynamic language feature?

I was told that atomic operations are a dynamic language feature. I was too afraid to ask in that context what this actually means because I didn't want my coworkers to think I'm stupid. But I ...
2
votes
6answers
895 views

Why is PHP's method of comparing different types bad?

I'm working on designing a new programming language and trying to decide how I will do variable comparisons. Along with many different types of languages, I've used PHP for years and personally had ...
58
votes
14answers
7k views

Is it a bad idea to return different data types from a single function in a dynamically typed language?

My primary language is statically typed (Java). In Java, you have to return a single type from every method. For example, you can't have a method that conditionally returns a String or conditionally ...
9
votes
5answers
1k views

Gradual Typing: “Almost every language with a static type system also has a dynamic type system”

This claim by Aleks Bromfield states: Almost every language with a static type system also has a dynamic type system. Aside from C, I can't think of an exception Is this a valid claim? I ...
3
votes
2answers
1k views

Are all scripting languages dynamically typed? [closed]

Are all scripting languages dynamically typed? I am using TCL. It is a scripting language and it does not enforce or allow type delaration of variables. It is instead a dynamically-typed language ...
4
votes
2answers
488 views

Is using static-typing the solution to domain-driven design and decreasing the number of errors?

We are using PHP (a dynamically-typed language) in our project. However, I have found my colleagues asking questions such as ...
3
votes
5answers
426 views

What are the types of dynamically typed languages arrays?

For example, in JavaScript, I can do such things: var arr = [1, "two", /three/, [4]]; There is no way to do such a thing in C! Except by using a void*, which is not an efficient/safe way. Is this ...
46
votes
5answers
6k views

Is there a correlation between the scale of the project and the strictness of the language?

Explaining the difference between strictness of languages and paradigms to a colleague of mine, I ended up asserting that: Tolerant languages, such as dynamic and interpreted languages, are used ...
2
votes
0answers
113 views

How to restructure Python frameworks [duplicate]

I just joined a group of five developers (non-professionals) working on a medium sized Python framework (> 50 modules, > 10.000 lines of code). The project has no documentation whatsoever and there ...
2
votes
2answers
282 views

unit testing variable state explicit tests in dynamically typed languages

I have heard that a desirable quality of unit tests is that they test for each scenario independently. I realised whilst writing tests today that when you compare a variable with another value in a ...
0
votes
2answers
282 views

Is it useful to use encapsulation in dynamic typed, interpreted programming language?

For what I know, encapsulation is useful because: if you use directly an attribute and change its type in a static typed language you have to change all the code that uses the class. On the ...
6
votes
3answers
374 views

Dynamic typing function arguments - how to keep readability high?

Dynamic typing newbie here, hoping for some wizened words of wisdom. I'm curious if there is a set of best practices out there for dealing with function arguments (and let's be honest, variables in ...
3
votes
6answers
829 views

In Java, would you sacrifice type safety for a nicer programming interface

When and why would you generally sacrifice typesafety for a nicer programming interface? Let me give you an example: if you had the choice between two event aggregators, which one would you prefer ...
7
votes
2answers
703 views

Why build data models in a dynamic language?

Background This question stems out of an architectural discussion we had at work. For the current project we are using Python and an object oriented database. There are input services that we ...
7
votes
3answers
436 views

Is changing the type of a variable partway through a procedure in a dynamically typed language bad style?

In Python (and occasionally PHP) where variables do not have fixed types, I'll frequently perform 'type transformations' on a variable part-way through my code's logic. I'm not (necessarily) talking ...
9
votes
5answers
1k views

Are dynamic languages at disadvantage for agile development?

From what I've read agile development often involves refactoring or reverse engineering code into diagrams. Of course there is much more than that, but if we consider the practices that rely on these ...
2
votes
2answers
332 views

New insights I can learn from the Groovy language

I realize that, for a programmer coming from the Java world, Groovy contains a lot of new ideas and cool tricks. My situation is different, as I am learning Groovy coming from a dynamic background, ...
1
vote
4answers
573 views

Where does Microsoft currently stand on dynamic languages? [closed]

With languages Python and Ruby still having a good foothold in the market what is Microsoft's current stance on dynamic languages? Does Microsoft have any plans to incorporate or invent it's own ...
0
votes
1answer
819 views

Dynamically load and call delegates based on source data

Assume I have a stream of records that need to have some computation. Records will have a combination of these functions run Sum, Aggregate, Sum over the last 90 seconds, or ignore. A data record ...
5
votes
3answers
376 views

Dynamic typing across the whole technology stack - where to enforce data validity?

Over the past year or two, I've been playing with newer technologies in my side projects. As a web developer, I've gone from the following (and still the following, at work): The 'classic' technology ...
3
votes
4answers
580 views

Higher coding standards for dynamic languages?

Due to the inherent risks associated with using dynamic languages (e.g. Python, Ruby) carelessly, what (if any) standards should be imposed on production code written in these languages?
10
votes
2answers
437 views

Developing a dynamic language

I have created several hand written compilers for very simple languages but now I want to try my hand at developing a dynamic language, similar to a simplified Python or Ruby. However, it was easy ...
3
votes
2answers
218 views

In javascript and other languages which lack a compiler, is unit testing a good method to ensure correct syntax and variable naming?

I've been working on a medium sized web application that makes very heavy use of javascript. I tend to introduce common errors per 10 lines of code with either an unknown variable name or function ...
5
votes
5answers
2k views

When and why should one create classes at runtime?

I have read many articles on the creation of dynamic types and classes at run time. For example, the TypeBuilder class in C# lets one create dynamic types. Python has this type function by which one ...
4
votes
5answers
1k views

Are design patterns independent of programming languages?

I have been recently working on Objective C and came across use of Delegate pattern. I had seen most of the common patterns theoretically in Java, thanks to the Head First book. But at times looking ...
42
votes
8answers
5k views

What is the supposed productivity gain of dynamic typing?

I often heard the claim that dynamically typed languages are more productive than statically typed languages. What are the reasons for this claim? Isn't it just tooling with modern concepts like ...
5
votes
5answers
358 views

Type-clarifying comments and type checking in dynamic languages

I often feel that there's something wrong when I code blocks such as: function foo (arg){ // arg: a SomeClass object ... } or function foo (arg){ if (Object.prototype.toString.apply(arg) ...
1
vote
3answers
678 views

Warning-free Objective C code

I am currently creating my first iPhone app in Objective C and getting a lot of warnings because I've in many places taken advantage of the fact that Objective C is a dynamically typed language. I get ...
8
votes
6answers
1k views

What is better for prototyping: a statically-typed language, or a dynamically-typed one? [closed]

When working out the design for a new system, is it better to start with a statically-typed language (like Haskell), or a dynamically-typed language (like Ruby)? Arguments I can think of: With a ...
21
votes
4answers
2k views

Architectural differences between dynamic and static languages

Are there any major architectural differences when designing applications that will be built on static languages (such as C# or Java) and dynamic languages (such as Ruby or Python)? Which are the ...
11
votes
2answers
1k views

What is the relationship between the Dynamic Language Runtime and C# 4.0?

Let's say I wanted to create a dynamic language compiler/interpreter, a Scheme interpreter perhaps, on the .NET platform as it exists today. Would I be better off using the Dynamic Language Runtime ...