Robin Cafolla Blog

Robin Cafolla

Get: Causing 99 Problems



Since the start of the year I've been working on a game. In the spirit of modernity, and to avoid having to learn a new language as well as a whole new methodology, I'm writing it in JavaScript.

I've done a lot of work over the years in JS. However, I've never spent all my time, day in day out, working in it, and now that I am my eyes have opened to a few quirks the language harbours. Some of the more major annoyances are thankfully being addressed in es6 and es7, but one stood out yesterday by costing me several hours of work.

Here's some code:

var MyClass = function(){}; = {}; MyClass.prototype.get = function( key ){ return[ key ]; } MyClass.prototype.set = function( key, value ){[ key ] = value; } var instance = new MyClass(); Object.defineProperty( instance, '_getTouchedMethods', { __proto__: instance, writable: false, configurable: false, enumerable: false, value: function(){ return touchedMethods; } }); var touchedMethods = []; var proxy = new Proxy( instance, { get: function( target, property, receiver ){ if ( typeof target[property] === 'function' ) { console.log('Method ' + property + ' touched.'); touchedMethods.push( property ); } return target[ property ]; } }) proxy.set( 'foo', 'bar' );

Paste that into Firebug and you'll see it throws:

`TypeError: property descriptors must not specify a value or be writable when a getter or setter has been specified`

At first I was convinced the get method in the proxy was colliding with the Object.definePropery, and after several hours pouring through ES6 docs, stack overflow and MDN I decided this was a bug. In preparing a testcase for bugzilla I started commenting stuff out, and I realized that just the Object.defineProperty throws the error.

But why? it's a vary basic function I'm defining and there's nothing in the properties out of the ordinary. Again, I assumed I was doing something off-spec and hit the docs, but there's not a lot to Object.defineProperty, so I at least didn't waste long on it.

Eventually I concluded that there was a collision between MyClass.get and the Object.defineProperty. That in itself seemed like a bug when it hit me.

I'd originally written the define like:

Object.defineProperty( instance, '_getTouchedMethods', { __proto__: instance, writable: false, configurable: false, enumerable: false, value: function(){ return this.touchedMethods; } });

Where `this` had to take it's value from the __proto__. This then was the source of the problem, you can't use an object with a get method as the prototype for defineProperty.

Perhaps it's still a bug...

Robin Cafolla

The Track.



It is pitch black as we flit along the dirt trail. The sweep of the lightsman's torch pulls our heads from left to right as we stare into the darkness, our breadth held against the possiblitity of lions in the night. The cats eyes show, Pious tells us. We'll see leopards stalking in the bushes.

We've seen little yet. The first gasps at kudu, elephant and zebra now long behind us. A hush has descended. Gone our high hopes of the lion pack, not seen in two days. We see green eyes in the night, all around us. Impala waiting fearfully; stalked by our prey.

At sunset we drank at the lake edge watching the elephant herd move in caravan past us, going to the crossing to rob villages in the night. The last crocodile sank back into the water as the sun gave way to the stars.

We cross the bridge and stretch out onto the plain. We go quickly now, the time ticking before we must turn back and leave empty handed. No predators spotted in the wild, no cats seen in the night.

Then the wheels grind as Pious brakes hard. He reverses and the lightsman shines fixedly in the dark. "There!" he whispers, his voice loud above the engine, "Hyena". We stare out into the dark, but nothing moves. The torch scans a large bush, too thick to penetrate. We wait for a long moment, then with no great interest in us, the hyena emerges, loping along with its ungraceful bounds. It's big and powerful; larger than a dog, with a head more like a bear. It's also ragged and unpleasant, a mongrel's mongrel.

Relief seeps through the three of us. We've seen our first predator.

The engine shudders into life and we move on. The stars are bright now, the sweep of the milky way panned out above us. I'd nearly be happy to just sit and watch the stars, but the call of the unkown is pulling us deeper.

We cross broken country, scrub brush spread across our flanks. There are no eyes in the dark here, a lone civet is caught by the light. The whistle of the air is cool on my face, we speed up and enter the forest. Every few minutes the countryside changes here; no two parts quite the same. Every half a kilometer we see something diferent, even in the dark you can tell the land is old. Erosion lines wriggle down to great gulfs; dry rivers draining down to the mighty Luangwa.

We burst from the trees with a rattle. The land is smooth here. In the distance we can see the lights of two cars. A good sign, cars only gather when there is something to see. It spoils the isolation, no longer do we feel so alone.

Pious speeds up, I clutch the rail, white knuckled, breadth forced. The hand-cannon, my great tokina lense, is clasped in my lap. It's heavy and I have to hold it in the crook of my arm to keep it safe as we bounce along the trail.

We draw up to the trucks, similar to ours, big off-road safari vehicles. Their engines are off and we ease in beside them. Their spotters have their torches focused at a single point, a dead Imapala, behind it, the leopard.

All we see at first is her head above the dead male impala's carcass, but she stands to get a better purchase. She's beautiful, with a sleek dangerous beauty. A killer; slick and deadly. Pious urges her to hurry under his breadth "If she doesn't get him up a tree quickly the hyenas will come." she works hard at the corpse "She's gutting him, to make it lighter. He's too heavy to get up the tree." We wait enchanted despite the grisly scene.

There is a growl in the dark and the leopard edges back, staring into the bushes. One of the cars pulls its light upwards. Our hearts sink, the hyenas have come. A small one at first, smaller than her. "She won't risk a fight. Any wound would be a disaster, she has two cubs to feed." We will the hyena to leave, but it's hungry and the impala is a good prize.

For a long while there is a standoff, the leopard too wary to move, the hyena too cowardly to steal it's dinner. The hyena however has the advantage, the longer it waits the more likely backup will arrive; the leopard has no such luxury. The hyena moves first, the leopard backs away and starts to circle. The hyena savages the carcass, ripping the guts out with a terrific noise. The smell of the impala drifts out onto the air. We can smell it from the truck, hot and earthy, but not unpleasant.

Having taken the insides the hyena moves away. The leopard returns. Now that the impala is lightened we hope she can get it to the safety of the tree.The leopard needs to be quick, the smell of blood will draw all the hyenas in the area, bt hyenas can't climb.

She starts tugging on the antelope, pulling it hard towards the tree, but it still seems too heavy, she starts to eat, trying to lighten the load. She soon stops, a bigger hyena has arrived. She moves away to the tree, with a bound she's in its safety. She's given up.

The two hyenas rip the carcass to shreds, consuming almost everything in a matter of minutes. The leopard watches from the tree, when the hyenas finally move off she takes the scraps on the ground.

We see another leopard in daylight the next morning, then wild dogs later in the day and lions that evening, but for me the magic was watching the leopard stalk by, 2 metres from the car, in the dark.

The leopard, 2m from our truck.
Robin Cafolla

Review: The Living Room, Lilongwe, Malawi.



Every proper journey needs to have a quest; a symbolic, often pointless endeavour to give context and meaning to the voyage. The last time I went travelling, in 2006, the quest was to eat a kebab in every city I visited. As a result I learnt that kebabs actually get worse the closer to Turkey you get. The nicest I had were in Milan.

My quest this time, inspired by Maria, is to review all of the random eateries I stop in along the way, from the lowliest chip hut to the most refined restaurant.

So, with Malawi appropriately the starting point, here is my review of the food at Lilongwe's expat night time hotspot; The Living Room.

The Living Room

The taxi driver is lost. I've just gotten in at Shoprite and he's clearly never heard of our destination. Only moments earlier we had a conversation along these lines:"

  1. Me: Hi, do you know where the living room is?
  2. Driver: What? Yes.
  3. Me: The Living Room. You know how to get there?
  4. Driver: Yes.
  5. Me: How much?
  6. Driver: 3000.
  7. Me: 3000? It's only around the corner. 1000.
  8. Driver: You know where it is?.
  9. Me: Vaguely. Behind shoprite, but I don't know what street.
  10. Driver: Behind Shoprite? Ok. 1500.
  11. Me: Ok. You definitely know where it is?
  12. Driver: Yes.
  13. I climb into his cab. We turn the corner, around shoprite.
  14. Driver: You know where it is?
  15. Me: You said you knew! I only know it's somewhere in this direction.
  16. Driver: Is it this street?
  17. Me: I don't know! I'll get another taxi.
  18. Driver: No no. We'll find it. What is the name of the place we are going?

10 minutes and 8 streets later he remembers that he does know where the living room is. I give him the 2000, although I instantly regret it. I shouldn't encourage this sort of nonsense

The exterior is well appointed, bricks and flower baskets and a general niceness. The hipster in me is instantly impressed by the converted singer sewing-machine table I plonk myself down at. The Living Room is well regarded as a very western cafe bar and so far so good.

I'm not primarily here to eat it must be said. I had a god awful breakfast quesadilla at Papaya, Lilongwe's only mexican joint, only an hour ago. I'm not even remotely peckish but it's a hot day and it's been a long morning and I need a few coffees and cold drinks to see me through.

The cause of my consternation is my phone. My trusted HTC Desire Z, a constant companion of nearly 3 years, has given up the ghost. Just before I left for Malawi part of the touch screen stopped working. Like a fool I had soldiered on with it because I'd just bought two replacement batteries for it ahead of this trip and didn't want to replace it before the shiny Ubuntu phones get released (hopefully next year).

It's an essential piece of kit. I need it for internet access and to be able to communicate with the outside world. This morning the touch screen completely stopped working and I've realized that it's going to be a hard thing to replace in Malawi.

But I digress.

I begin by ordering a smoothie, but strawberries, it's main constituent, aren't in season. I take this with good grace and try for another strawberry free smoothie. My waiter, a young man whose English I instantly understand isn't very polished looks perplexed and stares long and hard at the menu entry for the coconut smoothie I hopefully point towards. Finally he stammers an apology. I take this to mean smoothies are out. I can't see lights on inside, maybe the powers out and the blender won't work, or perhaps coconuts too are out of season. I go for coffee and an orange juice. I had that yesterday, so I'm optimistic that the season for oranges hasn't just expired.

These kinds of ordering difficulties are fairly common in Africa, or at least in Malawi. Menus seem to reflect the best intentions of their author's, or the random assortment of food the chef was preparing on the day the menu went to print.

The orange juice is from a carton but it's cold, which is what I need. The coffee is ok.

I pass the time looking up mobile phones, somewhat morosely. Phones that cost €180 euro, sim free, at home, cost almost double that here. At 550 Kwacha to the euro the most promising phone I found in my search this morning, the Samsung Galaxy S Advance, is an impressive sounding 189,995 Kwacha. I briefly consider a flight home, or to South Africa, but this seems a little silly.

I feel a little guilty sitting here with the dregs of my coffee, so I request a menu. I order a home made Iced tea. I ask if it's flavoured; just to be sure. He doesn't understand. I point and ask if it's perhaps lemon iced tea? He thinks about this. "Lemon. Yes.". I'm not sure he got me, but I thank him anyway. He comes back to confirm that it is a Long Island Iced tea I want. I point to the non-alcoholic tea I'm after. He smiles in understanding and hurries away. He comes back to ask which flavour of herbal green tea I want. I slowly and in as un-Irish an accent as I can muster tell him I want the home-made iced tea. Again, he smiles in understanding and departs. I wonder what I'm going to get, and if it'll be cooling. If it's alcoholic it would nearly be a relief, after all this back and forth I feel like a drink.

Service in Malawi is always friendly and polite, but rarely efficient or helpful. It's often best to order before you get really hungry. My record wait for food to date was an hour and a half for rice and a stew in Dedza pottery.

The waiter returns and my heart sinks. But it's just to check that I'm ok with the ginger Iced tea. I'm all for it. The tea, when it arrives, is good if not quite fiery enough for me. It's very cool, which is great.

By 12.30 I'm feeling hungry enough to try the Living Room's food offering.

There are 3 food menus to choose from. I go for the one the waiter guides me towards. I've been told this place is good, so I take a risk with an intriguing food combination; Chicken Schnitzel with grated cheese and creamy mushroom sauce. The waiter, thankfully as my patience is nearly exhausted, understands me first time.

There are 3 basic flavours in Malawian cuisine; bland, characterised by the national dish nsima; salty, almost everything is salty; and very salty, salt apparently constituting an entire food group of it's own.

The food is delivered in under 30 minutes, which I am impressed with. It looks ok, not polished but not unappetizing. It is delivered alongside 3 containers of knorr sauces, none of them entice me, but I do feel a vague sense of Irish pride at the brand's appearance.

The schnitzel is heavily smothered in cheese and mushroom sauce and is accompanied by potato wedges and an attempt at a salad. The odd schnitzel combination works. Despite the salt I can't help but agree that a chicken schnitzel is improved with cheese and mushroom sauce.

The wedges verge on the very salty, and I notice they and the edge of the plate they came on are covered in a yellow salt. Hopefully its been mixed with something. Something deliberate I mean.

I don't eat the salad because it's a tomato sliced into quarters, with a few leaves of wilted lettuce and a few slices of onion. The onion, through some process I don't understand, is salty.

Overall the food at the living room is fairly standard, all my assorted delights, plus a bottle of water, to wash down the salt, comes in at 5000 kwacha (about €10).


Verdict: Food was unimpressive but edible. Atmosphere was relaxed and the setting is nice, particularly for Lilongwe. Suffers from Malawian salt over useage.