|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Two actors-related questions
by Peter Reiner Fels
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Hi.
I read the "Actors That Unify Threads and Events" paper and got two questions: 1) The paper says, that pattern matching expressions are partial functions. When I look at the definition of PartialFunction, there should be an isDefinedAt(x : a) and an apply(x : a) method. Two me a pattern matching expression does not look like a PartialFunction. Does the Scala compiler know, that the first can be converted to the second? 2) The papers also contains this code block: loop { receive { case 'next => receive { case x: Option[_] => reply(x) } }} Does the 'next message have any special meaning? What does it mean when a message starts with the ' character? Regards, Peter |
|
|
Re: Two actors-related questions
by bearfeeder
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Peter,
On 1/7/08, Peter Reiner Fels <prfels@...> wrote: Hi. All {case ... => ... case ... => ...} are converted to partial functions by the compiler. 2) The papers also contains this code block: 'next is a Symbol (an interned string) Thanks, David Regards, -- lift, the secure, simple, powerful web framework http://liftweb.net Collaborative Task Management http://much4.us |
|
|
Re: Two actors-related questions
by Erik Engbrecht
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Peter,
Consider the following:
symbol match {
case 'start => startDoingSomething()
case 'stop => stopDoingSomething()
}
The above match statement is defined for the symbols 'start and 'stop, but not for any other objects.
As for the symbols, thy are just that - symbols.
Symbols are pretty common in Lisp, (I think) Ruby, and probably other languages that use functional concepts.
-Erik
On 1/7/08, Peter Reiner Fels <prfels@...> wrote:
Hi. -- http://erikengbrecht.blogspot.com/ |
|
|
|
|
|
Re: Two actors-related questions
by steve.bendiola
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message it is in section 1.3.7 of the Language spec
http://www.scala-lang.org/docu/files/ScalaReference.pdf also in the scaladoc http://www.scala-lang.org/docu/files/api/scala/Symbol.html I was surprised it wasn't in PINS On Jan 7, 2008 2:26 PM, Patrick Wright <pdoubleya@...> wrote: > > > Does the 'next message have any special meaning? What does it mean when a > > message > > > starts with the ' character? > > > > > > 'next is a Symbol (an interned string) > > Does anyone know where I can find documentation about how to use > symbols in Scala? I can't find any reference to it in the PinS book, > but have come across it in some code samples and have been wondering. > > > Thanks > Patrick > |
|
|
Re: Two actors-related questions
by Fred Janon
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message First time I hear about "Symbol"s as well.
What would be the use of "Symbol"s then? Use then like string constants without having to create a class and declare static fields for them? Thanks Fred On Jan 8, 2008 5:49 AM, Steve Bendiola <steve.bendiola@...> wrote: it is in section 1.3.7 of the Language spec |
|
|
Re: Two actors-related questions
by Viktor Klang
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message On 1/8/08, Fred Janon <fjanon@...> wrote:
First time I hear about "Symbol"s as well. Signals for Actors is the first thing that strikes me...
santa !? 'Hohoho
Cheers, -V
Thanks -- _____________________________________ / \ /lift/ committer ( www.liftweb.net) SGS member (Scala Group Sweden) SEJUG member (Swedish Java User Group) \_____________________________________/ |
| Free embeddable forum powered by Nabble | Forum Help |