SlideShare a Scribd company logo
ooc
The Quest for the Holy Grail
OSDC.fr 2010 ooc-lang.org Amos Wenger
Roadmap
I. The origins
II. The best of both worlds
III. Syntactic sweets
IV. Rocking out
V. The legacy
VI. Agora
OSDC.fr 2010 ooc-lang.org Amos Wenger
The Original Sin
● After years of self-teaching
➔ The Games Factory/MultiMedia Fusion
➔ C++/OpenGL/SDL
➔ Java/Xith3D/JOODE
● Back to the real world
➔ A C school project
➔ Deadline: 6 months
➔ No object-orientation in sight
ooc-lang.orgI. The origins
The fool who challenged the gods
● A dead-end idea
➔ Java-derived syntax
➔ No structure
➔ ...instead of working on the actual project
● MOD (Miracle-Oriented Development)
➔ Naive « translator »
➔ No error checking
➔ Bug-ridden
ooc-lang.orgI. The origins
The first-born
● ooc 0.1
➔ Written in Java, 11K SLOC
➔ Generates C code
➔ Handed in along with the real project
➔ « Real » project developed in a few days
➔ Success!
« Version 1.0 sucks, but ship it anyway »
Jeff Atwood (CodingHorror)
ooc-lang.orgI. The origins
A curious alchemy
ooc-lang.orgI. The origins
The test of time
● 4 rewrites later
➔ Syntax evolved
➔ Still written in Java
➔ Type inference
➔ Generics (horribly implemented)
● Meanwhile, on #ooc-lang/Freenode
➔ A self-hosting effort is started
ooc-lang.orgI. The origins
A dream come true
● In just a few weeks
➔ rock = ooc port of the j/ooc compiler
➔ first real community effort
➔ serious cleanups
● A few more weeks, and
➔ rock compiled itself!
➔ again...
➔ and again...
➔ (with a spoon)
ooc-lang.orgI. The origins
C vs Java
● Low-level
● « Simple »
● « Lightweight »
● Fuckload of libraries
● « Object-oriented »
● « Safe »
● « Modular »
● Garbage-collected
Can't we
have both?
ooc-lang.orgII. The best of both worlds
ooc in a nutshell
● Modularity
➔ import = Modules
➔ use = Libraries
● Types
➔ cover = base types from C
➔ class = simple inheritance, interface, enum
● Functions
➔ name: func (…) -> Type { … }
➔ first-class, overload, defaults, varargs
ooc-lang.orgII. The best of both worlds
ooc in a coconut shell
● Generics
➔ identity: func <T> (t: T) T { t }→
● try, catch = Exceptions
➔ Exception new("You dun goofed!") println()
● version = Platform-specific blocks
➔ version(trial) { Time sleepSec(5) }
● operator = Operator overload
➔ operator + (a, b: Int) { a - b } // huhu.
ooc-lang.orgII. The best of both worlds
Sweet #1
● Before
Person: class {
firstname, lastname: String
init: func (firstname, lastname: String) {
this firstname = firstname
this lastname = lastname
}
}
● After
init: func (=firstname, =lastname) {}
ooc-lang.orgIII. Syntactic sweets
Sweet #2
● Before
import structs/ArrayList
import structs/HashMap
import structs/Stack
● After
import structs/[ArrayList, HashMap, Stack]
ooc-lang.orgIII. Syntactic sweets
Sweet #3
● Before
set := Set new()
set add(a)
set add(b)
set add(c)
● After
set := Set new(). add(a). add(b). add(c)
ooc-lang.orgIII. Syntactic sweets
Sweet #4
● Before
if(o instanceOf?(LeftBound)) {
e as LeftBound left
} else if(i instanceOf?(RightBound)) {
e as RightBound right
}
● After
match o {
case lb: LeftBound => lf left
case rb: RightBound => rb right
}
ooc-lang.orgIII. Syntactic sweets
Sweet #5
● Before
f: func (key: String, value: UInt) {
…
}
map each(f)
● After
list each(|key, value| …)
ooc-lang.orgIII. Syntactic sweets
covers
● Most C apis are OO
➔ include someaudiolib
➔ SomeType: cover from some_sound { ... }
➔ new: static extern(some_sound_load) func
➔ play: extern(some_sound_play) func
● We're only revealing their true nature
➔ Sound new("ka-ching.ogg") play()
ooc-lang.orgIII. Syntactic sweets
compound covers
● C structs on steroids
➔ Point: cover { x, y, z: Float }
● Stack vs Heap allocation
➔ p := (3.0, 6.0, 7.0) as Point
➔ init: func@ (=x, =y, =z) {}
● By-value semantics
● Per-method by-ref semantics with func@
➔ norm: func -> Float { Math sqrt(x*x + y*y + z*z) }
➔ set: func@ (=x, =y, =z) {}
ooc-lang.orgIII. Syntactic sweets
apropos allocation
● So far, every object is heap-allocated
➔ Boehm GC - conservative & fast (si si.)
➔ -gc=off
● But since new is a method like any other...
➔ pool := static Pool<This> new()
➔ new: static func -> This { pool acquire() }
➔ destroy: func { pool release(this) }
➔ v := Vector3 new() // sha-zam.
ooc-lang.orgIII. Syntactic sweets
extend
● User-side addition of methods to any type
extend SSizeT {
times: func (f: Func(SSizeT)) {
f(this)
(this - 1) times(f)
}
}
3 times(|| knock())
ooc-lang.orgIII. Syntactic sweets
rock
➔ ooc compiler in ooc
➔ 22K SLOC
➔ 132 modules
➔ 1900 commits
– Amos Wenger
– Friedrich Weber
– Rofl0r
– Yannic Ahrens
– Joshua Rösslein
– Scott Olson
– Michael Tremel
– Anthony Roja Buck
– Noel Cower
– Mark Fayngersh
– Peter Lichard
– Patrice Ferlet
– Nick Markwell
– Daniel Danopia
– Michael Kedzierski
– Tim Howard
– Mickael9
– Viraptor
– ...
ooc-lang.orgIV. Rocking out
The plan
ooc-lang.orgIV. Rocking out
Parsing
Resolving
Error
reporting
C backend
Generating C
C compilation
Other backends
Drivers
● combine
➔ All at the same time
➔ Legacy
● sequence (default)
➔ One by one, lib cache
➔ Partial recompilation
● make
➔ Generates a Makefile with the C code
➔ Ideal for distribution
ooc-lang.orgIV. Rocking out
Dependencies
● import text/json/Parser
➔ Not transitive (unlike include)
➔ Cyclic deps are handled
● use antigravity, sdl
➔ Name, Description, Version, Requirements
➔ Includes, Linker and compiler flags
– pkg-config
➔ SourcePath, Imports
● Bye-bye auto-tools!
ooc-lang.orgIV. Rocking out
The SDK
● Mainline SDK
➔ is comfortable (net, text, structs, io, math, os...)
➔ ...but a bit large for some
● There's no such thing as « The SDK »
➔ -sdk=, $OOC_SDK
➔ Bare minimum
– Object
– Class
– a few base types
ooc-lang.orgIV. Rocking out
The legacy
● oos
ooc operating system, runs on x86 real hw,
custom sdk, bits of asm but 0% C
● ooc-ti
sdk for tigcc, compiles+runs stuff on TI89!
● pyooc
use ooc code from python, json backend
zero-configuration
● ruby-inline-ooc
load+evaluate ruby code inside ooc
ooc-lang.orgV. The legacy
ooc-ti
ooc-lang.orgV. The legacy
The legacy II
● reincarnate
package manager, in ooc, for ooc. deps based
on usefiles, python server backend (nirvana)
● stako
a stack-based language inspired by factor
● langsniff
analyzes a text and find which language it's in
● yajit
simple just-in-time assembler - used in rock for
flattening closures
ooc-lang.orgV. The legacy
teeworlds-ai
ooc-lang.orgV. The legacy
The legacy III
● spry
IRC bot framework in ooc
● proof
small testing framework for ooc
● ooc-web
ooc web applicaton framework
● mustang
templating engine based on
the infamous mustache
ooc-lang.orgV. The legacy
inception-engine
● game engine, OpenGL+SDL, ingame console
ooc-lang.orgV. The legacy
The legacy IV
<your project here>
http://github.com/languages/ooc
ooc-lang.orgV. The legacy
Questions
➔ Languages
– What about Go/Vala?
– What about
Scala/Clojure?
– What about C++?
– What about C#?
➔ Development
– Can I contribute?
– Do you want money?
– What's next for rock?
– Where else can I help?
➔ Performance
– Is it fast?
➔ Bindings
– Does lib X have
bindings yet?
– Isn't it tedious to do
bindings?
➔ Interoperability
– Let's do rbooc!
– Let's do Perl::ooc!
– Let's do Y!
ooc-lang.orgVI. Agora
Thanks for listening!
Web http://ooc-lang.org
IRC #ooc-lang on Freenode
Twitter @ooc_lang
Mail ndd@rylliog.cz
OSDC.fr 2010 ooc-lang.org Amos Wenger

More Related Content

What's hot

ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
Michiel Borkent
 
Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...
Robert Schadek
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ Addons
Chris Barber
 
Nicety of Java 8 Multithreading
Nicety of Java 8 MultithreadingNicety of Java 8 Multithreading
Nicety of Java 8 Multithreading
GlobalLogic Ukraine
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
Michiel Borkent
 
Memory management
Memory managementMemory management
Memory management
Kuban Dzhakipov
 
NS2 Classifiers
NS2 ClassifiersNS2 Classifiers
NS2 Classifiers
Teerawat Issariyakul
 
Full Stack Clojure
Full Stack ClojureFull Stack Clojure
Full Stack Clojure
Michiel Borkent
 
NS2 Shadow Object Construction
NS2 Shadow Object ConstructionNS2 Shadow Object Construction
NS2 Shadow Object Construction
Teerawat Issariyakul
 
Reactive x
Reactive xReactive x
Reactive x
Gabriel Araujo
 
20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started
Teerawat Issariyakul
 
RealmDB for Android
RealmDB for AndroidRealmDB for Android
RealmDB for Android
GlobalLogic Ukraine
 
ConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with GroovyConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with Groovy
Iván López Martín
 
packet destruction in NS2
packet destruction in NS2packet destruction in NS2
packet destruction in NS2
Teerawat Issariyakul
 
Cluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in PracticeCluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in Practice
Steffen Wenz
 
PyParis 2017 / Camisole : A secure online sandbox to grade student - Antoine ...
PyParis 2017 / Camisole : A secure online sandbox to grade student - Antoine ...PyParis 2017 / Camisole : A secure online sandbox to grade student - Antoine ...
PyParis 2017 / Camisole : A secure online sandbox to grade student - Antoine ...
Pôle Systematic Paris-Region
 
PyData Berlin Meetup
PyData Berlin MeetupPyData Berlin Meetup
PyData Berlin Meetup
Steffen Wenz
 
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 FallJavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
Yuichi Sakuraba
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)
Phil Calçado
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
Phil Calçado
 

What's hot (20)

ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ Addons
 
Nicety of Java 8 Multithreading
Nicety of Java 8 MultithreadingNicety of Java 8 Multithreading
Nicety of Java 8 Multithreading
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
 
Memory management
Memory managementMemory management
Memory management
 
NS2 Classifiers
NS2 ClassifiersNS2 Classifiers
NS2 Classifiers
 
Full Stack Clojure
Full Stack ClojureFull Stack Clojure
Full Stack Clojure
 
NS2 Shadow Object Construction
NS2 Shadow Object ConstructionNS2 Shadow Object Construction
NS2 Shadow Object Construction
 
Reactive x
Reactive xReactive x
Reactive x
 
20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started
 
RealmDB for Android
RealmDB for AndroidRealmDB for Android
RealmDB for Android
 
ConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with GroovyConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with Groovy
 
packet destruction in NS2
packet destruction in NS2packet destruction in NS2
packet destruction in NS2
 
Cluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in PracticeCluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in Practice
 
PyParis 2017 / Camisole : A secure online sandbox to grade student - Antoine ...
PyParis 2017 / Camisole : A secure online sandbox to grade student - Antoine ...PyParis 2017 / Camisole : A secure online sandbox to grade student - Antoine ...
PyParis 2017 / Camisole : A secure online sandbox to grade student - Antoine ...
 
PyData Berlin Meetup
PyData Berlin MeetupPyData Berlin Meetup
PyData Berlin Meetup
 
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 FallJavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
 

Similar to ooc - OSDC 2010 - Amos Wenger

2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
JiandSon
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
maiktoepfer
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
Diego Freniche Brito
 
ActiveDoc
ActiveDocActiveDoc
ActiveDoc
Ivan Nečas
 
Grant Rogerson SDEC2015
Grant Rogerson SDEC2015Grant Rogerson SDEC2015
Grant Rogerson SDEC2015
Grant Rogerson
 
Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!
Christophe Alladoum
 
Twins: OOP and FP
Twins: OOP and FPTwins: OOP and FP
Twins: OOP and FP
RichardWarburton
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
GlobalLogic Ukraine
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
Andrea Righi
 
How to debug the pod which is hard to debug (디버그 하기 어려운 POD 디버그 하기)
How to debug the pod which is hard to debug (디버그 하기 어려운 POD 디버그 하기)How to debug the pod which is hard to debug (디버그 하기 어려운 POD 디버그 하기)
How to debug the pod which is hard to debug (디버그 하기 어려운 POD 디버그 하기)
어형 이
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
Amos Wenger
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
Amos Wenger
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
OWASP Kyiv
 
What Makes Objective C Dynamic?
What Makes Objective C Dynamic?What Makes Objective C Dynamic?
What Makes Objective C Dynamic?
Kyle Oba
 
Deep dive - Concourse CI/CD and Pipelines
Deep dive  - Concourse CI/CD and PipelinesDeep dive  - Concourse CI/CD and Pipelines
Deep dive - Concourse CI/CD and Pipelines
Syed Imam
 
LISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsLISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial Handouts
Tobias Oetiker
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
rkr10
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
Jorg Janke
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io
 
Campus HTC at #TechEX15
Campus HTC at #TechEX15Campus HTC at #TechEX15
Campus HTC at #TechEX15
Rob Gardner
 

Similar to ooc - OSDC 2010 - Amos Wenger (20)

2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
ActiveDoc
ActiveDocActiveDoc
ActiveDoc
 
Grant Rogerson SDEC2015
Grant Rogerson SDEC2015Grant Rogerson SDEC2015
Grant Rogerson SDEC2015
 
Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!
 
Twins: OOP and FP
Twins: OOP and FPTwins: OOP and FP
Twins: OOP and FP
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
 
How to debug the pod which is hard to debug (디버그 하기 어려운 POD 디버그 하기)
How to debug the pod which is hard to debug (디버그 하기 어려운 POD 디버그 하기)How to debug the pod which is hard to debug (디버그 하기 어려운 POD 디버그 하기)
How to debug the pod which is hard to debug (디버그 하기 어려운 POD 디버그 하기)
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
 
What Makes Objective C Dynamic?
What Makes Objective C Dynamic?What Makes Objective C Dynamic?
What Makes Objective C Dynamic?
 
Deep dive - Concourse CI/CD and Pipelines
Deep dive  - Concourse CI/CD and PipelinesDeep dive  - Concourse CI/CD and Pipelines
Deep dive - Concourse CI/CD and Pipelines
 
LISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsLISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial Handouts
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
 
Campus HTC at #TechEX15
Campus HTC at #TechEX15Campus HTC at #TechEX15
Campus HTC at #TechEX15
 

Recently uploaded

The pervasiveness of Lying in today's World.pptx
The pervasiveness of Lying in today's World.pptxThe pervasiveness of Lying in today's World.pptx
The pervasiveness of Lying in today's World.pptx
niwres
 
The Significance of the Locust Army in Revelation 9
The Significance of the Locust Army in Revelation 9The Significance of the Locust Army in Revelation 9
The Significance of the Locust Army in Revelation 9
bluetroyvictorVinay
 
B. V. Raman Hindu Predictive Astrology 1996.pdf
B. V. Raman Hindu Predictive Astrology  1996.pdfB. V. Raman Hindu Predictive Astrology  1996.pdf
B. V. Raman Hindu Predictive Astrology 1996.pdf
TerapeutaRaquelParab1
 
Tracking "The Blessing" - Christianity · Spiritual Growth · Success
Tracking "The Blessing" - Christianity · Spiritual Growth · SuccessTracking "The Blessing" - Christianity · Spiritual Growth · Success
Tracking "The Blessing" - Christianity · Spiritual Growth · Success
Jeff Zahorsky (tkg.tf)
 
Lição 12: João 15 a 17 – O Espírito Santo e a Oração Sacerdotal | 2° Trimestr...
Lição 12: João 15 a 17 – O Espírito Santo e a Oração Sacerdotal | 2° Trimestr...Lição 12: João 15 a 17 – O Espírito Santo e a Oração Sacerdotal | 2° Trimestr...
Lição 12: João 15 a 17 – O Espírito Santo e a Oração Sacerdotal | 2° Trimestr...
OmarBarrezueta1
 
Powerful Magic Rings+27604255576 for Money Fame Job Promotions Gambling in So...
Powerful Magic Rings+27604255576 for Money Fame Job Promotions Gambling in So...Powerful Magic Rings+27604255576 for Money Fame Job Promotions Gambling in So...
Powerful Magic Rings+27604255576 for Money Fame Job Promotions Gambling in So...
MalikAliMohamad1
 
New York City love spells in Dallas, TX.
New York City love spells in Dallas, TX.New York City love spells in Dallas, TX.
New York City love spells in Dallas, TX.
spellshealer8
 
THE IMPORTANCE OF AWARENESS AND CONSCIOUSNESS
THE IMPORTANCE OF AWARENESS AND CONSCIOUSNESSTHE IMPORTANCE OF AWARENESS AND CONSCIOUSNESS
THE IMPORTANCE OF AWARENESS AND CONSCIOUSNESS
giankumarmarketing
 
Ashtanga Vinyasa Yoga - concept and its method
Ashtanga Vinyasa Yoga - concept and its methodAshtanga Vinyasa Yoga - concept and its method
Ashtanga Vinyasa Yoga - concept and its method
Karuna Yoga Vidya Peetham
 
Heartfulness Magazine - June 2024 (Volume 9, Issue 6)
Heartfulness Magazine - June 2024 (Volume 9, Issue 6)Heartfulness Magazine - June 2024 (Volume 9, Issue 6)
Heartfulness Magazine - June 2024 (Volume 9, Issue 6)
heartfulness
 
Lesson 12 - The Blessed Hope: The Mark of the Christian.pptx
Lesson 12 - The Blessed Hope: The Mark of the Christian.pptxLesson 12 - The Blessed Hope: The Mark of the Christian.pptx
Lesson 12 - The Blessed Hope: The Mark of the Christian.pptx
Celso Napoleon
 
sanskrit yoga mantras chanting for yoga class
sanskrit yoga mantras chanting for yoga classsanskrit yoga mantras chanting for yoga class
sanskrit yoga mantras chanting for yoga class
Karuna Yoga Vidya Peetham
 
Tales of This and Another Life - Chapters.pdf
Tales of This and Another Life - Chapters.pdfTales of This and Another Life - Chapters.pdf
Tales of This and Another Life - Chapters.pdf
MashaL38
 
Is Lucid Dreaming Dangerous? Risks and Benefits!
Is Lucid Dreaming Dangerous? Risks and Benefits!Is Lucid Dreaming Dangerous? Risks and Benefits!
Is Lucid Dreaming Dangerous? Risks and Benefits!
Symbolic Whispers
 
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 2)
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 2)Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 2)
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 2)
Darul Amal Chishtia
 
UofT毕业证书咨询办理
UofT毕业证书咨询办理UofT毕业证书咨询办理
UofT毕业证书咨询办理
xkoue
 
Deerfoot Church of Christ Bulletin 6 16 24
Deerfoot Church of Christ Bulletin 6 16 24Deerfoot Church of Christ Bulletin 6 16 24
Deerfoot Church of Christ Bulletin 6 16 24
deerfootcoc
 
Astronism, Cosmism and Cosmodeism: the space religions espousing the doctrine...
Astronism, Cosmism and Cosmodeism: the space religions espousing the doctrine...Astronism, Cosmism and Cosmodeism: the space religions espousing the doctrine...
Astronism, Cosmism and Cosmodeism: the space religions espousing the doctrine...
Cometan
 

Recently uploaded (18)

The pervasiveness of Lying in today's World.pptx
The pervasiveness of Lying in today's World.pptxThe pervasiveness of Lying in today's World.pptx
The pervasiveness of Lying in today's World.pptx
 
The Significance of the Locust Army in Revelation 9
The Significance of the Locust Army in Revelation 9The Significance of the Locust Army in Revelation 9
The Significance of the Locust Army in Revelation 9
 
B. V. Raman Hindu Predictive Astrology 1996.pdf
B. V. Raman Hindu Predictive Astrology  1996.pdfB. V. Raman Hindu Predictive Astrology  1996.pdf
B. V. Raman Hindu Predictive Astrology 1996.pdf
 
Tracking "The Blessing" - Christianity · Spiritual Growth · Success
Tracking "The Blessing" - Christianity · Spiritual Growth · SuccessTracking "The Blessing" - Christianity · Spiritual Growth · Success
Tracking "The Blessing" - Christianity · Spiritual Growth · Success
 
Lição 12: João 15 a 17 – O Espírito Santo e a Oração Sacerdotal | 2° Trimestr...
Lição 12: João 15 a 17 – O Espírito Santo e a Oração Sacerdotal | 2° Trimestr...Lição 12: João 15 a 17 – O Espírito Santo e a Oração Sacerdotal | 2° Trimestr...
Lição 12: João 15 a 17 – O Espírito Santo e a Oração Sacerdotal | 2° Trimestr...
 
Powerful Magic Rings+27604255576 for Money Fame Job Promotions Gambling in So...
Powerful Magic Rings+27604255576 for Money Fame Job Promotions Gambling in So...Powerful Magic Rings+27604255576 for Money Fame Job Promotions Gambling in So...
Powerful Magic Rings+27604255576 for Money Fame Job Promotions Gambling in So...
 
New York City love spells in Dallas, TX.
New York City love spells in Dallas, TX.New York City love spells in Dallas, TX.
New York City love spells in Dallas, TX.
 
THE IMPORTANCE OF AWARENESS AND CONSCIOUSNESS
THE IMPORTANCE OF AWARENESS AND CONSCIOUSNESSTHE IMPORTANCE OF AWARENESS AND CONSCIOUSNESS
THE IMPORTANCE OF AWARENESS AND CONSCIOUSNESS
 
Ashtanga Vinyasa Yoga - concept and its method
Ashtanga Vinyasa Yoga - concept and its methodAshtanga Vinyasa Yoga - concept and its method
Ashtanga Vinyasa Yoga - concept and its method
 
Heartfulness Magazine - June 2024 (Volume 9, Issue 6)
Heartfulness Magazine - June 2024 (Volume 9, Issue 6)Heartfulness Magazine - June 2024 (Volume 9, Issue 6)
Heartfulness Magazine - June 2024 (Volume 9, Issue 6)
 
Lesson 12 - The Blessed Hope: The Mark of the Christian.pptx
Lesson 12 - The Blessed Hope: The Mark of the Christian.pptxLesson 12 - The Blessed Hope: The Mark of the Christian.pptx
Lesson 12 - The Blessed Hope: The Mark of the Christian.pptx
 
sanskrit yoga mantras chanting for yoga class
sanskrit yoga mantras chanting for yoga classsanskrit yoga mantras chanting for yoga class
sanskrit yoga mantras chanting for yoga class
 
Tales of This and Another Life - Chapters.pdf
Tales of This and Another Life - Chapters.pdfTales of This and Another Life - Chapters.pdf
Tales of This and Another Life - Chapters.pdf
 
Is Lucid Dreaming Dangerous? Risks and Benefits!
Is Lucid Dreaming Dangerous? Risks and Benefits!Is Lucid Dreaming Dangerous? Risks and Benefits!
Is Lucid Dreaming Dangerous? Risks and Benefits!
 
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 2)
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 2)Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 2)
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 2)
 
UofT毕业证书咨询办理
UofT毕业证书咨询办理UofT毕业证书咨询办理
UofT毕业证书咨询办理
 
Deerfoot Church of Christ Bulletin 6 16 24
Deerfoot Church of Christ Bulletin 6 16 24Deerfoot Church of Christ Bulletin 6 16 24
Deerfoot Church of Christ Bulletin 6 16 24
 
Astronism, Cosmism and Cosmodeism: the space religions espousing the doctrine...
Astronism, Cosmism and Cosmodeism: the space religions espousing the doctrine...Astronism, Cosmism and Cosmodeism: the space religions espousing the doctrine...
Astronism, Cosmism and Cosmodeism: the space religions espousing the doctrine...
 

ooc - OSDC 2010 - Amos Wenger

  • 1. ooc The Quest for the Holy Grail OSDC.fr 2010 ooc-lang.org Amos Wenger
  • 2. Roadmap I. The origins II. The best of both worlds III. Syntactic sweets IV. Rocking out V. The legacy VI. Agora OSDC.fr 2010 ooc-lang.org Amos Wenger
  • 3. The Original Sin ● After years of self-teaching ➔ The Games Factory/MultiMedia Fusion ➔ C++/OpenGL/SDL ➔ Java/Xith3D/JOODE ● Back to the real world ➔ A C school project ➔ Deadline: 6 months ➔ No object-orientation in sight ooc-lang.orgI. The origins
  • 4. The fool who challenged the gods ● A dead-end idea ➔ Java-derived syntax ➔ No structure ➔ ...instead of working on the actual project ● MOD (Miracle-Oriented Development) ➔ Naive « translator » ➔ No error checking ➔ Bug-ridden ooc-lang.orgI. The origins
  • 5. The first-born ● ooc 0.1 ➔ Written in Java, 11K SLOC ➔ Generates C code ➔ Handed in along with the real project ➔ « Real » project developed in a few days ➔ Success! « Version 1.0 sucks, but ship it anyway » Jeff Atwood (CodingHorror) ooc-lang.orgI. The origins
  • 7. The test of time ● 4 rewrites later ➔ Syntax evolved ➔ Still written in Java ➔ Type inference ➔ Generics (horribly implemented) ● Meanwhile, on #ooc-lang/Freenode ➔ A self-hosting effort is started ooc-lang.orgI. The origins
  • 8. A dream come true ● In just a few weeks ➔ rock = ooc port of the j/ooc compiler ➔ first real community effort ➔ serious cleanups ● A few more weeks, and ➔ rock compiled itself! ➔ again... ➔ and again... ➔ (with a spoon) ooc-lang.orgI. The origins
  • 9. C vs Java ● Low-level ● « Simple » ● « Lightweight » ● Fuckload of libraries ● « Object-oriented » ● « Safe » ● « Modular » ● Garbage-collected Can't we have both? ooc-lang.orgII. The best of both worlds
  • 10. ooc in a nutshell ● Modularity ➔ import = Modules ➔ use = Libraries ● Types ➔ cover = base types from C ➔ class = simple inheritance, interface, enum ● Functions ➔ name: func (…) -> Type { … } ➔ first-class, overload, defaults, varargs ooc-lang.orgII. The best of both worlds
  • 11. ooc in a coconut shell ● Generics ➔ identity: func <T> (t: T) T { t }→ ● try, catch = Exceptions ➔ Exception new("You dun goofed!") println() ● version = Platform-specific blocks ➔ version(trial) { Time sleepSec(5) } ● operator = Operator overload ➔ operator + (a, b: Int) { a - b } // huhu. ooc-lang.orgII. The best of both worlds
  • 12. Sweet #1 ● Before Person: class { firstname, lastname: String init: func (firstname, lastname: String) { this firstname = firstname this lastname = lastname } } ● After init: func (=firstname, =lastname) {} ooc-lang.orgIII. Syntactic sweets
  • 13. Sweet #2 ● Before import structs/ArrayList import structs/HashMap import structs/Stack ● After import structs/[ArrayList, HashMap, Stack] ooc-lang.orgIII. Syntactic sweets
  • 14. Sweet #3 ● Before set := Set new() set add(a) set add(b) set add(c) ● After set := Set new(). add(a). add(b). add(c) ooc-lang.orgIII. Syntactic sweets
  • 15. Sweet #4 ● Before if(o instanceOf?(LeftBound)) { e as LeftBound left } else if(i instanceOf?(RightBound)) { e as RightBound right } ● After match o { case lb: LeftBound => lf left case rb: RightBound => rb right } ooc-lang.orgIII. Syntactic sweets
  • 16. Sweet #5 ● Before f: func (key: String, value: UInt) { … } map each(f) ● After list each(|key, value| …) ooc-lang.orgIII. Syntactic sweets
  • 17. covers ● Most C apis are OO ➔ include someaudiolib ➔ SomeType: cover from some_sound { ... } ➔ new: static extern(some_sound_load) func ➔ play: extern(some_sound_play) func ● We're only revealing their true nature ➔ Sound new("ka-ching.ogg") play() ooc-lang.orgIII. Syntactic sweets
  • 18. compound covers ● C structs on steroids ➔ Point: cover { x, y, z: Float } ● Stack vs Heap allocation ➔ p := (3.0, 6.0, 7.0) as Point ➔ init: func@ (=x, =y, =z) {} ● By-value semantics ● Per-method by-ref semantics with func@ ➔ norm: func -> Float { Math sqrt(x*x + y*y + z*z) } ➔ set: func@ (=x, =y, =z) {} ooc-lang.orgIII. Syntactic sweets
  • 19. apropos allocation ● So far, every object is heap-allocated ➔ Boehm GC - conservative & fast (si si.) ➔ -gc=off ● But since new is a method like any other... ➔ pool := static Pool<This> new() ➔ new: static func -> This { pool acquire() } ➔ destroy: func { pool release(this) } ➔ v := Vector3 new() // sha-zam. ooc-lang.orgIII. Syntactic sweets
  • 20. extend ● User-side addition of methods to any type extend SSizeT { times: func (f: Func(SSizeT)) { f(this) (this - 1) times(f) } } 3 times(|| knock()) ooc-lang.orgIII. Syntactic sweets
  • 21. rock ➔ ooc compiler in ooc ➔ 22K SLOC ➔ 132 modules ➔ 1900 commits – Amos Wenger – Friedrich Weber – Rofl0r – Yannic Ahrens – Joshua Rösslein – Scott Olson – Michael Tremel – Anthony Roja Buck – Noel Cower – Mark Fayngersh – Peter Lichard – Patrice Ferlet – Nick Markwell – Daniel Danopia – Michael Kedzierski – Tim Howard – Mickael9 – Viraptor – ... ooc-lang.orgIV. Rocking out
  • 22. The plan ooc-lang.orgIV. Rocking out Parsing Resolving Error reporting C backend Generating C C compilation Other backends
  • 23. Drivers ● combine ➔ All at the same time ➔ Legacy ● sequence (default) ➔ One by one, lib cache ➔ Partial recompilation ● make ➔ Generates a Makefile with the C code ➔ Ideal for distribution ooc-lang.orgIV. Rocking out
  • 24. Dependencies ● import text/json/Parser ➔ Not transitive (unlike include) ➔ Cyclic deps are handled ● use antigravity, sdl ➔ Name, Description, Version, Requirements ➔ Includes, Linker and compiler flags – pkg-config ➔ SourcePath, Imports ● Bye-bye auto-tools! ooc-lang.orgIV. Rocking out
  • 25. The SDK ● Mainline SDK ➔ is comfortable (net, text, structs, io, math, os...) ➔ ...but a bit large for some ● There's no such thing as « The SDK » ➔ -sdk=, $OOC_SDK ➔ Bare minimum – Object – Class – a few base types ooc-lang.orgIV. Rocking out
  • 26. The legacy ● oos ooc operating system, runs on x86 real hw, custom sdk, bits of asm but 0% C ● ooc-ti sdk for tigcc, compiles+runs stuff on TI89! ● pyooc use ooc code from python, json backend zero-configuration ● ruby-inline-ooc load+evaluate ruby code inside ooc ooc-lang.orgV. The legacy
  • 28. The legacy II ● reincarnate package manager, in ooc, for ooc. deps based on usefiles, python server backend (nirvana) ● stako a stack-based language inspired by factor ● langsniff analyzes a text and find which language it's in ● yajit simple just-in-time assembler - used in rock for flattening closures ooc-lang.orgV. The legacy
  • 30. The legacy III ● spry IRC bot framework in ooc ● proof small testing framework for ooc ● ooc-web ooc web applicaton framework ● mustang templating engine based on the infamous mustache ooc-lang.orgV. The legacy
  • 31. inception-engine ● game engine, OpenGL+SDL, ingame console ooc-lang.orgV. The legacy
  • 32. The legacy IV <your project here> http://github.com/languages/ooc ooc-lang.orgV. The legacy
  • 33. Questions ➔ Languages – What about Go/Vala? – What about Scala/Clojure? – What about C++? – What about C#? ➔ Development – Can I contribute? – Do you want money? – What's next for rock? – Where else can I help? ➔ Performance – Is it fast? ➔ Bindings – Does lib X have bindings yet? – Isn't it tedious to do bindings? ➔ Interoperability – Let's do rbooc! – Let's do Perl::ooc! – Let's do Y! ooc-lang.orgVI. Agora
  • 34. Thanks for listening! Web http://ooc-lang.org IRC #ooc-lang on Freenode Twitter @ooc_lang Mail ndd@rylliog.cz OSDC.fr 2010 ooc-lang.org Amos Wenger