Maybe Typing

I know that there are many dynamic typing fans and weak typing fans or typeless programming fans on this wiki... but...

Some think that dynamic typing and weak typing are bugs, not features. I think dynamic typing and weak typing are "maybe" typing. I describe these type systems (or lack of) as: possibly, maybe, kind of, sort of.Your typing system is "maybe" working, and your type is maybe an integer, maybe a string, maybe not. Maybe anything. Maybe nothing. Muddying the waters.

Is it a string? Maybe! Who cares! Typing is a waste of time...

Yes, I've talked to perl programmers who actually say that thinking about your types is a waste of time and you'd be better off getting on with programming real code, instead of worrying about types.

What type are you working with? I don't care! Maybe! Or maybe I do care.

Now on the other hand let's be fair: there are times where you want a one off hack and don't care - you need something terse. Dynamic terse magic typing languages (or languages that hide types from you) are kind of like a regex. A terse regex can get things done which would otherwise take a long page of code to write. Dynamic typing allows you to write terse quick and dirty code, like regexes offer you this power. Just look at perl and ruby code: it's sort of like how a regex offers you terse ExpressivePower. But in the long run a terse regex may get hard to maintain and debug because your typing system relies on "maybes" instead of disciplined sterility.

Types are a tool. They can help us reason about code. But, at least today, types have a large cost in productivity and oft make our code brittle to extension. Other tools - e.g. ZeroButtonTesting, DynamicLanguageLint, AutomaticTestGeneration? - might cost far less in productivity but offer similar or greater benefits. Language designs, too, can allow much reasoning about safety without types - we don't need static typing for secure ObjectCapabilityModel reasoning, for example.

The phrase `MaybeTyping` reminds me of Gilad Bracha's proposal for optional, pluggable type systems ( The idea is to separate language semantics from the type system, such that we can provide safety analysis as a third party service. Gilad Bracha is not some anonymous Perl hacker; he is a principle designer of Java.

See also: WeakTypesLie, TypelessVsDynamic

EditText of this page (last edited April 10, 2012) or FindPage with title or text search