On 2016-10-05 19:14, Matthias Klumpp wrote:

Agreed - I have exactly the same problem with "version", which is also
really common for, well, to hold a version number of a component. Body
is annoying too.

But, can keywords actually sanely be removed from the language without
breaking the world?

In Ruby most keywords are not reserved words. Example:

class Foo
  def class
  end
end

When the compiler sees the second "class" it already knows that this is a method declaration because of the "def" keyword. Actually calling this method requires a receiver:

class Foo
  def class
  end

  def bar
    class # this won't compile
self.class # this will work since the compiler knows that is has to be a method call because of the dot
  end
end

In Scala it's possible to wrap a keyword in backticks, this is necessary to be able to call a Java method that uses a name that is a keyword in Scala but not in Java:

// Java
class Foo
{
    void def () {}
}

// Scala
val a = new Foo()
a.`def`()

--
/Jacob Carlborg

Reply via email to