ooc - a hybrid language experiment
DESCRIPTION
An introduction to the motivation behind the ooc project. In a nutshell: software sucks, tools sucks, languages sucks - examples of what not to do. How ooc allows you to do pretty much aything with a few building blocks. An overview of the advantages/strong points of ooc.TRANSCRIPT
OSCON 2010 http://ooc-lang.org/ Amos Wenger
oocA hybrid language experiment
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Why?Software sucks
It's unreliableIt's slowIt's too hard to developIt's not modular enough[insert rant here]
« The quality of a piece of software is inversely proportional to its popularity. » — Buchheit's law
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Why?The fate of popular software
Time
UsersQualityFeatures
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Why?
Languages suck
void (*signal(int, void (*fp)(int)))(int);
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Why?
Languages suck
void (*signal(int, void (*fp)(int)))(int);
signal: Func(Int, Func(Int)) -> Func(Int)
✔
✘
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Why?
Tools sucksmall.cpp(17) : error C2664: 'class std::_Tree<class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >,struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >const ,int>,struct std::multimap<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<int> >::_Kfn,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<int> > ::iterator __thiscall std::multimap<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<int> >::insert(const struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,int> &)' : cannot convert parameter 1 from 'const int' to 'const struct std::pair<class std ::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,int> &' Reason: cannot convert from 'const int' to 'const struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> const ,int>' No constructor could take the source type, or constructor overload resolution was ambiguous
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Why?
Tools suckGNU autoconf, automake, autoreconf – masochismGNU ld – the kitchen sink of linkersGNU make – the brainless servant
Bad workers blame the toolWhat if good workers do too?Break with tradition
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Why?
School assignment in C – laziness.4 months later – ooc 0.1« Version 1 Sucks, But Ship It Anyway » – J. Atwood
Finding a purposeTo remove obstaclesTo encourage experimentationTo minimize frustration
OSCON 2010 http://ooc-lang.org/ Amos Wenger
What?Classes, abstract, single inheritance, virtual by defaultGarbage collection (Boehm, opt-out)Covers, function overloadingPartial type inference, more type-checkingArrays, pointers, manual memory managementGeneric functions, generic classes, collectionsInterfaces, operator overloading, propertiesClosures, first-class functions, map/filter/reduce
OSCON 2010 http://ooc-lang.org/ Amos Wenger
What?
I was gonna describe the syntax hereBut we're short on schedule so I'll just sum it up:« ooc syntax is Java without bullshit » - AnonymousI'm sorry if you were offended.Java offends me too.
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Design principles
Build upon, extend, divide and conquerRe-use what makes sense, rewrite the rest as we goJDK – an example of how NOT to do modularitySDK – all you need to get started, easy to swap outDependency management made easyMaking it easy to use libs encourages good design
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Acronym fair
DRYKISSIYFFYAGNIRTFMRTFCTMTOWTDI
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Paradigm City
Procedural
println("Is i+=1 deterministic?")
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Paradigm City
Object-oriented
Window new("Vista").add(
Button new("Buy").connect("clicked", ||
"Seriously?" println())
).showAll()
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Paradigm City
Generic programming
Cell: c la s s <T> {data: Tnext: This<T>init: f u n c (=data) {}
}
c := Cell new(42)
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Paradigm City
Functional
(1..100) map(|x| x*x) reduce(|a, b| a+b)
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Paradigm City
Preemptive multi-threading
mutex := Mutex new()Thread new(||
mutex lock()// prove Fermat's last theoremmutex unlock()
) start()
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Paradigm CityCommunicating Sequential Processes
chan := make(Int)go(|| chan << question answer := ! chan)
24h for a basic implementation using libcoroutine80'000 concurrent coroutines = easy, more with tweaks
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Paradigm City
...is pretty much a nice walk with oocProvide the necessary building blocksDon't enforce the « one true way »Politics != TechnologyHigh-level low-level language.
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Generating C – the perks
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Generating C – the perks
t h r o w o ld VMExcuse("I wasn't ready!");
i f name == "__main__":dont_hold_your_breath()
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Generating C – the perks
GCC (Gnu Compiler Collection), TI-GCC, mingw32TCC (TinyCC)ICC (Intel C++ Compiler)Clang (LLVM)PCC (Portable C compiler - with tweaks)No MSVC (yet?) - they're too busy with C++0x...although in theory it wouldn't be that hard.
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Generating C – the perks
Did you know that GCC -O2 did TCO?Turn segfault into infinite loops.Protip: use -O0 (the default) when debugging
OSCON 2010 http://ooc-lang.org/ Amos Wenger
ooc - the platformSelf-hostingWithout a doubt the best way to generate CA real module system. Partial recompilation.The compiler as a libraryC from ooc is easy
ooc from C is easy (#define OOC_FROM_C)
ooc from Python is dead easy!ooc from X = reading JSON compiler output
OSCON 2010 http://ooc-lang.org/ Amos Wenger
ooc – the tools
Good compiler errorsValgrind, GDBAlleyoop, Nemiver (GTK frontends for the above)Callgrind, Kcachegrind, gprof(Pseudo-)REPL, IRC botEmacs mode – flymake, tooltips with compiler errorsLots of C bindings
OSCON 2010 http://ooc-lang.org/ Amos Wenger
Why use ooc?
Because you have a llamasyntax fetishAs a better C/C++As a better Java with no VMBecause of the toolsBecause of the communityYou want to be part of the adventure
OSCON 2010 http://ooc-lang.org/ Amos Wenger
What's next?Optimizations
Generic calls inlining – expect huge speedups(Please, Mr. Shapiro, don't burst into flames)Escape analysis, stack-allocation, annotations
An alternative to exceptionsTypesystem improvements
MixinsTypestate?
Meta-programming, compile-time execution
OSCON 2010 http://ooc-lang.org/ Amos Wenger
That's all, folks!
Web http://ooc-lang.org IRC #ooc-lang on Freenode Twitter @ nddrylliog Mail amoswenger@ gmail.com