Paul Phillips | 1 Apr 01:18 2009

Re: _ vs. Any

On Tue, Mar 31, 2009 at 03:55:50PM -0700, Manohar Jonnalagedda wrote:
> What I want is to be able to run each function on a separate actor 
> (that is why I am first storing them separately).

Sorry, what I was getting at was that you shouldn't have to abandon the 
type relationships, which is what you're doing by whipping out Any.  You 
might want to look at Channel to see typed messages between actors.

--

-- 
Paul Phillips      | Christ died for our sins.  Dare we make his martyrdom
Protagonist        | meaningless by not committing them?
Empiricist         |     -- Jules Feiffer
i pull his palp!   |----------* http://www.improving.org/paulp/ *----------

Barry Kaplan | 1 Apr 04:34 2009

method $tag overrides nothing ??


I'm getting the compilation error "method $tag overrides nothing" at lines 2
and 3 for the case objects with the following:

    abstract class Currency(val name: String) 
    case object USCurrency extends Currency("US")
    case object CanadianCurrency extends Currency("Canadian")

If I make the class Currency a case class, then I get the error only on line
1 for the class.

What does this message mean? If I recall, $tag, defined on ScalaObject, is
there to help with pattern matching. 

-barry
--

-- 
View this message in context: http://www.nabble.com/method-%24tag-overrides-nothing----tp22818753p22818753.html
Sent from the Scala - User mailing list archive at Nabble.com.

Josh Suereth | 1 Apr 04:40 2009
Picon

Re: method $tag overrides nothing ??

Make sure you clean your build.

What version of scala are you using?

On Tue, Mar 31, 2009 at 10:34 PM, Barry Kaplan <groups1 <at> memelet.com> wrote:

I'm getting the compilation error "method $tag overrides nothing" at lines 2
and 3 for the case objects with the following:

   abstract class Currency(val name: String)
   case object USCurrency extends Currency("US")
   case object CanadianCurrency extends Currency("Canadian")

If I make the class Currency a case class, then I get the error only on line
1 for the class.

What does this message mean? If I recall, $tag, defined on ScalaObject, is
there to help with pattern matching.

-barry
--
View this message in context: http://www.nabble.com/method-%24tag-overrides-nothing----tp22818753p22818753.html
Sent from the Scala - User mailing list archive at Nabble.com.


Barry Kaplan | 1 Apr 04:45 2009

Re: method $tag overrides nothing ??


I still the get the error with full rebuilds. I'm using 2.7.3.final
--

-- 
View this message in context: http://www.nabble.com/method-%24tag-overrides-nothing----tp22818753p22818848.html
Sent from the Scala - User mailing list archive at Nabble.com.

Paul Phillips | 1 Apr 04:50 2009

Re: method $tag overrides nothing ??

On Tue, Mar 31, 2009 at 07:45:43PM -0700, Barry Kaplan wrote:
> I still the get the error with full rebuilds. I'm using 2.7.3.final

I do not think you are -- it is likely you are somehow using a mix of 
2.7.3 and something more recent.  The code you supplied works fine on 
either 2.7.3 or trunk individually, but since $tag was ditched a few 
weeks ago, a mix will cause you problems.  (A mix will almost always 
cause you problems, but this would be one of the most visible.)

--

-- 
Paul Phillips      | Every normal man must be tempted at times
Analgesic          | to spit on his hands, hoist the black flag,
Empiricist         | and begin to slit throats.
all hip pupils!    |     -- H. L. Mencken

Barry Kaplan | 1 Apr 04:53 2009

Re: method $tag overrides nothing ??


Yes, you are correct. I had a 2.8 library in my path. All is well now. Thanks
very much!
--

-- 
View this message in context: http://www.nabble.com/method-%24tag-overrides-nothing----tp22818753p22818914.html
Sent from the Scala - User mailing list archive at Nabble.com.

Florian Hars | 1 Apr 08:27 2009
Picon

Re: functional abstract class managing data

Martin S. Weber schrieb:
> Oh? So this problem has been proven unsolvable?

In general, yes. But there are many interesting 
not-quite-as-general cases where something is possible, and the challenge
is to push the boundaries as far as possible without losing decidability
or human readable error messages. This is, as they say, an open research
problem.

Basic Hindley-Milner type inference for something like core ML is almost
trivial, IIRC there is an implementation in Scala by Examples. But if you want
to have for example Generalized Algebraic Datatypes, type inference becomes
undecidable.

GADTs are the feature that makes the following code compile without a
pattern match warning in scala: 

--------------->
def foo(x: Option[Int]) =
  x match {
    case s <at> Some(_) =>
      s match {
        case Some(1) => 1
        case Some(_) => 2
        /* Look, no warning for missing case None! */
      }
    case None => 0
  }
<---------------

while the equivalent code in ocaml, which has type inference but no
GADTs, gives an incorrect warning:

--------------->
let foo x =
  match x with
  | Some(_) as s -> (
      match s with
      | Some(1) -> 1
      | Some(_) -> 2
    )
  | None -> 0

Warning P: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
None
  ....................(
        match s with
        | Some(1) -> 1
        | Some(_) -> 2
      )
<---------------

People are trying to push the envelope here, see for example all the
Haskell luminaries Microsoft has gobbled up:
http://research.microsoft.com/apps/pubs/default.aspx?id=79812

Ocaml can infer object types <http://caml.inria.fr/about/papers.en.html#object> too,
but again there are limits: you must use type annotations if you use features like
named and optional arguments (and type errors can easily print a few hundred lines).
I'd guess you will run into similar problems if your language supports java-style
method overriding (it is usually a safe bet to assume that adding anything
non-trivial to an extension of Hindley-Milner will make the whole thing undecidable).

- Florian.

Eric Willigers | 1 Apr 08:29 2009
Picon

Re: _ vs. Any

Paul Phillips wrote:
> On Tue, Mar 31, 2009 at 03:55:50PM -0700, Manohar Jonnalagedda wrote:
>> What I want is to be able to run each function on a separate actor 
>> (that is why I am first storing them separately).

Here's an implementation with andThen_: that keeps the typing 
relationships between the actors.

There's no type safety at the beginning of the chain - e.g. head ! 2 - 
or inside the implementation - i.e. t.asInstanceOf[T] - but Paul's 
Channel suggestion addresses that.

import scala.collection.mutable.ListBuffer
import scala.actors.Actor
import scala.actors.Actor.{actor, receive}

trait AndThenActor[-R] extends Actor {

     def andThen_: [T](f: T => R): AndThenActor[T] =
         new ComputingActor[T, R](f, this)
}

case object PrintingActor extends AndThenActor[Any] {

     def act() {
         while(true) {
             receive {
                 case a: Any => println(a)
             }
         }
     }

     start()
}

final class ComputingActor[T, R](f: T => R, tail: AndThenActor[R]) 
extends AndThenActor[T] {

     def act() {
         while(true) {
             receive {
                 case t => tail ! f(t.asInstanceOf[T])
             }
         }
     }

     start()
}

val head =
     { (a : Int) => 2 * a } andThen_:
     { (a : Int) => a * a == 16 } andThen_:
     { (a : Boolean) => if(a) "Hello" else "Bye" } andThen_:
     PrintingActor

head ! 2
head ! 5

Tom Malone | 1 Apr 12:16 2009
Picon

Strange behavior with scala scripts

if i run the following command

scala -e println "HelloWorld"

I end up with this process afterwards

77723 scala.tools.nsc.MainGenericRunner

if this a bug or am i doing something wrong.

This happens if I run scala someScript.scala as well

Thanks

Tom

David Pollak | 1 Apr 17:43 2009
Picon

[Lift] [ANN] DEFUN09: Call for Talks & Tutorials (co-located w/ ICFP09)



---------- Forwarded message ----------
From: Matthew Fluet (ICFP Publicity Chair) <icfp.publicity-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Date: Wed, Apr 1, 2009 at 8:38 AM
Subject: [bayfp] DEFUN09: Call for Talks & Tutorials (co-located w/ ICFP09)
To: Bay Area Functional Programmers <bayfp-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>



                    Call for Talks and Tutorials
    ACM SIGPLAN 2009 Developer Tracks on Functional Programming
                     http://www.defun2009.info/
            Edinburgh, Scotland, September 3 and 5, 2009
      The workshop will be held in conjunction with ICFP 2009
             http://www.cs.nott.ac.uk/~gmh/icfp09.html

Important dates

Proposal Deadline: June 5, 2009, 0:00 UTC
Notification: June 19, 2009

DEFUN 2009 invites functional programmers and researchers who know how
to solve problems with functional progamming to give talks and lead
tutorials at the The ICFP Developer Tracks.

We want to know about your favorite programming techniques, powerful
libraries, and engineering approaches you've used that the world
should know about and apply to other projects. We want to know how to
be productive using functional programming, write better code, and
avoid common pitfalls.

We invite proposals for presentations in the following categories.

Lightning talks
5- to 10-minute talks that introduce exciting and promising research
or techniques that may be in progress or not yet ready for widespread
use, but that offer a glimpse into the near future of real world
functional programming.
Examples:

   * Clustered high performance computing in a functional language
   * Making advanced type systems more accessible to working
programmers
   * How and why we're infiltrating category theory info industry

How-to talks
45-minute "how-to" talks that provide specific information on how to
solve specific problems using functional programming. These talks
focus on concrete examples, but provide useful information for
developers working on different projects or in different contexts.
Examples:

   * "How I use Haskell for oilfield simulations."
   * "How I replaced /sbin/init by a Scheme program."
   * "How I hooked up my home appliances to an Erlang control
system."
   * "How I got an SML program to drive my BMW."

General language tutorials
Half-day general language tutorials for specific functional languages,
given by recognized experts for the respective languages.

Technology tutorials
Half-day tutorials on techniques, technologies, or solving specific
problems in functional programming.
Examples:

   * How to make the best use of specific FP programming techniques
   * How to inject FP into a development team used to more
conventional technologies
   * How to connect FP to existing libraries / frameworks / platforms
   * How to deliver high-performance systems with FP
   * How to deliver high-reliability systems with FP

Remember that your audience will include computing professionals who
are not academics and who may not already be experts on functional
programming.

Presenters of tutorials will receive free registration to CUFP 2009.

Submission guidelines

Submit a proposal of 150 words or less for either a 45-minute talk
with a short Q&A session at the end, or a 300-word-or-less proposal
for a 3-hour tutorial, where you present your material, but also give
participants a chance to practice it on their own laptops.

Some advice:

   * Give it a simple and straightforward title or name; avoid fancy
     titles or puns that would make it harder for attendees to figure
     out what you'll be talking about.
   * Clearly identify the level of the talk: What knowledge should
     people have when they come to the presentation or tutorial?
   * Explain why people will want to attend:
         o Is the language or library useful for a wide range of
           attendees?
         o Is the pitfall you're identifying common enough that a
           wide range of attendees is likely to encounter it?
   * Explain what benefits attendees are expected to take home to
     their own projects.
   * For a tutorial, explain how you want to structure the time, and
     what you expect to have attendees to do on their laptops. List
     what software you'll expect attendees to have installed prior to
     coming.

Submit your proposal in plain text electronically to
defun-2009-submissions-FFPO2NqipHzz1n+OaKNE4w@public.gmane.org by the beginning of Friday, June
5 2009, Universal Coordinated Time.

Organizers

   * Yaron Minsky (Jane Street Capital)
   * Ulf Wiger (Erlang Training and Consulting)
   * Mike Sperber - co-chair (DeinProgramm)
   * Bryan O'Sullivan - co-chair (Linden Lab)






--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb <at> googlegroups.com
To unsubscribe from this group, send email to liftweb+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane