Scalaã¤ã³ã¿ããªã¿ä¸ã§scaladocãæ¤ç´¢ã§ããInteractiveHelpãä½ãã¾ããã
ã¿ãªããããScala ã¹ã±ã¼ã©ãã«ããã°ã©ãã³ã°ãèªã¿ã¾ããã?
俺ã¯ã¾ã ãã¹ãã¤ããã¶ãã¡m9ï¼ï¼¾Ðï¼¾ï¼
scalaã«ã¯å¯¾è©±åå®è¡ç°å¢(ã¤ã³ã¿ããªã¿)ãã¤ãã¦ã¾ãã
ã¡ããã£ã¨ã³ã¼ãæã£ã¦åä½ç¢ºèªããªããã³ã¼ãã£ã³ã°ããLLã©ã¤ã¯ãªéçºã¹ã¿ã¤ã«ãå¯è½ãªãã§ãã
IDEåãã®scalaãã©ã°ã¤ã³ããIDEã¨çµ±åãããã¤ã³ã¿ããªã¿ãããã°ãã¨å¸¸ã
æã£ã¦ãã¾ãã
ã¨ãããããã¹ãã ãJKã
ãã ãscalaã®ã¤ã³ã¿ããªã¿ã§æ±ºå®çã«ä¸è¶³ãã¦ããæ©è½ãããã¾ãã
ããã¯â¦â¦
ãã«ãã®æ¤ç´¢ã§ã!!
scalaã«ã¯ãscaladocã¨ããjavadocã¨åãHTMLå½¢å¼ã®APIããã¥ã¡ã³ããããã¾ãããåºæ¬ãã©ã¦ã¶ããé²è¦§ãããã®ã§ãã
ã¤ã³ã¿ããªã¿ã§ã³ã¼ãæ¸ããã¨æã£ã¦ããããããã®ã¯ã©ã¹ã£ã¦ã©ããªã¡ã½ãããã£ãã?ãã¨æã£ãããããããã«ãã©ã¦ã¶ãèµ·åãã¦APIããã¥ã¡ã³ããéãã¦ãç®çã®ã¯ã©ã¹ã®ãªã³ã¯ãã¯ãªãã¯ãã¦â¦â¦UZEEEEEEEEEEEEEEE!!!!!!!!!
ãããpythonã ã£ãããhelp(dict)ã¨å ¥åããã¨ããã¥ã¡ã³ããè¦ãããããªãã¸ã§ã¯ãã®æã¤ããããã£ã¯dir( (1,2) )ãªããã§åç §ã§ããããªããã®æ©è½ãscalaã«ã¯ãªããã ã£!?
ãªããã°ãã¯ã¬ã«ã¹ã£ã¦ãã¨ã§ä½ãã¾ããã
InteractiveHelp
yuroyoro/InteractiveHelp · GitHub
ã»ããã¢ãã
README.textileã«ãæ¸ãã¦ããã¾ãããã¾ãgithubããããã¸ã§ã¯ãä¸å¼ããã¦ã³ãã¼ããã¾ãã
次ã«ãæ·»ä»ããã¦ããscala-2.7.5-apidocs-fixed.zipã解åãã¦ãåºæ¥ããã£ã¬ã¯ããªãç°å¢å¤æ°SCALA_DOC_HOMEã«è¨å®ãã¾ãã
(å®ã¯ãå®è¡ããscalaã©ã³ã¿ã¤ã ã®doc/apiã«htmlä¸å¼ãé
ç½®ãã¦ãåç
§ã§ãã)
å®è¡ã¯ãInteractiveHelpã®jarãã¯ã©ã¹ãã¹ã«éãã¦ãã¤ã³ã¿ããªã¿ä¸ã§com.yuroyoro.interactivehelp.Helpãªãã¸ã§ã¯ãã®ã¡ã½ãããå ¨ã¦importãã¾ãã
ãããªæãã§ãã
$ scala -cp InteractiveHelp/interactive-help-1.0.jar Welcome to Scala version 2.7.5.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_13). Type in expressions to have them evaluated. Type :help for more information. scala> import com.yuroyoro.interactivehelp.Help._ import com.yuroyoro.interactivehelp.Help._ scala>
ã©ããªãããªã®?
以ä¸ã®ã¹ã¯ãªã¼ã³ã·ã§ãããã覧ãã ããã
ãããã®ã¨ãããã¤ã³ã¿ããªã¿ä¸ã§scaladocãé²è¦§ãããã¨ãåºæ¥ã¾ãã
èªåã§ä½ã£ã¦ããã¦ä½ã§ãããé¼»è¡ãæ¼ãåºãããã便å©ãªã®ã§ãã²ä½¿ã£ã¦ãã£ã¦ãã ããm(_)m
ã¯ã©ã¹/ãªãã¸ã§ã¯ãã®æ¤ç´¢
scalaã®ã¤ã³ã¿ããªã¿ä¸ã§h("List")ã¨å
¥åããã¨ã"List"ã«ä¸è´ããã¯ã©ã¹/ãªãã¸ã§ã¯ãã®ä¸è¦§ã表示ããã¾ãã
scala> h("List") 0:Class scala.List 1:Object scala.List
ããã«ã¤ã¥ãã¦ãh("List")(0)ã¨å
¥åãã¦ã¿ã¾ãããã
scala> h("List")(0) === scala.List ================================================== sealed abstract class List[+A] extends Seq[A] with Product A class representing an ordered collection of elements of type a. This class comes with two implementing case classes scala.Nil and scala.:: that implement the abstract members isEmpty, head and tail. ================================================================ res11: com.yuroyoro.interactivehelp.Document = Class
Listã¯ã©ã¹ã®ããã¥ã¡ã³ãã表示ããã¾ããã
ã¡ã½ããã®æ¤ç´¢
Listã¯ã©ã¹ãæã¤ã¡ã½ãããç¥ãããå ´åã¯ãç¶ãã¦h("List")(0).mã¨å
¥åãã¾ãã
scala> h("List")(0).m 0:def + [ B > : A ]( x : B ) : List [ B ] 1:override def ++ [ B > : A ]( that : Iterable [ B ]) : List [ B ] Appends two list objects. 2:def - [ B > : A ]( x : B ) : List [ B ] Computes the difference between this list and the given object x. 3:def -- [ B > : A ]( that : List [ B ]) : List [ B ] Computes the difference between this list and the given list that. ...
ã¡ã½ããã®ä¸è¦§ã表示ããã¾ããã
h("List")(0).m(1)ã®ããã«ãä¸è¦§ã®çªå·ã«å¯¾å¿ããçªå·ãããã«æå®ããã¨ããã®ã¡ã½ããã®è©³ç´°ã確èªåºæ¥ã¾ãã
scala> h("List")(0).m(1) override def ++[B >: A](that : Iterable[B]) : List[B] Appends two list objects. Overrides Seq.++ res13: com.yuroyoro.interactivehelp.Document = Method
ããã±ã¼ã¸ã®æ¤ç´¢
h("scala.util.regexp")ã®ããã«ãããã±ã¼ã¸åãæå®ããã¨ãã®ããã±ã¼ã¸ã«å±ããã¯ã©ã¹/ãªãã¸ã§ã¯ã/ããã±ã¼ã¸ãä¸è¦§è¡¨ç¤ºããã¾ãã
scala> h("scala.util.regexp") 0:Class scala.util.regexp.Base 1:Class scala.util.regexp.PointedHedgeExp 2:Class scala.util.regexp.SyntaxError 3:Class scala.util.regexp.WordExp res14: com.yuroyoro.interactivehelp.Document = Seq
æ¤ç´¢çµæã®ç¨®å¥
æ¤ç´¢çµæã®ç¨®å¥ã¯ãæå¾ã«ä»¥ä¸ã®ããã«ãåºåããã¾ãã
res11: com.yuroyoro.interactivehelp.Document = Class
種å¥ã¨ãã¦ã¯ã以ä¸ã®ç¨®é¡ãããã¾ãã
None | 該å½ãªã |
Seq | è¤æ°ä»¶ã該å½ããã®æ»ãå¤ã®ãªãã¸ã§ã¯ãã«(0)ã("Name"),('Nam)ã®ããã«ãIndexçªå·/ååãæå®ãããã¨ã§ããã«çµãè¾¼ãããSeqã¯ãWith scala.Seq[Document]åãªã®ã§ãfilterãmapãªã©ãå¯è½ã |
Package | ããã±ã¼ã¸ã該å½ãPackageãWith scala.Seq[Document]åã |
Class | ã¯ã©ã¹ãè©²å½ |
Object | ãªãã¸ã§ã¯ããè©²å½ |
Method | ã¡ã½ãããè©²å½ |
Value | ã¯ã©ã¹ãæã¤ãã£ã¼ã«ããè©²å½ |
æ¤ç´¢çµæã®SeqãPackageã¯Seq[Document]åãªã®ã§ãfilterãmapãªã©ãå¯è½ã§ãã
scala> h('reg)(5).foreach( c => println(c.name ) ) Base PointedHedgeExp SyntaxError WordExp
æ¤ç´¢çµæã®çµãè¾¼ã¿
è¤æ°ä»¶ã該å½ãããããªçµæ(種å¥ãSeqãPackage)ã®å ´åãæ»ãå¤ã®ãªãã¸ã§ã¯ãã«(0)ã§Indexçªå·ãæå®ãããã("name")ã¨Stringã§ååãæå®ããã¨çµãè¾¼ã¿ãåºæ¥ã¾ãã
('Lis)ã®ããã«ãSymbolã渡ãã¨ãåæ¹ä¸è´ã§è©²å½ãããã®ãæ¤ç´¢ãã¾ãã
scala> h("scala.actors")('Act) 0:Class scala.actors.Actor 1:Object scala.actors.Actor 2:Object scala.actors.ActorGC res25: com.yuroyoro.interactivehelp.Document = Seq
ãã©ã¦ã¶ã§ã®é²è¦§
æ¤ç´¢çµæã®ç¨®å¥ããClass/Object/Method/Valueã®å ´åãç¶ãã¦".o"ã¨å ¥åããã¨ã対å¿ããscaladocããã©ã¦ã¶ä¸ã§è¦ããã¨ãåºæ¥ã¾ãã
ãã®ä»ã®ã³ãã³ãã«ã¤ãã¦
ãã¡ãã®README.textileãåç §ãã¦ãã ããã
ãããã
ã¾ãã¯ãscalaã®tracä¸ã®ã½ã¼ã¹ãã¡ã¤ã«ããã©ã¦ã¶ã§è¦ãæ©è½ãä»ãã¾ãã
ãã¨ãã¡ããã¨ãã¹ãæ¸ãã¦ãªã(!!!)ã®ã§ãã¹ãæ¸ãã¾ãã
ãã¨ãèªã¿è¾¼ãscaladocã¯well-formedãªXHTMLã§ãªãã¨ã¨ã©ã¼ã«ãªãããããããæ¹åãããã¨æãã¾ãã
ç¾å¨ã¯ãscalaå
¬å¼ã®scaladocã®ããã¤ãã¯ã¿ã°ã®éãå¿ããªã©ããã£ã¦èªã¿è¾¼ããªããããä»æ¹ãªãä¿®æ£ããscaladocãå梱ãã¦ãããå©ç¨ããããã«ãªã£ã¦ããã®ã§ãã
æçµçã«ã¯ãvscaladocã®ãããªdocletã¨ãã¦å®è£ ãã¦ããã«ãç¨ã®ãã¡ã¤ã«ãã½ã¼ã¹ããçæãã¦ããããå©ç¨ããå½¢ã«ãããã¨èãã¦ãã¾ãã