Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
14 views

Why aren't we researching more towards compile time guarantees? [migrated]

I love all that is compile time and I love the idea that once you compile a program a lot of guarantees are made about it's execution. Generally speaking a static type system (Haskell, C++, ...) seems ...
0
votes
1answer
151 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
5answers
646 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
121 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
292 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
81 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
258 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
94 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 ...
1
vote
3answers
259 views

What are the drawbacks of not declaring a class-method static?

On the 'Interfaces' trail on the Oracle website, we are presented with the following scenario: Imagine a futuristic society where computer-controlled robotic cars transport passengers through ...
0
votes
0answers
35 views

How would I handle a set of differing event classes with differing handler interfaces in a single event processor?

I'm working on an event processor framework for a simple game I'm writing, in which multiple types of events are handled in a loop. Since these events carry distinct pieces of data (i.e. one carries a ...
1
vote
1answer
46 views

Passing around impl-specific tokens in generic algorithms in a static/strong type system

I was interested in solving several unrelated problems using generic graph search techniques, so after some fiddling around I came up with the following design: have each problem implement a generic ...
4
votes
1answer
162 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 ...
50
votes
14answers
5k views

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

I come from a statically typed language background (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 ...
5
votes
5answers
748 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 ...
4
votes
2answers
338 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 ...
18
votes
2answers
1k views

Type checking and recursive types (Writing the Y combinator in Haskell/Ocaml)

When explaining the Y combinator in the context of Haskell, it's usually noted that the straight-forward implementation won't type-check in Haskell because of its recursive type. For example, from ...
2
votes
3answers
309 views

Can compilers check whether certain axioms hold for a user defined type?

Suppose the following type is defined (C++ syntax, can be conceptually applied to any statically typed language.) class T { int val; friend bool operator<(const T& lhs, const T& rhs) ...
39
votes
4answers
5k 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 ...
0
votes
1answer
143 views

Formal definition of “concepts / type system” for parametric types - Where to start?

I would be interested in formally defining (and consequently demonstrating) a "type system" for, well, a type system. More specifically, I would like to explore the idea of what C++ calls concepts for ...
3
votes
6answers
756 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 ...
38
votes
1answer
3k views

Why does the .Net world seem to embrace magic strings instead of staticly typed alternatives?

So, I work in .Net. I make open source projects in .Net. One of my biggest problems with it isn't necessariyl with .Net, but with the community and frameworks around it. It seems everywhere that ...
50
votes
5answers
6k views

What can Haskell's type system do that Java's can't and vice versa?

I was talking to a friend about the differences between the type systems of Haskell and Java. He asked me what Haskell's could do that Java's couldn't, and I realized that I didn't know. After ...
85
votes
16answers
23k views

What functionality does dynamic typing allow?

I've been using python for a few days now and I think I understand the difference between dynamic and static typing. What I don't understand is under what circumstances it would be preferred. It is ...
8
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 ...
5
votes
4answers
1k views

Why is Invariance, Covariance and Contravariance necessary in typed languages

Ok not really sure if I'm right. I only recently learned that I needed to have contravariant interface to be able to pass that interface as a parameter in C# and this feature was only added in .NET ...
5
votes
3answers
333 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 ...
6
votes
2answers
229 views

Language that can statically ensure a map's fields are present

If data is simple and objects are complex, I'm curious if there are any existing statically typed languages that would be able to augment(?) a map type into a type with guaranteed fields. I realize ...
2
votes
2answers
495 views

Using Map in Java (or other strongly-typed languages) to work with unstructured data

After looking at the core data type for frameworks that deal with unstructured data in java: json java library: JsonObject Mongodb java api: BasicBSONObject SolrJ (Solr java client): SolrDocument ...
6
votes
4answers
196 views

Are there any languages that allow the static context of a method call to be available at runtime?

Is it possible for a method to know the type of the method it is called under? So for example in the following object orientated psuedo code: Instance io = new InstanceSubclass(); io.doStuff(); Is ...
15
votes
4answers
5k views

Using static classes as namespaces

I have seen other developers using static classes as namespaces public static class CategoryA { public class Item1 { public void DoSomething() { } } public class Item2 { ...
11
votes
1answer
716 views

(Dis-)advantages of structural typing

I’ve just watched this talk by Daniel Spiewak where he talks about the advantages of structural typing as compared to Scala’s ans Java’s nominal typing. One example for this difference would be the ...
16
votes
6answers
7k views

Is hungarian notation a workaround for languages with insufficiently-expressive (i.e. Haskell-style) static typing?

Edit To be clear, I'm not talking about annotation variable names with the data type, but rather with information about the meaning of the variable in the context of the program. For example, a ...
1
vote
2answers
136 views

Does hierarchial inheritance belong to the past? [closed]

Recently it came to my attention that hierarchical inheritance may be a relic of thinking of classes as "structs with functions" rather than a product contract-driven mentality. Consider, as a simple ...
8
votes
6answers
912 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 ...
20
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 ...
5
votes
4answers
864 views

Can static and dynamically typed languages be seen as different tools for different types of jobs?

Yes, similar questions have been asked but always with the aim of finding out 'which one is better.' I'm asking because I came up as a dev primarily in JavaScript and don't really have any extensive ...
18
votes
3answers
599 views

Are there any empirical studies on the effect of different languages on software quality?

The proponents of functional programming languages assert that functional programming makes it easier to reason about code. Those in favor of statically typed languages say that their compilers catch ...
6
votes
3answers
463 views

How should I program with dynamic typing language even no type is noted on documentation?

I lived long time on static typed language world. All types were explicitly noted on each variables and arguments. Now I have to use some kind of dynamic typing language. (Smalltalk) The problem is ...
2
votes
4answers
278 views

Function locals: variable used in just one function

In OOP, static scope means the scope is linked to the class, and instance scope is linked to a specific instance of the class. Some languages support static locals, which allow a value to be retained ...
2
votes
5answers
851 views

Functional language with C-like syntax [closed]

I've been looking for functional language with C-like syntax and static typing. So far my choice would be Nemerle. Is there anything else/better? EDIT: second choice would be Lua or Go. Any pros ...
29
votes
12answers
9k views

Why does PHP have interfaces?

I noticed that as of PHP5, interfaces have been added to the language. However, since PHP is so loosely typed, it seems that most of the benefits of using interfaces is lost. Why is this included in ...
13
votes
9answers
2k views

Dynamic vs Statically typed languages for websites [closed]

This statement suggests that statically typed languages are not ideal for web sites: I’ll contrast that with building a website. When rendering web pages, often you have very many components ...
7
votes
13answers
4k views

Would a statically typed alternative to JavaScript on webpages be practical?

Preference for dynamic and static typing is largely a matter of taste, and different people find them more or less suitable in different situations. My question is, would it be technically possible ...
45
votes
6answers
3k views

Dynamically vs Statically typed languages studies

Do there exist studies done on the effectiveness of statically vs dynamically typed languages? In particular: Measurements of programmer productivity Defect Rate Also including the effects of ...
26
votes
9answers
3k views

Do dynamic typed languages deserve all the criticism? [closed]

I have read a few articles on Internet about programming language choice in the enterprise. Recently many dynamic typed languages have been popular, i.e. Ruby, Python, PHP and Erlang. But many ...