Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by kodebach

6 hours ago

No it doesn't, but it also doesn't need it. Whereas in Java you write:

  if (obj instanceof Point(double x, double y)) {
      foo(x,y)
  }

Kotlin with its smart cast feature lets you do

  if (obj is Point) {
    foo(obj.x, obj.y);
  }

0 comments

kodebach

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities