RSSAmplifier

Luca Guidi · Jul 22, 2020

Ruby Method Overloading

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

Method Overloading is a programming language feature that allows you to define multiple signatures (and implementations) of the same method. 
 Ruby doesn’t have such a feature. It was a shocking discovery when I switched from Java.. a very long time ago. 
 We can somehow trick the language using optional and keyword arguments. 
 But how can we have real isolated implementations…

Method Overloading is a programming language feature that allows you to define multiple signatures (and implementations) of the same method.

Ruby doesn’t have such a feature. It was a shocking discovery when I switched from Java.. a very long time ago.

We can somehow trick the language using optional and keyword arguments.

But how can we have real isolated implementations of the same method? I wrote a hack to make this possible based on method arity.

Read on /2020/07/22/ruby-method-overloading/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.