Articles tagged #ooc
Unfortunately, the ooc language could have better documentation. In the meantime, I'd like to blog about about some features that might not be very well-known.
Nested functions
Here's a program that prints 1, 3, 5, 7, 9
:
import structs/ArrayList main: func { list := ArrayList<Int> new() addIfOdd := func (i: Int) { if (i % 2 != 0) list add(i) } for (i in 0..10) { addIfOdd(i) } list map(|i| i toString()) join(", ") println() }
The ooc language is known to be friendly to C libraries, and we have a slew of them covered on GitHub, but one common hurdle is how to correctly declare extern functions.
Argument types
For an ooc function prototype, there are many types of arguments. You can go with regular variable declarations, like so:
something: func (a: Int, b: Int, c: String)
But in this case, and have the same type, so you can also use multi-declarations to shorten it a bit:
ooc makes it easy to compile your application on all major platforms (Windows, OSX, Linux) - the compiler itself runs there, and the SDK supports all these platforms with basic functionality: data structures, file handling, time handling, networking, etc.
But between getting your application running on your dev environment with all the libraries installed, and getting it into a neat package for your users to run without having to install any dependencies by hand, there's a bag of tricks. Fortunately, I have found the time to figure most of them out. I'll try to explain these in detail here as clearly as possible, here in this article.
Last week-end, I participated to Ludum Dare for the fourth time in a row!
Downloads: Linux (64) | OS/X | Windows
Story
So here is our entry: Legithief. The backstory is simple, yet cunning: you are an ordinary thief practicing ordinary acts of thievery in the houses of ordinary people to make a living. But one day.. you are quietly robbing yet another home, when you are suddenly smashed in the head with a bat.
I wanted to take some time to write about a piece of software I've been working on lately, just so you know how I've been spending the last few weeks.
Rationale
A few years ago, I designed a programming language: ooc. Even though I've done my fair share of Java, C, Ruby, JavaScript, and even some Perl, Scala, Python, PHP, etc., I still find myself going back to ooc because it gives me access to C libs, relatively high-level constructs, and it forces me to write code that's not smart.
Go back to the homepage.