<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Scala on Dr. Random</title><link>https://drrandom.org/tags/scala/</link><description>Recent content in Scala on Dr. Random</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Tue, 24 Jan 2012 06:52:00 +0000</lastBuildDate><atom:link href="https://drrandom.org/tags/scala/index.xml" rel="self" type="application/rss+xml"/><item><title>I think Scala may be a gateway drug</title><link>https://drrandom.org/2012/01/24/i-think-scala-may-be-a-gateway-drug/</link><pubDate>Tue, 24 Jan 2012 06:52:00 +0000</pubDate><guid>https://drrandom.org/2012/01/24/i-think-scala-may-be-a-gateway-drug/</guid><description>&lt;p&gt;As I have been trying to learn more about Scala, there have been several paths that I’ve had to follow.  One is getting acquainted with the state of Java development, since ultimately Scala exists within the Java ecosystem.  Another is finding my way around the Scala libraries, tools, and idioms.  But there is a third that seems to be somewhat deeper, and that is coming to grips with the functional nature of the language.&lt;/p&gt;</description></item><item><title>Making the Climb Part 4–Pattern Matching</title><link>https://drrandom.org/2012/01/22/making-the-climb-part-4-pattern-matching/</link><pubDate>Sun, 22 Jan 2012 20:23:58 +0000</pubDate><guid>https://drrandom.org/2012/01/22/making-the-climb-part-4-pattern-matching/</guid><description>&lt;p&gt;Continuing our journey down the path from the familiar to the down-right bizarre, we find ourselves at Pattern Matching.  This is a feature of the Scala language that shows it’s functional side in a strong way.  Pattern Matching is a fundamental part of functional languages in general, and provides a way to write very concise and expressive code.  On the surface, pattern matching in Scala looks an awful lot like switch statements in C# (and Java for that matter), but you shouldn’t cling too hard to that association.&lt;/p&gt;</description></item><item><title>Making the Climb Part 3 - Generics of a Higher Kind</title><link>https://drrandom.org/2011/10/05/making-the-climb-part-3-generics-of-a-higher-kind/</link><pubDate>Wed, 05 Oct 2011 16:24:00 +0000</pubDate><guid>https://drrandom.org/2011/10/05/making-the-climb-part-3-generics-of-a-higher-kind/</guid><description>&lt;p&gt;This is part 3 in a series.  If you’ve not followed-along so far, you may want to check out &lt;a href="https://drrandom.org/2011/07/31/making-the-climb-chronicling-the-journey-from-c-to-scala/"&gt;Part 1&lt;/a&gt; and &lt;a href="https://drrandom.org/2011/08/14/making-the-climb-part-2-object-oriented-programming-in-scala/"&gt;Part 2&lt;/a&gt; first.&lt;/p&gt;
&lt;p&gt;It’s time to start digging in to some of the crazy-goodness that makes Scala such a glorious and wonderful thing.  First things first, though, we have to talk a little bit about this history of Generics in Java and the JVM. &lt;/p&gt;
&lt;h4 id="type-erasure-and-you"&gt;Type Erasure and you…&lt;/h4&gt;
&lt;p&gt;Back around the time that .Net was adding support for generics, the folks in Java land were doing the same…sort of.  The biggest difference between the way Generics were implemented in .Net and Java is the fact that in .Net generics are supported directly in the CLR (sometimes called reified generics), whereas the JVM did not include direct support for generics.  Ok, so what does that actually &lt;em&gt;mean&lt;/em&gt;?  Well, for starters it means that when you’re dealing with Generics in Java you run into &lt;a href="http://download.oracle.com/javase/tutorial/java/generics/erasure.html"&gt;Type Erasure&lt;/a&gt;.  Type Erasure means that when Java code with generics are compiled, the generic type information is removed at compile time, so while you’re looking at an ArrayList&lt;String&gt; in Java, the JVM sees this as just an ArrayList, and things get cast as needed.  There are a couple of types which get reified into actual types (Arrays are the best example), but for the most part this doesn’t happen.  In contrast in the .Net world a List&lt;string&gt; gets compiled into a List`1&amp;lt;System.String&amp;gt; which is a real type at the IL level.  Now, I’m not going to get into the argument about whether or not type erasure is good or bad, but it is a fundamental difference between the two platforms. &lt;/p&gt;</description></item></channel></rss>