I love structural typing, you can be very explicit with the compiler about
where you want to use reflection and make the trade-off against performance.
If you're also creating objects (and they're not coming out of a factory
defined in some library), then another trick is to mix-in an abstract trait,
something like this:
trait Closable { def close() : Unit }
val f = new File with Closable
I can then mix that trait into ANY type that has a close method. Structural
types not required...
On 9 September 2010 10:34, B Smith-Mannschott <[email protected]> wrote:
>
>
> On Thu, Sep 9, 2010 at 08:28, Casper Bang <[email protected]> wrote:
>
>> > I still have some hope for Fantom because I don't think it crossed that
>> > threshold yet, but it's getting dangerously close to it.
>>
>> What speaks to Fantom's advantage is it's dynamic typing feature,
>> something Scala ignores completely - in spite of various luminaries
>> view that the static and dynamic world will inevitably merge down to
>> opt-in semantics. Unfortunately Scala seems to run with all the
>> attention, regardless of the bad taste in the mouth it leaves with lot
>> of people.
>>
>
> You can get much of the benefit of dynamic typing by using Scala's
> structural typing:
> http://codemonkeyism.com/scala-goodness-structural-typing/
>
> This has been part of the languge since at least 2.6 (July 2007). (3
> years!)
>
> I'm more and more convinced that the "bad taste in the mouth" people
> complain about is born of ignorance. It's just the natural reaction many
> have when confronted with something new and unfamiliar. Of course one feels
> like a klutz at first, working with a new language with new concepts,
> conventions and syntax. That's normal. Anyone who's learned more than one
> language must know this by now. I found Clojure pretty weird when I started,
> and that despite previous exposure to Scheme. Now I find, I can appreciate
> its advantages. I'd encourange those unfamiliar with Scala to cut it some
> slack or get familiar with it before spouting nonsense.
>
> // Ben
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<javaposse%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>
--
Kevin Wright
mail / gtalk / msn : [email protected]
pulse / skype: kev.lee.wright
twitter: @thecoda
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.