Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You mean like this? (not Java):

  multi infix:<plus>(Int $a, Int $b) {
      return $a + $b;
  }
  multi infix:<plus>(Str $a, Str $b) {
      return $a ~ $b;
  }
  
  say 10 plus 4;
  # 14
  
  say "foo" plus "bar";
  # foobar


what's that? Perl 6?


Yep. Much of the language is implemented in itself (at least in Rakudo), using such structures:

https://github.com/rakudo/rakudo/blob/nom/src/core/Int.pm#L1...

NQP in that link is "Not Quite Perl", a subset of the language which is the what actually needs to be implemented to support Perl 6. This is what's almost done being ported to Java. Again, for Rakudo, which is one implementation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: