If the purpose is only aliasing, rather than adding additional methods and
avoiding runtime allocation, what about type aliases?

type ID = String
type Name = String


On Sat, Apr 19, 2014 at 9:26 PM, kamatsuoka <ken...@gmail.com> wrote:

> No, you can wrap other types in value classes as well.  You can try it in
> the REPL:
>
> scala> case class ID(val id: String) extends AnyVal
> defined class ID
> scala> val i = ID("foo")
> i: ID = ID(foo)
>
>
> On Fri, Apr 18, 2014 at 4:14 PM, Koert Kuipers [via Apache Spark User
> List] <[hidden email] 
> <http://user/SendEmail.jtp?type=node&node=4494&i=0>>wrote:
>
>> isn't valueclasses for primitives (AnyVal) only? that doesn't apply to
>> string, which is an object (AnyRef)
>>
>>
>> On Fri, Apr 18, 2014 at 2:51 PM, kamatsuoka <[hidden 
>> email]<http://user/SendEmail.jtp?type=node&node=4475&i=0>
>> > wrote:
>>
>>> I'm wondering if anyone has tried using value classes in RDDs?  My use
>>> case
>>> is that I have a number of RDDs containing strings, e.g.
>>>
>>> val r1: RDD[(String, (String, Int)] = ...
>>> val r2: RDD[(String, (String, Int)] = ...
>>>
>>> and it might be clearer if I wrote
>>>
>>> case class ID(val id: String) extends AnyVal
>>> case class Name(val id: String) extends AnyVal
>>> val r1: RDD[(ID, (Name, Int)] = ...
>>> val r2: RDD[(Name, (ID, Int)] = ...
>>>
>>> This seems like a pretty typical use case for value classes, but I
>>> haven't
>>> noticed anyone talking about it.  Although, I think you'd have to read
>>> through all of the Spark code paths to know whether allocation is
>>> required
>>> (http://docs.scala-lang.org/overviews/core/value-classes.html), so some
>>> comparative performance testing would be called for.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://apache-spark-user-list.1001560.n3.nabble.com/Anyone-using-value-classes-in-RDDs-tp4464.html
>>> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://apache-spark-user-list.1001560.n3.nabble.com/Anyone-using-value-classes-in-RDDs-tp4464p4475.html
>>  To unsubscribe from Anyone using value classes in RDDs?, click here.
>> NAML<http://apache-spark-user-list.1001560.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
> Kenji
>
> ------------------------------
> View this message in context: Re: Anyone using value classes in 
> RDDs?<http://apache-spark-user-list.1001560.n3.nabble.com/Anyone-using-value-classes-in-RDDs-tp4464p4494.html>
> Sent from the Apache Spark User List mailing list 
> archive<http://apache-spark-user-list.1001560.n3.nabble.com/>at Nabble.com.
>



-- 

SUREN HIRAMAN, VP TECHNOLOGY
Velos
Accelerating Machine Learning

440 NINTH AVENUE, 11TH FLOOR
NEW YORK, NY 10001
O: (917) 525-2466 ext. 105
F: 646.349.4063
E: suren.hiraman@v <suren.hira...@sociocast.com>elos.io
W: www.velos.io

Reply via email to