this

I had already made big plans for how “this” works in Babel-17, including how there would be two different inheritance mechanisms depending on the use of “this”.
But in combination with definitions, there exists already a way for an object to refer to itself; well, maybe not to itself, but to an identical copy of itself, which in a purely functional language pretty much is the same. For example instead of

object
  def message = "hello world"
  def double = (this, this)
end

one could get rid of the “this” keyword by the following reformulation:

begin
  def myobj = object
    def message = "hello world"
    def double = (myobj, myobj)
  end
  myobj
end

It seems worthwhile to refrain for now from a special “this” keyword for Babel-17, and to see how far one can take the above reformulation.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: