Articles tagged #programming

sam, homebrew-mingw, etc.

I want to write blog posts, but right now I have too much to do.

So instead, here are bullet points:

  • I wrote an ooc tool named sam, which helps you keep your git repos up-to-date, and helps to remind you what to push when switching workstations. It's pretty neat, and portable.

  • A while ago, I started working on homebrew for Windows, or rather, for MinGW+MSYS. Provided you have msysgit and Ruby in your PATH, it'll let you brew install most packages. I've tested a few dozen, send in your pull requests anytime.

Having fun with 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 perils of ooc arguments

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:

Cross-platform game distribution

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.

AOT vs JIT: Why don't we do both?

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.