Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Functional Programming, from Java to Scala, D. Wall (artima.com)
37 points by gtani on Sept 24, 2010 | hide | past | favorite | 4 comments


You can improve on the matching example by adding the line:

    implicit def string2regexTest(s:String)=new RegexTest(s)

    //Now we can just do
    someString @= /regularExpression/
which lets you use @= as you use ~= in Ruby.

This looks sort of evil à la monkey-patching, but it isn't nearly as bad as the compiler will complain if more than one implicit ever matches, which prevents the situation where something is redefined under you. This is definitely a good thing Scala has going for it that Ruby doesn't.


The article complains about Scala lacking Open Classes:

    Open classes let you add features at runtime. [snip] It's 
    the kind of thing that would be driving programmers nuts by
    the end of a 20-year maintenance cycle. But it's a godsend 
    when the developers of the original library weren't prescient 
    enough (or didn't have the time) to develop everything you
    need.
This is what implicit conversions are for:

http://www.scala-lang.org/node/130


Does anyone know if there is going to be a video of the talk available? I haven't been able to find anything so far and as a Java dev currently getting my feet wet with a Scala hobby project, it seemed like an interesting presentation.





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

Search: