Google ã®ã¦ã§ããã°å ¬éãã¼ã«ã使ã£ã¦ãããã¹ããåçãåç»ãå ±æã§ãã¾ãã
Google ã®ã¦ã§ããã°å ¬éãã¼ã«ã使ã£ã¦ãããã¹ããåçãåç»ãå ±æã§ãã¾ãã
19. "Future" must { import scala.concurrent.ExecutionContext.Implicits.global "map and flatMap" in { val futureMessage = Future { Thread.sleep(1000); 1 }.flatMap(value => Future { Thread.sleep(1000); value + 1 }).map(s => s"This is a value of future after $s seconds") Await.result(futureMessage, 5 seconds) must be("This is a value of future after 2 seconds") } "for comprehension" in { val futureMe
Scalaãã©ããã£ã¦å¦ã¶ã®ãããã®ãï¼ã¨ãããã¨ã¯Scalaã使ãå§ããæ°å¹´åãããã£ã¨èãã¦ãã¾ãããããScalaã¯é£ãããã¨è¨ããã¾ããã ã©ããé£ããã®ãï¼ ãªãé£ããã®ãï¼ ã¨ãããã¨ããããã¾ã§æ¸ç±ãéèªè¨äºããã³ãºãªã³ãªã©å ¥éç¨ã®ã³ã³ãã³ããä½ã£ã¦ããçµé¨ãè¸ã¾ãã¦æ´çãã¦ã¿ã¾ããã ã¾ããScalaãé£ããã¨ããããçç±ã®ã²ã¨ã¤ã«å¦ã°ãªãã¦ã¯ãªããªããã®ãå¤ãããã¨ããç¹ãããããã¾ããScalaã¯ãªãã¸ã§ã¯ãæåè¨èªã§ãããé¢æ°åè¨èªã®ç¹å¾´çãªæ©è½ãåãå ¥ãã¦ããããããã¡ãã¨ç解ããã«ã¯ä¸¡æ¹ã®è¨èªã®ã¤ãã£ãªã ãå¦ã¶å¿ è¦ãããããã§ãã ãã ãScalaèªä½ã¯å¿ ãããé¢æ°åè¨èªã®ç¥èããªãã¦ã使ããããã«è¨è¨ããã¦ãã¾ããæåã¯Better Javaã¨ãã¦ä¸è¬çãªæç¶ãåãªãã¸ã§ã¯ãæåè¨èªã®å»¶é·ã¨ãã¦ä½¿ãå§ãããã¨ãã§ããScalaã®ç¹å¾´çãªæ©è½ã«è§¦ãã¦ãããã¨ã§å°ã
Slick 3.0ããªãªã¼ã¹ãããã®ã§ãGitBucketãSlick 3.0ã«ã¢ãããã¼ãããã¹ããããã試ãã¦ã¿ã¾ããã Slick 3.0ã¯å¥åReactive Slickã¨ããã ããããããã¾ã§ã¨ã¯ããã°ã©ãã³ã°ã¢ãã«ããã©ã¹ãã£ãã¯ã«å¤ãã£ã¦ãã¾ããå ·ä½çã«è¨ãã¨DBIOActionã¨ãããªãã¸ã§ã¯ããä»ãã¦ãã¼ã¿ãã¼ã¹æä½ã®å®ç¾©ã¨å®è¡ãæ確ã«åé¢ããã¦ãã¾ããè¦ããã«Monadicãªããã°ã©ãã³ã°ã¹ã¿ã¤ã«ã«ãªã£ã¦ããã¨ãããã¨ã§ãã ä»ã«ãReactive Streamsã¨ãOptionãµãã¼ãã®å¼·åãªã©Slick 3.0ã®æ°æ©è½ã¯ããããããã¾ãããä¸çªå¤§ããã®ã¯ãã®ç¹ã ã¨æãã¾ãã ã¾ããDBIOActionã®å®è¡ã¯å ¨é¢çã«Futureãã¼ã¹ã«ãªã£ã¦ãã¾ããPlayãªã©ã¨çµã¿åããã¦ä½¿ç¨ããå ´åãSlickã使ã£ãå¦çããã£ã¦ãAsyncResultã§è¿ããã¨ãã§ããããã«
ããã«ã¡ã¯ãã¤ã³ãã©ãã¼ã ã®å®éã§ãï¼ å é±éææ¥ã«BizReachããã®ãªãã£ã¹ã§ãBizReachããã¨ChatWorkã§Scalaåååå¼·ä¼ãéå¬ãã¾ããï¼ BizReachããã¨è¨ãã°ãã§ã«Scalaãå®æ¦æå ¥ããã¦ãããã¨ã§ãæåã§ããã ãããªBizReachãããããããScalaã¸åãçµããã¨ãã¦ããå¼ç¤¾ã¨åå¼·ä¼ãéãã¦ãã ããã¾ããã ä»åã¯BizReachããã«ããããæããå½¢ã¨ãªãã¾ããããChatWorkãä»å¾ã®åãçµã¿ã§å¾ãããScalaã®ãã¦ãã¦ãçºä¿¡ãã¦ããããã¨èãã¦ãã¾ãã ãã£ããåçºè¡¨ãçºè¡¨é ã«ã¾ã¨ãã¦ãç´¹ä»ãã¾ãï¼ ChatWorkã¨Scala (ChatWorkãå®é å太)ChatWorkãã©ããã¦Scalaã«èµãåã£ããã¨ãã話ã¨ãç§ãå é£åã£ã¦Scalaã触ãã¯ãããææ³ãåããã¦ããã ãã¾ããã ãªãScalaãï¼ã½ã¼ã¹ã³ã¼ããã·ã³ãã«ã«ã
Philipp Haller, Aleksandar Prokopec, Heather Miller, Viktor Klang, Roland Kuhn, Vojin Jovanovic è Eugene Yokota 訳 æ¦è¦ Future ã¯ä¸¦åã«å®è¡ãããè¤æ°ã®æ¼ç®ãåãæ±ãã®ã«ä¾¿å©ãªæ¹æ³ãæä¾ãããããã¯å¹ççã§ãã³ããããã³ã°ãªæ¹æ³ã ã 大ã¾ããªèãæ¹ã¯ã·ã³ãã«ãªãã®ã§ãFuture ã¯ã¾ã åå¨ããªãè¨ç®çµæã«å¯¾ãããã¬ã¼ã¹ãã«ãã®ãããªãã®ã ã ä¸è¬çã«ãFuture ã®çµæã¯ä¸¦è¡ã«è¨ç®ããå¾ã§éè¨ãããã¨ãã§ããã ãã®ããã«ä¸¦è¡ãªã¿ã¹ã¯ãåæãããã¨ã§ãããéããéåæã§ããã³ããããã³ã°ãªä¸¦åã³ã¼ãã¨ãªããã¨ãå¤ãã ããã©ã«ãã§ã¯ãFuture ã Promise ããã³ããããã³ã°ã§ãããå ¸åçãªããããã³ã°æ¼ç®ã®ä»£ããã«ã³ã¼ã«ããã¯ã使ãã ã³ã¼ã«ããã¯ã®ä½¿ç¨ã
ãã¾ã¾ã§ããªãã¨ãªãã¯ä½¿ã£ã¦ãã¾ããããScalaã®importæã«ã¤ãã¦èª¬æãã¾ãã Javaã¨åãããimportãã¼ã¯ã¼ãã®ãã¨ã«ãimportãããã¯ã©ã¹åãæå®ããã ãã§ãã ãã ãJavaã«æ¯ã¹ã¦æ§ã ãªæ©è½ã追å ããã¦ãããæè»ãªimportãã§ãã¾ãã "import java.util._"ã¨æ¸ãã¨ãããã±ã¼ã¸ä»¥ä¸ã®å ¨ã¦ã®ã¯ã©ã¹ãimportã§ãã "import java.util.Arrays._"ã¨ãã¯ã©ã¹åã«å¯¾ãã¦"._"ãæå®ããã¨ããã®ã¯ã©ã¹ã®ã¡ã½ãããimportã§ãã(Javaã®static importã«ç¸å½) ããã¾ã§ã¯Javaã¨åãã§ãã importæã¯ãclass宣è¨å ãé¢æ°æ¬ä½ãªã©ãã©ã®ç®æã«æ¸ãã¦ãããã importã¯ãæ¸ãããã¹ã³ã¼ãã§ã®ã¿æå¹ã¨ãªã "import java.io.{File, FileFilter}"ã®ããã«ã{}ã«è¤æ°
æ¬é£è¼ããä»åã§ããããæçµåã¨ãªãã¾ããä»åã¯ããã¹ãã£ã³ã°ãã¬ã¼ã ã¯ã¼ã¯ãã©ã¤ãã©ãªã®ä¸ã§è¿å¹´ãã使ãããããã«ãªã£ã¦ãããã®ãç´¹ä»ãã¦ããã¾ãã æ¬é£è¼ãå§ã¾ã£ã2008å¹´6æã¯ãScalaè¨èªãã®ãã®ã注ç®ããå§ããææã§ãã©ã¤ãã©ãªã¯æªæ´åã§ããããªã¼ãã³ã½ã¼ã¹ã®Scalaã©ã¤ãã©ãªã¯å°ãªããä½ããããã¨æãã¨Javaã®ã©ã¤ãã©ãªãç´æ¥å¼ã³åºãããã©ããã¼ãèªåã§æ¸ãå¿ è¦ãããã¾ããã ç¿»ã£ã¦ç¾å¨ãå®å ¨ã«æçãã¦ããã¨ã¯ãããªããã®ã®ãå¤ãã®å®ç¨Scalaã©ã¤ãã©ãªãç»å ´ãã¦ãã¾ããHTTPã¯ã©ã¤ã¢ã³ããJSONã©ã¤ãã©ãªãO/RããããI/Oãã³ãã³ãã©ã¤ã³ãã¼ã¶ãWebã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯çãããã¤ãåå¨ãã¦ãã¾ãã Scalaã®ä¸»è¦ãªã©ã¤ãã©ãªã¯ãååç´¹ä»ãããã«ããã¼ã«sbtã®ãã«ãå®ç¾©ãã¡ã¤ã«build.sbtã«ãã©ã®ã©ã¤ãã©ãªã®ã©ã®ãã¼ã¸ã§ã³ã«ä¾åãã¦ããã
ããããJsonã *1 ãã㪠case class å®ç¾©ãã¦ããã ã㧠ããæãã«åæã«å¤æããã¾ãã Lift Jsonã®README æ¥æ¬èªè¨³ ã«æ¸ãã¦ãããã§ããããã¾ãç¥ããã¦ãªãã¨ãããããã¾ã§å¤ã使ããã¦ãªãæ°ãããã®ã§æ¹ãã¦æ¸ãã¦ã¿ã¾ãããå é¨çã«ã¯ããã®ããã https://github.com/lift/framework/blob/2.4-release/core/json/src/main/scala/net/liftweb/json/ScalaSig.scala https://github.com/lift/framework/blob/2.4-release/core/json/src/main/scala/net/liftweb/json/Meta.scala ã§ã ScalaSignature ã£ã¦ãããã³ã³ãã¤ã©ãã¢ããã¼ã·ã§ã³ã¨ãã¦ã¤ãã¦ããã¡ã¿æ
æ±è·æ´»åä¸ã¨ããã¾ãããæ´»åå ±åã¨ããããã¯ãæè¡ã®è©±é¡ãå¤ãã§ããã¾ããScalaã大好ããªã®ã§ç¹ã«Scalaã®è©±ãä¸å¿ã«ãªãã¨æãã¾ãã ä»åã¯ååã¾ã§ä½ã£ã¦ããã¹ã¯ãªãããã¾ã¨ãã¦ãDispatchã使ã£ã¦Tumblrã®APIãå©ãã©ã¤ãã©ãªãä½ãããã¨æãã¾ãã ååã¾ã§ã®è¨äºä¸è¦§ Scala(Dispatch)ã§Tumblrã®APIãå©ã(å°æ調ã¹ç·¨) Scala(Dispatch)ã§Tumblrã®APIãå©ã(dispatch-jsonç·¨) Scala(Dispatch)ã§Tumblrã®APIãå©ã(xAuthã§æ稿編) sbt ååã¾ã§ã¯Scalasã¹ã¯ãªããã§ã³ã¼ããæ¸ãã¦ãã¾ããããä»åããã¯sbtãå°å ¥ãã¦ãããããã¨æãã¾ãã Home · harrah/xsbt Wiki sbtã¯AntãMaveãIvyãªã©ã¨åããã«ããã¼ã«ãªãã§ããã以ä¸ã®ç¹å¾´ãããã¾ãã Ma
sbtã¨ããã¨ãç¬ç¹ãªSettingã®ã·ã¹ãã *1ããScalaã§è¨è¿°ããå é¨DSL*2ã°ããã注ç®ãããã¡ã§ãããããã¯ãåå¿è ã«ãããã¥ããã£ãããã¦æ¹å¤ããããã¨ãå¤ãã£ãããéã«sbtã使ãæ £ãã人ã«ã¨ã£ã¦ã¯ã¨ã¦ãå¼·åã§é¢ç½ãä»çµã¿ã§ãã Settingã®ã·ã¹ãã ã«æ³¨ç®ããã¨ãæ±ç¨çã«è²ã ãªè¨èªã®ãã«ãã«ã使ãããã«æãã¾ããäºå®ãsbtã§C++ã®pluginãä½ã£ã¦ãã人ããã¾ãã ããããsbtã¯ããã¾ã§ãScala(ã¨Java)ã®ããã®ãã«ããã¼ã«ãã§ãã ããã¯ãåã«Scalaãããã©ã«ãã§ãµãã¼ããã¦ããã¨ããæå³ã«ã¨ã©ã¾ãããããããçãããæã£ã¦ããããããã£ã¨æ·±ãæå³ã§ãScalaã«ç¹åãããã«ãã®ä»çµã¿ããå é¨ã«åãã£ã¦ãã¾ãã ä»åã¯ããããªãsbtã®å é¨ã¢ã¼ããã¯ãã£ãã®ç´¹ä»ããã¾ãã 以ä¸ãããªãé·ãã§ããèªã¿ç©ã¨ãã¦ã¯é¢ç½ãããããã¾ããããåã«sbtã使
èªåã¯ä»å¹´ã«æ¥åã§Scalaã使ãå§ãã¦æ¬æ ¼çã«ã¯ãããã®ã§ãããå ¥éããæã«æ©ãã«ç¥ã£ã¦ããããã£ãScalaã®Tipsãç´¹ä»ãããã¨æãã¾ãã ããããæ©ãç¥ã£ã¦ããã°ä»å¾ã®è² åµãæ¸ãããããããã¾ãããã ã³ã¼ãè¦ç´ç³» Scalaã«éããã½ã¼ã¹ã³ã¼ãã¯æ¸ãã人ã®çãé常ã«åºãããã®ã§if(){}ã®{}ä½ç½®ãªã©æ¯è¼çã©ãã§ããããã¨ã§ãã¼ã éçºã§ã¯æãã¦ãã¾ããã¨ãããã¾ãã Scalariform ã³ã¼ãã£ã³ã°è¦ç´ãè¨å®ãã¡ã¤ã«ã«æ¸ãè¾¼ãã¨ã³ã³ãã¤ã«ãããã³ã«ãªã¼ããã©ã¼ããããã¦ããã¾ãã å°å ¥ãsbtã®ã©ã¤ãã©ãªã追å ããã ãã§é常ã«ç°¡åãªã®ã§ããããã§ã ä¾åæ§ scalaã®objectã¯ä¾¿å©ã ãã©ããã¹ãã大å¤ã§ã⦠å¼ç¤¾ã®ã¢ããªã±ã¼ã·ã§ã³ã¯slickã®DAOãå ¨é¨objectã§æ§æããã¦ãã¦ãã¸ãã¹ãã¸ãã¯ã°ãã°ãæ¸ãã¦ãã£ãã®ã§ã¢ãã¯ãå·®ãæ¿ãããã¨ãã§ããã«ãã¹ãã®éã«
åæ¥ã£ã½ã主ã«ç°å¢æ§ç¯ãªã©å°å ¥é¨åã«ã¤ãã¦åãä¸ãã¦ããã¾ãã Scalaã«å°ãèå³ã¯ãããã©ã¾ã ãã£ããã¨ãªãï¼ã¨ãã£ãæ¹ã«èªãã§ããã ãããå¬ããã§ãã Scalaã使ããç¶æ ã«ãã¦ã¿ã ã¤ã³ã¹ãã¼ã« ï¼ã¤ã®æ¹æ³ãæãã¦ã¿ã¾ãã çè ã¯ä»¥ä¸ãMac OS X Mavericksã§è©¦ãã¦ãã¾ããç°å¢ã«å¿ãã¦é©å®èªã¿æ¿ãã¦ãã ããã 2013.12.1ç¾å¨ã®ææ°Scalaã®ãã¼ã¸ã§ã³ã¯2.10.3ã§ãã Homebrew Macã®æ¹ã¯ãããä¸çªæ¥½ãã¨æãã¾ãã ãã®ä»ã®ããã±ã¼ã¸ç®¡çã½ããï¼portãapt-getãyumï¼ã§ãåãããã«installã§ãã¾ãã ä½ãææ°ã®Scalaã§ã¯ãªãå¯è½æ§ãããã®ã§ãã®ç¹ã¯æ³¨æãã¦ãã ããã å ¬å¼ãµã¤ããããã¦ã³ãã¼ã ããã±ã¼ã¸ç®¡çã½ããã«é ¼ããªãæ¹ã確å®ã«ææ°ãã¼ã¸ã§ã³ã使ãããæ¹ã¯ãã¡ãã®æ¹æ³ã§ãã ã¾ãã¯Scalaã®å ¬å¼ãµã¤ãããå§ç¸®ãã¡ã¤
ä½ã使ãã¹ããï¼ å ¬å¼ãµã¤ãã®Forumã«ã¦ http://www.scala-lang.org/node/9826 Java ã«ããã JUnit ã®ãããªããã¡ã¯ãã¹ã¿ã³ãã¼ãã¯ãªãã®ï¼ ScalaTest ã使ãã¨ãã¦ã©ã®ã¹ã¿ã¤ã«ãä¸è¬çï¼(JUnitãBDDãFeaturesãFunSuiteã»ã») ScalaTestãspecs(specs2)ãScalaCheckãJUnitãTestNG ããããé¸æè¢ ã©ããä¸ã¤ã«çµãã¨ãããããScalaTest 㨠ScalaCheck ãä½µç¨ã®ãããªä½¿ãæ¹ãã¢ãª ç§ã¯ ScalaTest ã BDD ã¹ã¿ã¤ã«ã§ä½¿ããã¨ãå¤ã ScalaCheck ã®å ¥åãèªåçæããã¢ããã¼ãã¯æ©è½ãã¹ãã®ãããªãã®ã«ç¹ã«åãã¦ãã ç§ã®ç°å¢(Java/Scala ãæ··å¨ãã maven ããã¸ã§ã¯ã)ã«ã¯ ScalaTest ããã specs ã®
2. èªå·±ç´¹ä» lï¬â¯ 水島 å®å¤ª (æ ªå¼ä¼ç¤¾ãã¯ã³ã´æå±) lï¬â¯ Scalaé¢ä¿ã®ãä»äº lï¬â¯ ããã°ã©ãã³ã°è¨èªå¥½ã lï¬â¯ èªä½è¨èªãå ¬éä¸ï¼æè¿æ´æ°ãã¦ãªãï¼ http://github.com/onionlang/onion 3. å¦çç³» lï¬â¯ Scala 2.11.6: ææ°å®å®ç lï¬â¯ ãã¼ã¸ã§ã³ lï¬â¯ Scala 2.11.X: ä¸»æµ lï¬â¯ Scala 2.10.X: lï¬â¯ Scala 2.9.X: ä¸é¨ããã¸ã§ã¯ããå©ç¨ â ä»ããå§ãããªãScala 2.11.X 4. IDE lï¬â¯ æ¢åIDE ã®ãã©ã°ã¤ã³ã¨ãã¦æä¾ lï¬â¯ Eclipse (Scala IDE for Eclipse) lï¬â¯ IntelliJ IDEA (+ Scala Plugin) â IntelliJ IDEA + Scala Pluginããªã¹ã¹ã¡
ã¤ã·ã¥ã¼ ä¾ãã°ãããªã case class Company(id: Option[Long], name: String) class Companies(tag: Tag) extends Table[Company](tag, "COMPANY") { def id = column[Long]("id", O.PrimaryKey, O.AutoInc) def name = column[String]("name", O.NotNull) def * = (id.?, name) <> (Company.tupled, Company.unapply _) } object Companies { val companies = TableQuery[Companies] /** * Construct the Map[String,String] needed to fil
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}