Image for post
Image for post

The Many Advantages of Dynamic Languages

How static type checking force you to learn 6 different languages in the worst case

add(x::Int64, y::Int64) = x + y
add x y = x + y

The fundamental difference between dynamic and static languages is that in dynamic languages values have types, while variables and expressions don’t. Static languages are the opposite, expressions and variables have types. Values tend to be binary blobs at runtime.

Downsides of Static Typing

Build System

env = Environment()
env.Append(CPPFLAGS=['-Wall','-g'])
env.Program('hello',
['hello.c', 'main.c'])

User Configuration

Image for post

Debugger

Image for post
Image for post
Debug inspectors don’t give a user-friendly view of values
struct MyRect {
let top: Float
let bottom: Float
let left: Float
let right: Float
}
def MyRectSummary(value, internal_dict):
top = value.GetChildMemberWithName("top").GetValueAsSigned()
bottom = value.GetChildMemberWithName("bottom").GetValueAsSigned()
left = value.GetChildMemberWithName("left").GetValueAsSigned()
right = value.GetChildMemberWithName("right").GetValueAsSigned()
width = right - left
height = top - bottom
return "(width = {0}, height = {1})".format(width, height)

def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand("type summary add -F " + __name__ + ".MyRectSummary MyModule.MyRect -w swift")

Tooling and IDE

(defun simplified-beginning-of-buffer ()
"Move point to the beginning of the buffer; leave mark at previous position."
(interactive)
(push-mark)
(goto-char (point-min)))

Meta programming

template<class T>        
struct Array {
int N;
T* data;

T get(int i) {
return data[i];
}

};
typedef
Array<float> FloatArray;
function Array(T)
struct Array {
N : int
data : &T
}
terra Array:get(i : int)
return self.data[i]
end
return Array
end
FloatArray = Array(float)

Dynamic Loading

struct Point {
int x, y;
};
struct Point {
int x, z, y;
};
objc_message(p, "y");

What Makes Dynamic Languages Shine

If dynamically typed Languages are superior why do statically typed languages still exist?

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store