This page is no longer maintained — Please continue to the home page at www.scala-lang.org

state of scala summer 2010

14 replies
Tommy Chheng
Joined: 2010-03-06,
User offline. Last seen 1 year 23 weeks ago.

I just noticed a State of Clojure Survey at
http://muckandbrass.com/web/display/~cemerick/2010/06/07/Results+from+th...

Thought it would be interesting to have a state of scala summer survey
as well so I made a google form:
http://spreadsheets.google.com/viewform?hl=en&formkey=dEtVclNLLUxuQzUtVX...

public view of the data:
http://spreadsheets.google.com/ccc?key=0AoQaKTzyxVl_dEtVclNLLUxuQzUtVXhS...

*disregard this if there already has been a scala survey recently.

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
type not inferred - but why?

this is my code:
def filterOwnEntitiesByType[T <: BroodwarEntity](c: Class[T], f: T =>
Boolean = (e: T) => true): Iterable[T] = {
knownEntities.values.filter((e) => e.isOwnedByMe && c.isInstance(e)
&& f(e.asInstanceOf[T])).asInstanceOf[Iterable[T]]
}

so far, so good. i call it like this:
val candidates =
ctx.filterOwnEntitiesByType[BWBuilding](classOf[BWBuilding], b =>
b.methodOfB)
or
val candidates = ctx.filterOwnEntitiesByType(classOf[BWBuilding],
b:BWBuilding => b.methodOfB)

the question is, why do i need to tell the compiler the type twice? if i
use currying:

def filterOwnEntitiesByType[T <: BroodwarEntity](c: Class[T])( f: T =>
Boolean = (e: T) => true): Iterable[T] = {
knownEntities.values.filter((e) => e.isOwnedByMe && c.isInstance(e)
&& f(e.asInstanceOf[T])).asInstanceOf[Iterable[T]]
}

this works:
val candidates = ctx.filterOwnEntitiesByType(classOf[BWBuilding])(b =>
b.methodOfB)

in the first case, the type info is lost...

i remember that i asked this some time ago, but didn't remember someone
answering and don't know if it was here, so i ask again :)

Colin Bullock
Joined: 2009-01-23,
User offline. Last seen 42 years 45 weeks ago.
Re: type not inferred - but why?


On Tue, Jun 8, 2010 at 12:26 PM, HamsterofDeath <h-star [at] gmx [dot] de> wrote:
this is my code:
 def filterOwnEntitiesByType[T <: BroodwarEntity](c: Class[T], f: T =>
Boolean = (e: T) => true): Iterable[T] = {
   knownEntities.values.filter((e) => e.isOwnedByMe && c.isInstance(e)
&& f(e.asInstanceOf[T])).asInstanceOf[Iterable[T]]
 }


This can be simplified with manifests to avoid having to pass the class parameter at all:

def filterOwnEntitiesByType[T <: BroodwarEntity : Manifest](f: T => Boolean = e: T => true) = {
  val c = implicitly[Manifest[T]].erasure
  knownEntities.values.filter(e => e.isOwnedByMe && c.isInstance(e) && f(e.asInstanceOf[T])).asInstanceOf[Iterable[T]]
}

- Colin

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: type not inferred - but why?

that would save a few characters, thx.
but the question is still unanswered

Colin Bullock schrieb:
>
>
> On Tue, Jun 8, 2010 at 12:26 PM, HamsterofDeath > wrote:
>
> this is my code:
> def filterOwnEntitiesByType[T <: BroodwarEntity](c: Class[T], f: T =>
> Boolean = (e: T) => true): Iterable[T] = {
> knownEntities.values.filter((e) => e.isOwnedByMe && c.isInstance(e)
> && f(e.asInstanceOf[T])).asInstanceOf[Iterable[T]]
> }
>
>
> This can be simplified with manifests to avoid having to pass the
> class parameter at all:
>
> def filterOwnEntitiesByType[T <: BroodwarEntity : Manifest](f: T =>
> Boolean = e: T => true) = {
> val c = implicitly[Manifest[T]].erasure
> knownEntities.values.filter(e => e.isOwnedByMe && c.isInstance(e) &&
> f(e.asInstanceOf[T])).asInstanceOf[Iterable[T]]
> }
>
> - Colin
>

Sean Corfield
Joined: 2009-10-25,
User offline. Last seen 2 years 9 weeks ago.
Re: state of scala summer 2010

An interesting result from Chas Emerick's survey:

Question: If Clojure disappeared tomorrow, what language(s) might you
use as a "replacement"?

Top answer: Scala (35%).

It made me wonder: how many Scala folk are also Clojure users?

Sean

On Tue, Jun 8, 2010 at 9:45 AM, Tommy Chheng wrote:
>  I just noticed a State of Clojure Survey at
> http://muckandbrass.com/web/display/~cemerick/2010/06/07/Results+from+th...
>
> Thought it would be interesting to have a state of scala summer survey as
> well so I made a google form:
> http://spreadsheets.google.com/viewform?hl=en&formkey=dEtVclNLLUxuQzUtVX...
>
> public view of the data:
> http://spreadsheets.google.com/ccc?key=0AoQaKTzyxVl_dEtVclNLLUxuQzUtVXhS...
>
> *disregard this if there already has been a scala survey recently.

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: state of scala summer 2010

i plan on looking into it

Sean Corfield schrieb:
> An interesting result from Chas Emerick's survey:
>
> Question: If Clojure disappeared tomorrow, what language(s) might you
> use as a "replacement"?
>
> Top answer: Scala (35%).
>
> It made me wonder: how many Scala folk are also Clojure users?
>
> Sean
>
> On Tue, Jun 8, 2010 at 9:45 AM, Tommy Chheng wrote:
>
>> I just noticed a State of Clojure Survey at
>> http://muckandbrass.com/web/display/~cemerick/2010/06/07/Results+from+th...
>>
>> Thought it would be interesting to have a state of scala summer survey as
>> well so I made a google form:
>> http://spreadsheets.google.com/viewform?hl=en&formkey=dEtVclNLLUxuQzUtVX...
>>
>> public view of the data:
>> http://spreadsheets.google.com/ccc?key=0AoQaKTzyxVl_dEtVclNLLUxuQzUtVXhS...
>>
>> *disregard this if there already has been a scala survey recently.
>>
>
>

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: state of scala summer 2010

i think it's natural, they are probably the two most interesting new languages on the JVM, and they share a lot of ideas in common, a lot of ideas are also continuously exchanged (e.g. the STM's on scala are all clojure inspired i think, also collections). in the therighttool ranking, if you look at scala, clojure is #2 in "most similar" languages. not that the actual language is so similar, but probably what people value about it, how it is used, etc. i also recognized for example on github, when you look at who is following who, there is a lot of scala folks watching clojure projects and vice-versa.

if lisp hadn't such a horrible syntax, i would definitely be interested in it, too :-)

best, -sciss-

Am 08.06.2010 um 21:44 schrieb Sean Corfield:

> An interesting result from Chas Emerick's survey:
>
> Question: If Clojure disappeared tomorrow, what language(s) might you
> use as a "replacement"?
>
> Top answer: Scala (35%).
>
> It made me wonder: how many Scala folk are also Clojure users?
>
> Sean
>
> On Tue, Jun 8, 2010 at 9:45 AM, Tommy Chheng wrote:
>> I just noticed a State of Clojure Survey at
>> http://muckandbrass.com/web/display/~cemerick/2010/06/07/Results+from+th...
>>
>> Thought it would be interesting to have a state of scala summer survey as
>> well so I made a google form:
>> http://spreadsheets.google.com/viewform?hl=en&formkey=dEtVclNLLUxuQzUtVX...
>>
>> public view of the data:
>> http://spreadsheets.google.com/ccc?key=0AoQaKTzyxVl_dEtVclNLLUxuQzUtVXhS...
>>
>> *disregard this if there already has been a scala survey recently.

Tommy Chheng
Joined: 2010-03-06,
User offline. Last seen 1 year 23 weeks ago.
Re: state of scala summer 2010

When I got interested in functional programming, i started learning
clojure first.
I tried really hard to battle the lisp syntax but in the end, i can't
stand the prefix notation(especially for math operations) so i turned to
scala.

I really like the other components of clojure: persistent data
structures, lightweight data compositions, the Seq collection
abstraction etc

@tommychheng
Programmer and UC Irvine Graduate Student
Find a great grad school based on research interests: http://gradschoolnow.com

On 6/8/10 1:44 PM, Sean Corfield wrote:
> An interesting result from Chas Emerick's survey:
>
> Question: If Clojure disappeared tomorrow, what language(s) might you
> use as a "replacement"?
>
> Top answer: Scala (35%).
>
> It made me wonder: how many Scala folk are also Clojure users?
>
> Sean
>
> On Tue, Jun 8, 2010 at 9:45 AM, Tommy Chheng wrote:
>> I just noticed a State of Clojure Survey at
>> http://muckandbrass.com/web/display/~cemerick/2010/06/07/Results+from+th...
>>
>> Thought it would be interesting to have a state of scala summer survey as
>> well so I made a google form:
>> http://spreadsheets.google.com/viewform?hl=en&formkey=dEtVclNLLUxuQzUtVX...
>>
>> public view of the data:
>> http://spreadsheets.google.com/ccc?key=0AoQaKTzyxVl_dEtVclNLLUxuQzUtVXhS...
>>
>> *disregard this if there already has been a scala survey recently.

Lex
Joined: 2010-02-28,
User offline. Last seen 42 years 45 weeks ago.
Re: type not inferred - but why?

These are the comments on classOf[T] method:

/** Return the runtime representation of a class type. This is a stub method.
* The actual implementation is filled in by the compiler.
*/

So classOf[T] is a majic method, treated specially by the compiler.
Because of the special treatment the normal type inference does not
get applied. This is specific to a compiler implementation and may be
changed, however this looks like a low priority feature.

On Tue, Jun 8, 2010 at 4:18 PM, HamsterofDeath wrote:
> that would save a few characters, thx.
> but the question is still unanswered
>
> Colin Bullock schrieb:
>>
>>
>> On Tue, Jun 8, 2010 at 12:26 PM, HamsterofDeath > > wrote:
>>
>>     this is my code:
>>      def filterOwnEntitiesByType[T <: BroodwarEntity](c: Class[T], f: T =>
>>     Boolean = (e: T) => true): Iterable[T] = {
>>        knownEntities.values.filter((e) => e.isOwnedByMe && c.isInstance(e)
>>     && f(e.asInstanceOf[T])).asInstanceOf[Iterable[T]]
>>      }
>>
>>
>> This can be simplified with manifests to avoid having to pass the
>> class parameter at all:
>>
>> def filterOwnEntitiesByType[T <: BroodwarEntity : Manifest](f: T =>
>> Boolean = e: T => true) = {
>>   val c = implicitly[Manifest[T]].erasure
>>   knownEntities.values.filter(e => e.isOwnedByMe && c.isInstance(e) &&
>> f(e.asInstanceOf[T])).asInstanceOf[Iterable[T]]
>> }
>>
>> - Colin
>>
>
>

Arthur Peters 2
Joined: 2009-01-10,
User offline. Last seen 42 years 45 weeks ago.
Re: type not inferred - but why?

If I remember correctly for the argument type of an anonymous function to be inferred the expected type of the function must be known. And inference is done one parameter list at a time not one parameter at a time, so the type T is not known if the parameters are in the same list, however if they are in different lists T will be known.

In this case T is not known until the first argument classOf[OtherClass] is fully typed. Where as using a manifest T is defined explicitly.

-Arthur (sent from phone)

On Jun 8, 2010 4:18 PM, "HamsterofDeath" <h-star [at] gmx [dot] de> wrote:

that would save a few characters, thx.
but the question is still unanswered

Colin Bullock schrieb:

>
>
> On Tue, Jun 8, 2010 at 12:26 PM, HamsterofDeath <h-star [at] gmx [dot] de

> <mailto:h-star [at] gmx [dot] de>> wrote:
>
> this is my code:
> def filterOwnEntitiesByType[T <: Br...

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: type not inferred - but why?

On Tue, Jun 08, 2010 at 05:55:25PM -0400, Lex wrote:
> So classOf[T] is a majic method, treated specially by the compiler.
> Because of the special treatment the normal type inference does not
> get applied. This is specific to a compiler implementation and may be
> changed, however this looks like a low priority feature.

Supposing one wanted to test out one's theories before assuredly
explaining the mechanism to the rest of the world, here is the sort of
test one might apply:

scala> def f[T](c: Class[T], f: T => Boolean): Iterable[T] = null
f: [T](c: Class[T],f: (T) => Boolean)Iterable[T]

scala> def f2[T](c: Class[T])(f: T => Boolean): Iterable[T] = null
f2: [T](c: Class[T])(f: (T) => Boolean)Iterable[T]

scala> f(classOf[String], _ => true)
:7: error: missing parameter type
f(classOf[String], _ => true)
^

scala> f2(classOf[String])(_ => true)
res1: Iterable[String] = null

scala> def g[T](xs: List[T], f: T => Boolean): Iterable[T] = null
g: [T](xs: List[T],f: (T) => Boolean)Iterable[T]

scala> def g2[T](xs: List[T])(f: T => Boolean): Iterable[T] = null
g2: [T](xs: List[T])(f: (T) => Boolean)Iterable[T]

scala> g(1 :: Nil, _ => true)
:7: error: missing parameter type
g(1 :: Nil, _ => true)
^

scala> g2(1 :: Nil)(_ => true)
res3: Iterable[Int] = null

Maxime Lévesque
Joined: 2009-08-18,
User offline. Last seen 42 years 45 weeks ago.
Re: state of scala summer 2010

I found this response in the survey totally hilarious :

* "I worry that Clojure is becoming too popular too fast and is in
imminent danger of being 'enterprised,' so to speak, by people whose
gifts are limited to the gift of gab and the gift of garb."

It's funny how the term "enterprise" went from a marketing buzzword
giving credibility, to a synonym of over engineered bloatware.

It sums up remarkably well what happened to Java : it got "enterprised" ! ;-)

Lets hope Scala doesn't get "enterprised", so far I really don't see
it happening...

On Tue, Jun 8, 2010 at 12:45 PM, Tommy Chheng wrote:
>  I just noticed a State of Clojure Survey at
> http://muckandbrass.com/web/display/~cemerick/2010/06/07/Results+from+th...
>
> Thought it would be interesting to have a state of scala summer survey as
> well so I made a google form:
> http://spreadsheets.google.com/viewform?hl=en&formkey=dEtVclNLLUxuQzUtVX...
>
> public view of the data:
> http://spreadsheets.google.com/ccc?key=0AoQaKTzyxVl_dEtVclNLLUxuQzUtVXhS...
>
> *disregard this if there already has been a scala survey recently.
>
>
> --
> @tommychheng
> Programmer and UC Irvine Graduate Student
> Find a great grad school based on research interests:
> http://gradschoolnow.com
>
>

Kevin Wright 2
Joined: 2010-05-30,
User offline. Last seen 26 weeks 4 days ago.
Re: state of scala summer 2010
Any chance of widening column F?
it's making for some very jerky scrolling when each row is taller than the browser window


2010/6/9 Maxime Lévesque <maxime [dot] levesque [at] gmail [dot] com>
I found this response in the survey totally hilarious :

 *  "I worry that Clojure is becoming too popular too fast and is in
imminent danger of being 'enterprised,' so to speak, by people whose
gifts are limited to the gift of gab and the gift of garb."

It's funny how the term "enterprise" went from a marketing buzzword
giving credibility, to a synonym of over engineered bloatware.

It sums up remarkably well what happened to Java : it got "enterprised" ! ;-)

Lets hope Scala doesn't get "enterprised", so far I really don't see
it happening...


On Tue, Jun 8, 2010 at 12:45 PM, Tommy Chheng <tommy [dot] chheng [at] gmail [dot] com> wrote:
>  I just noticed a State of Clojure Survey at
> http://muckandbrass.com/web/display/~cemerick/2010/06/07/Results+from+the+State+of+Clojure,+Summer+2010+Survey
>
> Thought it would be interesting to have a state of scala summer survey as
> well so I made a google form:
> http://spreadsheets.google.com/viewform?hl=en&formkey=dEtVclNLLUxuQzUtVXhSZDRfNWRFZlE6MQ#gid=0
>
> public view of the data:
> http://spreadsheets.google.com/ccc?key=0AoQaKTzyxVl_dEtVclNLLUxuQzUtVXhSZDRfNWRFZlE&hl=en
>
> *disregard this if there already has been a scala survey recently.
>
>
> --
> @tommychheng
> Programmer and UC Irvine Graduate Student
> Find a great grad school based on research interests:
> http://gradschoolnow.com
>
>



--
Kevin Wright

mail/google talk: kev [dot] lee [dot] wright [at] gmail [dot] com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com
skype: kev.lee.wright
twitter: @thecoda

Lex
Joined: 2010-02-28,
User offline. Last seen 42 years 45 weeks ago.
Re: type not inferred - but why?

I have jumped to the wrong conclusion after seeing all the compiler
magic to wrestle with java-scala interoperability. Thanks for pointing
it out.

On Tue, Jun 8, 2010 at 7:42 PM, Paul Phillips wrote:
> On Tue, Jun 08, 2010 at 05:55:25PM -0400, Lex wrote:
>> So classOf[T] is a majic method, treated specially by the compiler.
>> Because of the special treatment the normal type inference does not
>> get applied. This is specific to a compiler implementation and may be
>> changed, however this looks like a low priority feature.
>
> Supposing one wanted to test out one's theories before assuredly
> explaining the mechanism to the rest of the world, here is the sort of
> test one might apply:
>
> scala> def f[T](c: Class[T], f: T => Boolean): Iterable[T] = null
> f: [T](c: Class[T],f: (T) => Boolean)Iterable[T]
>
> scala> def f2[T](c: Class[T])(f: T => Boolean): Iterable[T] = null
> f2: [T](c: Class[T])(f: (T) => Boolean)Iterable[T]
>
> scala> f(classOf[String], _ => true)
> :7: error: missing parameter type
>       f(classOf[String], _ => true)
>                          ^
>
> scala> f2(classOf[String])(_ => true)
> res1: Iterable[String] = null
>
> scala> def g[T](xs: List[T], f: T => Boolean): Iterable[T] = null
> g: [T](xs: List[T],f: (T) => Boolean)Iterable[T]
>
> scala> def g2[T](xs: List[T])(f: T => Boolean): Iterable[T] = null
> g2: [T](xs: List[T])(f: (T) => Boolean)Iterable[T]
>
> scala> g(1 :: Nil, _ => true)
> :7: error: missing parameter type
>       g(1 :: Nil, _ => true)
>                   ^
>
> scala> g2(1 :: Nil)(_ => true)
> res3: Iterable[Int] = null
>
> --
> Paul Phillips      | Atheists dig the best foxholes.
> Apatheist          |
> Empiricist         |
> up hill, pi pals!  |----------* http://www.improving.org/paulp/ *----------
>

Tommy Chheng
Joined: 2010-03-06,
User offline. Last seen 1 year 23 weeks ago.
Re: state of scala summer 2010
No problem, just widened the columns.


On Wed, Jun 9, 2010 at 8:54 AM, Kevin Wright <kev [dot] lee [dot] wright [at] gmail [dot] com> wrote:
Any chance of widening column F?
it's making for some very jerky scrolling when each row is taller than the browser window


2010/6/9 Maxime Lévesque <maxime [dot] levesque [at] gmail [dot] com>
I found this response in the survey totally hilarious :

 *  "I worry that Clojure is becoming too popular too fast and is in
imminent danger of being 'enterprised,' so to speak, by people whose
gifts are limited to the gift of gab and the gift of garb."

It's funny how the term "enterprise" went from a marketing buzzword
giving credibility, to a synonym of over engineered bloatware.

It sums up remarkably well what happened to Java : it got "enterprised" ! ;-)

Lets hope Scala doesn't get "enterprised", so far I really don't see
it happening...


On Tue, Jun 8, 2010 at 12:45 PM, Tommy Chheng <tommy [dot] chheng [at] gmail [dot] com> wrote:
>  I just noticed a State of Clojure Survey at
> http://muckandbrass.com/web/display/~cemerick/2010/06/07/Results+from+the+State+of+Clojure,+Summer+2010+Survey
>
> Thought it would be interesting to have a state of scala summer survey as
> well so I made a google form:
> http://spreadsheets.google.com/viewform?hl=en&formkey=dEtVclNLLUxuQzUtVXhSZDRfNWRFZlE6MQ#gid=0
>
> public view of the data:
> http://spreadsheets.google.com/ccc?key=0AoQaKTzyxVl_dEtVclNLLUxuQzUtVXhSZDRfNWRFZlE&hl=en
>
> *disregard this if there already has been a scala survey recently.
>
>
> --
> @tommychheng
> Programmer and UC Irvine Graduate Student
> Find a great grad school based on research interests:
> http://gradschoolnow.com
>
>



--
Kevin Wright

mail/google talk: kev [dot] lee [dot] wright [at] gmail [dot] com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com
skype: kev.lee.wright
twitter: @thecoda


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland