Som Snytt | 17 May 2013 00:42
Picon

Proposal for dollar semantics


When you are new to a city, it helps the budget-conscious traveler to pick up a Zagat guide and figure out where to find a meal.

It might help the performance-minded newcomer to Scala if the compiler adopted the following conventions:

$    - cheap accommodation of nested entities
$$   - still reasonable artifact that won't bust your budget
$$$  - rather pricey computation, time- or space-wise
$$$$ - you must be wearing a tie to invoke this function

For example, I might invoke Partner$available$$$$diningOption$anon$1 if I thought you might be the one, or maybe if I was just looking for something anon.


--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Som Snytt | 12 May 2013 05:23
Picon

How much time does paulp have left?


> I die a little inside every time I see a new pile of index-oriented imperative
> string parsing code on its way into trunk.

For the record, I would wear this t-shirt every day (except for laundry days), just to keep myself honest.

Also, scala-lang.org could display a counter in the corner with the "paulp clock".

It would have to tie in with the jenkins PR validator, of course.


--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Som Snytt | 12 May 2013 05:08
Picon

Love and care of artifacts


Twitter sends me emails, like this one:

Carl Byström <at> cgbystrom

If only developers wrote commit messages with same love and care as code.

This may be obvious to everyone, but s/code/paulp/.

paulp commits make archaeology fun again.

I thought maybe Carl was part of the Scala ecosystem on the Akka side (because of the two dots), so I consulted his blog.

He riffs on David Pollak's view that Scala is a measure of something, like taking calculus.  He adds that this is so important to the Scala ethos that the spec should say, "Scala differentiates good programmers from the rest."  And in an appendix, "Since you have read this far, you are either a good programmer or a good reader."

I made up that last bit.

I honestly believe that everyone, no matter what sins they have committed in the past, deserve to benefit from Scala.

Full disclosure:  When DPP said "Zed Shaw," I went, "Like Scala Zed?"

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
arkantos | 4 May 2013 01:27
Picon

propositions for scala that could increase reliability and controllability

There are a few things I always missed in java:
1) design by contract (pre- and post condition, invariant ...)
2) class scoping like in eiffel:
   wouldn't it be handy to hide functions from other objects except from those we gave the permission to access
 
   ex: {A,B} class C extends D ...
      -> only A, B and C itselve may access the methods of C

  thus we could use a strict variation of the fascade pattern or do any other helpful things. It shouldn't be overused of course but we gain much more control of who  uses our classes.

This expansions wouldn't affect old code i guess, because there's no need to change anything about the scopes used so far (private, ...)

Moreover we could find many bugs at compile time. Debugging and Testing might get much easier.

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Rex Kerr | 30 Apr 2013 00:58
Picon
Gravatar

How can we teach the utility of Try?

I've noticed repeatedly on StackOverflow (and also scala-users) that even some of the most sophisticated members of the Scala community write suboptimal-clarity Try code.

When I use Try, I make heavy use of two patterns:

(1) Assume the best, prepare for the worst.

  val x = Try { ... }
  val y = Try { ... }
  val z = Try { ...; f(x.get, y.get); ... }

(This is/should be the answer to pretty much every question of the form "I have Try inside and I want it outside".)

(2) Exceptions are classes, too.

  case class Net(fish: String) extends Exception
  Try { ...; throw Net("salmon"); ... } match {
     case Failure(Net(fish)) => println("Oh, it's just a "+fish)
     case Failure(t) => ...
     case Success(s) => ...
  }

(This is/should be the answer to pretty much every question of the form "Sometimes I need to return some data along with a failure.")

I'm sure there are more.  But it seems--am I wrong?--that these sorts of patterns are not really occurring naturally to people.

Why not, and what can we do about it (or is there something wrong with these patterns?--yes, I know it's a pretty heavyweight fishing operation there)?

  --Rex

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Rich Oliver | 26 Apr 2013 16:20
Picon

Is the writing on the wall for client side JVM?

The recent delay for Java 8 seems to have been almost completely unnoticed within the Scala community. It has been delayed in order to focus on security. The JVM is widely seen as a security nightmare. Could its days be numbered on the bulk of client side OSs. The JVM on the Server is going strong. So I wonder how much of the Scala community really cares about this? It seems that the bulk of commercial Scala is server side.

The very low priority that the Scala team put on GUI seems to confirm a lack of concern for client side Scala. I'm not saying this is wrong. The Scala team have limited resources. They must choose their priorities, but it would be nice to have a clearer statement of those priorities. If Scala is to have a long term client side future then it may need a different target. Mono, LLVM, full compilation are all possibilities but would all require large investments of resources.

No one would deny the client world is changing at a great pace. Scala has always had limits on the client side notably game consoles. Now we have phones and tablets with smart watches just coming on line. Is Microsoft's long dominance on the desktop finally beginning to crack. The desktop market is shrinking. Most people don't need a desktop / laptop for their personal life. The desktop user base will be much more dominated by business and developers. Could Linux finally get a real look in on the desktop. Maybe that's just wishful thinking, but if correct, given Linux's domination of the Server market, it could make a linux compile target more attractive or even a linux-LLVM target. Alternatively one could attack from the top so to speak by forking openjdk. I was shocked to find out recently that Facebook is built on LAMP. Surely we can do better? Of course Typesafe does to some extent already provide an alternative, but surely Scala could go much deeper down the stack.

Anyway I'm not claiming my statements are all 100% accurate. I wanted to put out some ideas for debate on the big picture in which Scala will be living.

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Robert Kohlenberger | 24 Apr 2013 05:11

Proposal: DSL for math expressions

Proposed DSL for math expressions


Background


In Scala, numbers are objects, and infix expressions like "1 + 2", are compiled to "1.+(2)".  This has benefits and drawbacks.  The core language is simplified greatly by removing math operators to number objects.  On the other hand, an expression like "f + g", with expensive functions f and g, must first evaluate f to a number object, then pass the result of evaluating g to the + operator.  This serial evaluation is enforced even if f and g are independent and could be evaluated concurrently with no change in the result.  Furthermore, the concrete types f and g must be known to the compiler where + is used in the code, since there is no abstract super-type of numbers with the + operator.


As a partial fix to that concrete type requirement, Scala supplies trait Numeric.  If all you need is +, -, or * operators, then importing Numeric.Implicits._ makes implicit conversions available when calling methods with Numeric parameters, like "def doubleIt[A: Numeric](x: A) = x + x".


An alternative to Scala's Numeric trait is Azavea's Numeric trait, found here: "https://github.com/azavea/numeric".  Azavea's version has better performance due to more extensive use of specialization.  Another alternative is my NumVal trait found here: "https://github.com/kabob/NumVal".  NumVal acts implicitly like a super-type of all numeric types, and supplies all common math operations, including transcendentals.  It also permits a simpler version of the above method: "def doubleIt(x:NumVal) = x + x".  However NumVal suffers poor performance due to: implicit conversions, lack of specialization, and lack of parallelization.


Recently I looked into using functional operations on primitive collections, including Array, to speed up math operations on large collections (see https://groups.google.com/forum/#!topic/scala-debate/eTwCGNgPtYs).  Unfortunately I rediscovered what others already knew, that functional methods on primitive arrays are much slower than imperative (while loop) code, due to auto boxing and unboxing required by the generic collection implementations.


Solution?


So, despite the promise of FP as a way to write fast parallel code that's safe and scalable for future many-core hardware, Scala's FP implementation has some opportunities for improvement.  My intent is not to find fault, but to take a fresh look at the issues, and see if they can be solved in one fell swoop!


After a hint by Rex Kerr on avoiding un/boxing by using a "scratch space", I was reminded of Java NIO and primitive type buffers.  This is not exactly the same idea, but inspired by Rex (there's been a lot of interest in this idea of late!).  During expression evaluation, intermediate values of any type can be stored in a spot reserved for that part of the calculation.  Using primitive (long) buffers allows each sub-expression to evaluate to a different type on each re-evaluation, if needed.  After some feasibility tests, I'm convinced that fast parallel evaluation of mixed-type math expressions is possible, without boxing and without the bloat and compile-time overhead of serialization.  But for now I'd like to focus less on implementation and more on requirements.


Description


These are capabilities I would like to see when writing math expressions in Scala:


1. Math expressions can include common numeric operations, e.g.: conversions, comparisons, arithmetic, and transcendental functions.

2. Each operation supports all 10 "built-in" number types (numeric type abstraction).  This includes 6 primitives and 2 Bigs.

3. Preserve precision on mixed (binary) operations.

4. In an expression, anywhere a single value is valid, a numeric Array is also valid (cardinality abstraction).

5. Exploit parallelism where possible (assume operations have no side effects).

6. Accommodate user-supplied operations.

7. Debugging aides, TBD (or just rely on logging intermediate results?)


If all this looks like a tall order, NumVal already implements 1-3, and I have code that partially implements 4 and 5.


Questions


1. Is anyone else working on this? (I hate to reinvent the wheel!)

2. Which approach is better: DSL or compiler plugin?

3. If implemented as described, would you find it useful?

4. Any interest in sponsoring this project (for release as open source)?

5. In a first release would you require other numeric types, like Complex and Rational?


Thanks!
kabob

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Scala Mailing Lists | 21 Apr 2013 15:32
Picon
Picon
Favicon

Mailing list reminder: Scala-debate

Welcome to the "Scala-debate" mailing list.

This automatic reminder is sent once a month to the list,
to keep subscribers up-to-date with the mailing list services,
and to help keeping the list on topic.

-------------------------------------------------------------------

The "Scala-debate" mailing list:

This list is a more relaxed forum for Scala discussions
that would probably be off-topic or too convoluted for
the other lists, but that may still be quite interesting
to follow for a selected readership.

In particular, the following are appropriate:

  * threads that evolved beyond their initial topic,
      and have become too long or convoluted to be
      of interest to most readers
  * threads discussing extremely specialized topics
  * threads that are mostly speculative in nature,
      out-of-the-box thinking, philosophical views
      (as long as they are still somehow related
      to Scala)
  * debates (of course)

The "Scala-debate" list is the natural destination of all
the threads that start on other mailing lists, but are no
longer on topic on their original list, or have turned
into an in-depth debate about something.

-------------------------------------------------------------------

Other information:

There are several Scala lists devoted to individual topics (and
more may be created in the future). For the full list, please
see: http://www.scala-lang.org/node/199

Try to avoid cross-posting whenever possible. If you can, select
the list that is closer to your topic and post in that list only.
In any case, never cross-post replies.

If you ever want to unsubscribe from this list, just visit this
page: http://groups.google.com/group/scala-debate/subscribe
or send an email to scala-debate+unsubscribe <at> googlegroups.com

Thank you!
The Scala Team

--

-- 
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Anjaiah Yamagani | 19 Apr 2013 23:35
Picon

Code Coverage for Scala

Hi,

I'd like to see the code quality of the scala language.

earlier I have used the sonar, cobutura for JAVA language for the code coverage.

could you please tell me, what is the suitable tool for code coverage for scala?


Regards,
Srinivas

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
jarek | 19 Apr 2013 00:43
Picon

Is having implicit scala.math.Ordering.Unit a good idea?

Hi,


I was bitten by the following bug (in my code):

val myCollection = ...
val sortedByScore = myCollection.sortBy {
  x =>
    val score = ...
// score 
}

As you can see last statement in the block i assignment, so the type of the block is Unit. Because there exists implicit Ordering[Unit], there was no compile time error. Obviously my intention was to sort collection by score. 

I was wondering if is there any practical use of implicit Ordering[Unit]? If not, I would suggest removing it or hiding it to avoid similar problems...

Regards
Jarek

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Mrityunjay Kant | 16 Apr 2013 11:40
Picon

Future of (A*) => B types

Hi,

I'm trying to get a bug fixed in IntelliJ Idea Code highlighter related to (A*) => B types, http://youtrack.jetbrains.com/issue/SCL-5557

However, the developer has countered that the future of these types is not certain. Could someone comment if these will be supported in long term by Scala compiler or there is something else developer should switch to? Any clarity on the long term support for this syntactic sugar will be very helpful.

~Mrityunjay

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gmane