|
| 1 | +--- |
| 2 | +layout: blog-detail |
| 3 | +post-type: blog |
| 4 | +by: Guillaume Massé |
| 5 | +title: Introducing Accessible Scala |
| 6 | +--- |
| 7 | + |
| 8 | + Scala is proudly a welcoming environment for all. The Scala Center is demonstrating this by supporting |
| 9 | +the development of Accessible Scala, a tool for blind and partially-sighted developers (see [SCP-016]). |
| 10 | +One of its goals is to remove the noise introduced by various delimiters. The current solution with |
| 11 | +text-to-speech engine, would read |
| 12 | + |
| 13 | +```scala |
| 14 | +def foo[A: Wibble](s: String, b: Wobble[A]): Int = ... |
| 15 | +``` |
| 16 | + |
| 17 | +as |
| 18 | + |
| 19 | +```bash |
| 20 | +def space foo open square bracket capital s colon space |
| 21 | +wibble close square bracket open bracket a colon space |
| 22 | +string comma space b colon space wobble open square bracket |
| 23 | +capital a close square bracket close bracket colon |
| 24 | +space Int space equals space ... |
| 25 | +``` |
| 26 | + |
| 27 | +Indeed such a description is necessary to enable precision editing. |
| 28 | + |
| 29 | +However, the following would convey the same information more efficiently: |
| 30 | + |
| 31 | +```bash |
| 32 | +def foo parameterized with: A context bounded by: Wibble. s String, b Wobble of A returns: Int |
| 33 | +``` |
| 34 | + |
| 35 | +Since there is more than one way to pronounce Scala source code, we are open to the community proposition. You can find an extensive test case |
| 36 | +here: [DescribeTest.scala]. If you find that descriptions could be improved, send us a pull request with the |
| 37 | +expected form. |
| 38 | + |
| 39 | + Reading Scala out loud make some of its syntactic elements makes it less intimidating for beginners. There is no more |
| 40 | +need to mentally associate the syntax `+T` with its concept `co-variant`. Notice in the example above, how the type parameter delimiters: `[` and `]` are absent from the verbal description. It can also help sighted developers to describe Scala orally, for example in the context of pair programming. However, when expressions get more complex, the audible form can become ambiguous or difficult to decipher. |
| 41 | + |
| 42 | + To overcome the limitation of verbal description, we created a technique called the Cursor. The idea is simple: |
| 43 | +from your cursor location, you can navigate the abstract syntax tree of the source code. From a node, you can |
| 44 | +navigate to the parent node, to the siblings (left or right) or the first child. As you navigate the code, |
| 45 | +it's described verbally and selected. Here is an illustrated example, the arrows (→ exp ←) represents the highlighted text and <kbd>Alt</kbd> + <kbd>Arrow</kbd> the keyboard shortcut applied to navigate. |
| 46 | + |
| 47 | +``` |
| 48 | +
|
| 49 | +→ private ← class A { // speaks: "private" |
| 50 | + val a = 1 |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +<kbd>Alt</kbd> + <kbd>Right</kbd> |
| 55 | + |
| 56 | +``` |
| 57 | +private class → A ← { // speaks: "A" |
| 58 | + val a = 1 |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +<kbd>Alt</kbd> + <kbd>Down</kbd> |
| 63 | + |
| 64 | +``` |
| 65 | +private class A { |
| 66 | + → val a = 1 ← // speaks: "val a equals 1" |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +We created an online demo (adjust your volume!) to let you try the cursor |
| 71 | +technique and hear the descriptions. |
| 72 | + |
| 73 | +# Want to try it? |
| 74 | + |
| 75 | +We created an [online demo]. You can try it now! (Tip: It works best on Google Chrome! ) |
| 76 | + |
| 77 | +We also created a [vscode extension], so you can try on your project. Search for `Accessible Scala` in the |
| 78 | +extension manager |
| 79 | + |
| 80 | +<div style="margin: 20px auto; width: 560px;"> |
| 81 | + <iframe style="margin: 20px auto; display: block;" width="560" height="315" src="https://www.youtube.com/embed/Y7xz0-KkBOU" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> |
| 82 | + |
| 83 | + <i>Hello world demo</i> |
| 84 | + |
| 85 | + <iframe style="margin: 20px auto; display: block;" width="560" height="315" src="https://www.youtube.com/embed/Up2ytnrsX6s" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> |
| 86 | + |
| 87 | + <i>Coverage demo</i> |
| 88 | +</div> |
| 89 | + |
| 90 | + |
| 91 | +# What's next? |
| 92 | + |
| 93 | +We hope you are excited as we are by the online demo. We would like to hear your feedback on the verbal |
| 94 | +descriptions. We would like to invite the Scala community to improve the quality of the project and join the |
| 95 | +effort. Another area where we would need help |
| 96 | +is to create an integration with [Emacspeak]. It's an emacs plugin widely used by blind developers. If you |
| 97 | +know emacs lisp well and want to participate, please reach out to us! |
| 98 | + |
| 99 | +# Talk to us! |
| 100 | + |
| 101 | +Thoughts or opinions about Accessible Scala? Join us over on [Scala Contributors] to contribute to the discussion. |
| 102 | +We also have a [gitter] channel. |
| 103 | + |
| 104 | +[SCP-016]: https://github.com/scalacenter/advisoryboard/blob/master/proposals/016-verbal-descriptions.md |
| 105 | +[vscode extension]: https://marketplace.visualstudio.com/items?itemName=scala-center.accessible-scala |
| 106 | +[online demo]: https://scalacenter.github.io/accessible-scala-demo/ |
| 107 | +[DescribeTest.scala]: https://github.com/scalacenter/accessible-scala/blob/master/tests/unit/src/test/scala/ch.epfl.scala.accessible/DescribeTest.scala |
| 108 | +[Emacspeak]: https://github.com/tvraman/emacspeak |
| 109 | +[gitter]: https://gitter.im/scalacenter/accessible-scala |
| 110 | +[Scala Contributors]: https://contributors.scala-lang.org/TBD |
0 commit comments