Expanding and compressing in Ruby Method calls

One of the things I didn’t like in Ruby at all is the support for method overloading. You have no ways to support it in a straight forward way other than to define a single method that takes a variable number of arguments. def foo(*f) f.each { |a| puts a } end foo(“Hello”, “world”) What…

1

Bar Charts on the console

I work on the UI action recorder and it has a strict performance requirement. The tool dumps the time it takes to record each action in it’s log and that is compared against the maximum allowed value (otherwise the system will seem sluggish). To do this obviously we need fancy charts, as everyone likes them,…

1

Support for range in programming languages

The .NET platform and the languages on top of it have limited or no support for range of values. Data ranges are one of the most common data-types and somehow it’s not there. Funnily most programmers do not even seem to miss it (unless of course if you have used Ruby). How would you specify…

5

True object oriented language

  Today I was spreading the goodness of Ruby and why I love it so much (and you can expect multiple posts on it). SmallTalk programmers can sneer at me, but hey I wasn’t even born when SmallTalk came into being and hence I can be pardoned for pretending that Ruby invented this 🙂 Languages…

1

All programming languages evolve towards Lisp

In an internal DL people were debating what all should be included in the next version of C#. One of the things I suggested turned into an interesting thread. Abhinaba: Add if as expression (like in Ruby) so that I can do the following var ageGroup = if age < 2                   “Infant”               else if age <…

5

Filling income tax

The Indian income tax law allows certain expenditure and investments to be tax-exempt. The law also demands various proofs if you want to claim exemptions for this. This include original medical bills, rent-receipts, investments proofs. The list goes on. As you can guess this results in standing in a long queue and a lot of…

1

Binary banner

BoingBoing has a story of a store that sells t-shirts with offensive messages spelled out in binary. I think its a nice way to generate email signature or web-page banner where you can really say offensive stuff and get away with it. I wrote the following code in Ruby which takes any word and spits out…

2

C# Anonymous methods, lambda expressions and Ruby

In my last post I had discussed about anonymous methods. I had used the following code snippet to show how anonymous methods can be used to print out a List<string>List<string> nameList = new List<string>();nameList.Add(“Abhinaba”);nameList.Add(“Kaushik”);nameList.Add(“Samrat”);nameList.ForEach(delegate (string str) { Debug.Print(str);}); jeswin’s comment on that post was “the ugliness is really apparent at the callsite … Once we see lambdas and…

4

Ruby.NET

I had blogged earlier about Gardens Point Ruby.NET. After I read Don Box writing about it, I decided to give it a try. I tried compiling some Ruby code. I failed to get the retry code to run. It kept giving “Unable to cast object of type ‘Ruby.Object’ to type ‘Ruby.Class'” error. I tried to compile…

5

Dynamic languages on .NET

Dynamic languages prove themselves immensly powerful at places you least expect them to be. I found this out when I started coding in Ruby some time back and I completely fell in love with Ruby when I started working on the webserver project. For the last 3-4 days I’m seeing reference to Ruby on .NET at…

4