tag:blogger.com,1999:blog-7045524330253482541.post2742586533939201256..comments2024-01-04T22:19:45.990-08:00Comments on Jim McBeath: You Should Learn ScalaJim McBeathhttp://www.blogger.com/profile/10541190774989580614noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-7045524330253482541.post-56938748300250876802011-09-03T09:17:21.004-07:002011-09-03T09:17:21.004-07:00amethod: I wanted to focus on comparing Java to Sc...amethod: I wanted to focus on comparing Java to Scala rather than comparing Scala to other JVM languages. As I state in my post, "Scala allows you to gradually learn functional techniques while still being able to use familiar object-oriented techniques." I think moving from Java to Scala is enough of a jump for most Java programmers; convincing those programmers to jump straight to Clojure would be a more difficult task, which I will leave to someone else.Jim McBeathhttps://www.blogger.com/profile/10541190774989580614noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-83483023247318265022011-08-18T20:27:23.596-07:002011-08-18T20:27:23.596-07:00If going to functional programming while maintaini...If going to functional programming while maintaining Java functionality and compatibility was really the ultimate goal, wouldn't Clojure be a better option?amethodhttps://www.blogger.com/profile/04461492943244768700noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-55470437184137733512010-12-23T13:24:58.709-08:002010-12-23T13:24:58.709-08:00thanks for the many posts, Jim. I was curious abou...thanks for the many posts, Jim. I was curious about that Dewar Schonberg article linked from your post that results in a 404. <br /><br />i tracked it down to here: http://www.crosstalkonline.org/storage/issue-archives/2008/200801/200801-Dewar.pdfmatiashttps://www.blogger.com/profile/03025931747390992632noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-63023144299441774682010-11-14T20:22:54.529-08:002010-11-14T20:22:54.529-08:00Satya: Take a look at the links in the list of bul...Satya: Take a look at the links in the list of bullets at the end of my post, in particular the second bullet.Jim McBeathhttps://www.blogger.com/profile/10541190774989580614noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-13486539423003621242010-11-10T02:58:41.691-08:002010-11-10T02:58:41.691-08:00I was looking for a Scala quick start tutorial. Do...I was looking for a Scala quick start tutorial. Do you know one?<br />ThanksSatyahttps://www.blogger.com/profile/12968338289991194501noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-68665895841161852802009-01-26T09:11:00.000-08:002009-01-26T09:11:00.000-08:00Thanks for the articles JimThanks for the articles JimEelco Hilleniushttps://www.blogger.com/profile/18171935814979500631noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-20688677421637267222009-01-18T19:01:00.000-08:002009-01-18T19:01:00.000-08:00Doug: An ironic typo. If I had been writing real ...Doug: An ironic typo. If I had been writing real Scala code using a syntax-coloring editor, I expect I would not have made that mistake. I have updated the article to fix that error.<BR/><BR/>If we had to get rid of one of val or var, I would rather keep val the simple one and make var more verbose. But I don't think that's necessary. The difference between + and - or * and / is also a single character, but I doubt many people would argue that one of them should be dropped or changed for that reason.<BR/><BR/>dr: You're welcome, thanks for your encouragement.Jim McBeathhttps://www.blogger.com/profile/10541190774989580614noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-61260304195588922452009-01-18T16:31:00.000-08:002009-01-18T16:31:00.000-08:00@Doug,You are free to drop var from your programmi...@Doug,<BR/><BR/>You are free to drop var from your programming and borrow a page from ML with a Ref[T] class for mutable variables.<BR/><BR/>scala> final case class Ref[T](var value : T) {<BR/> | def ! = value <BR/> | def set(x : T) = value = x <BR/> | } <BR/>defined class Ref<BR/><BR/>scala> val x = Ref(3)<BR/>x: Ref[Int] = Ref(3)<BR/><BR/>scala> x!<BR/>res3: Int = 3<BR/><BR/>scala> x set 4<BR/><BR/>scala> x!<BR/>res5: Int = 4<BR/><BR/>Scala tries to strike a narrow balance: on one hand it strives to make it easy to write functional code. On the other it strives to make be a comfortable language for imperative programmers, especially those from a Java background. The val/var distinction meets those goals quite admirably.James Iryhttps://www.blogger.com/profile/02835376424060382389noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-48302530200456690422009-01-18T15:21:00.000-08:002009-01-18T15:21:00.000-08:00Jim. Thanks for all your hard work promoting Scala...Jim. Thanks for all your hard work promoting Scala. I've found your articles, especially the syntax and operator primers, invaluable.drhttps://www.blogger.com/profile/12025474968494424584noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-4912772705725843882009-01-18T14:35:00.000-08:002009-01-18T14:35:00.000-08:00"A var in Scala is like a final variable in Java: ..."A var in Scala is like a final variable in Java: once a value has been set, it can not be changed"<BR/><BR/>You mean val not var<BR/><BR/>"it is just as easy to type val as var"<BR/><BR/>which is exactly why one of the two should be dropped from scala, or changed to something more distinct.<BR/><BR/>Probably the simplest solution would be to just add 'final' again, or else use combine it with a non-null ! symbol: <BR/><BR/>MyClass! m = ...<BR/><BR/>or else make immutable/non-nullable the default and have a symbol for the reverse:<BR/><BR/>def mymethod( param1 : MyClass?)Doug Holtonhttps://www.blogger.com/profile/02740763550543657462noreply@blogger.com