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

Why are uniqueness annotations added behind their target

1 reply
hseeberger
Joined: 2008-12-27,
User offline. Last seen 1 year 25 weeks ago.
Hi,
Looking at the uniqueness plugin I wonder why the @unique and @peer annotations are added behind the val / parameter. Why not in front? Like this:
@unique val logList: LogList = new LogList

@transient def add(@peer(this) file: LogFile) = ...


Thanks,
Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Akka - Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Actors: akkasource.org
Johannes Rudolph 2
Joined: 2010-02-12,
User offline. Last seen 42 years 45 weeks ago.
Re: Why are uniqueness annotations added behind their target

Syntactically, I guess because the types are annotated and not the
statements/definitions. AFAIK the uniqueness plugin extends the type
system so this basically makes sense for me.

But I guess you are getting at the readability of code written like that.

Johannes

On Thu, Dec 9, 2010 at 9:54 AM, Heiko Seeberger
wrote:
> Hi,
> Looking at the uniqueness plugin I wonder why the @unique and @peer
> annotations are added behind the val / parameter. Why not in front? Like
> this:
> @unique val logList: LogList = new LogList
>
> @transient def add(@peer(this) file: LogFile) = ...
>
> Thanks,
> Heiko
>
> Company: weiglewilczek.com
> Blog: heikoseeberger.name
> Follow me: twitter.com/hseeberger
> OSGi on Scala: scalamodules.org
> Lift, the simply functional web framework: liftweb.net
> Akka - Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through
> Actors: akkasource.org
>

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