{ "cells": [ { "cell_type": "markdown", "metadata": { "heading_collapsed": true, "slideshow": { "slide_type": "slide" } }, "source": [ "# The Most Powerful Language Nim\n", "\n", "- 2018/12/5 " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Table of Contents\n", "\n", "- Overview\n", "- Features\n", "- Comparison with Other Languages\n", "- Other\n", "- Reference\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# What is Nim?\n", "\n", "- beautiful grammar \n", "- very fast processing speed!" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Overview\n", "\n", "![](https://pbs.twimg.com/media/DfkRK-GW0AAXf1G.png)\n", "\n", "- Document\n", " - [https://nim-lang.org/](https://nim-lang.org/)\n", "- GitHub\n", " - [https://github.com/nim-lang/Nim](https://github.com/nim-lang/Nim)\n", "- Twitter\n", " - [@nim_lang](https://twitter.com/nim_lang)\n", "- First appeared: 2008\n", "- ver 0.19.0" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Paradigm\n", "\n", "- compiled\n", "- concurrent\n", "- procedual\n", "- imperative\n", "- object oriented\n", "- functional " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Typing Dicipline\n", "\n", "- static\n", "- strong\n", "- inferred" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Qiita (2018/11)\n", "\n", "- number of posts to Qiita\n", "![](https://i.gyazo.com/cc7b889a19c79a6597400ae85364c639.png)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "- other languages..\n", "\n", "| Language | number of post |\n", "|------|------|\n", "| Python | 22098 |\n", "| JavaScript | 22190 |\n", "| Java | 10420 |\n", "| C++ | 5092 |\n", "| Haskell | 1765 |\n", "| Rust | 929 |\n", "| Dlang | 324 |\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Features\n", "\n", "- very fast\n", "- Python look alike syntax\n", "- can use C library\n", "- can compile to C, C++, Objective-C or JavaScript\n", "- metaprogramming\n", "- pragma\n", "- GC\n", "- Binary size is small" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Benchmark\n", "\n", "- vs other languages\n", " - C(optimized) > Nim > Rust(optimized) > Go > Dart > JS > Julia >> Python\n", " - http://h-miyako.hatenablog.com/entry/2015/01/23/060000\n", "- vs NumPy\n", " - Nim > NumPy > Python\n", " - https://narimiran.github.io/2018/05/10/python-numpy-nim.html\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Syntax\n", "\n", "- look alike Python\n", "- not Terminal Semicolon;\n", "- not {Brase}\n", "- nest with indentation\n", "- understandable!\n", "- ![](https://i.gyazo.com/a7c620a29c246ada72c1954618e04f8b.png)\n", "- ↓ all the same\n", "- ![](https://i.gyazo.com/1ad3c10450b790879ef52d17c390d4cd.png)\n", "\n", "- ref: [Nim for Python Programmers](https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Can Use C Library\n", "\n", "- import C code\n", "![](https://i.gyazo.com/4bfe4b6297a64937c699c02f80f6c1c2.png) \n", "![](https://i.gyazo.com/dc78296e546de039a62c62f62a60442a.png)\n", "- C in Nim\n", "![](https://i.gyazo.com/4628cc157818cddf76f8c3f121fedbc1.png)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Compile to JS\n", "\n", "- optimized\n", "- ex. to JS\n", "![](https://i.gyazo.com/c284f5e24983c87cde1763d267ad2051.png)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Metaprogramming\n", "\n", "- generics\n", "- template\n", "- macro" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## [{. Pragma .}](https://nim-lang.org/docs/manual.html#pragmas)\n", "\n", "- give the compiler\n", " - optimized \n", " - additional infromation\n", " \n", "![](https://i.gyazo.com/7234bab63d4d46ce7add3abaf6d475dd.png)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## [GC](https://nim-lang.org/docs/gc.html)\n", "\n", "- Cycle Collector\n", "- fast\n", "- incremental\n", "- pauseless\n", "\n", "- ![](https://nim-lang.org/assets/img/features/gc_latency.png)\n", "- [quote source](https://nim-lang.org/features.html)\n", "\n", "\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Binary Size\n", "\n", "- small\n", "![](https://nim-lang.org/assets/img/features/binary_size.png)\n", "- [quote source](https://nim-lang.org/features.html)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Comparison with Other Languages\n", "\n", "### Rivals\n", "\n", "- C, C++, D, Rust, Go\n", "\n", "### vs Rust\n", "\n", "- [第二プログラミング言語として Rust はオススメしません Nim をやるのです - 強まっていこう](http://wolfbash.hateblo.jp/entry/2017/07/30/193412)\n", "\n", "### vs Go\n", "\n", "- [イケてないのに人気がある golang vs イケてるのに人気がない Nim - 強まっていこう](http://wolfbash.hateblo.jp/entry/2017/10/02/163017)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Other\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Maiking in Nim\n", "\n", "- [OS](http://sksat.hatenablog.com/entry/2017/12/12/213528)\n", "- [Kernel](https://qiita.com/2vg/items/cbccb0ef4288830ad82c)\n", "- [Kenerl 2](https://github.com/dom96/nimkernel)\n", "- [interpreter](https://github.com/mrsekut/WritingAnInterpreterInNim) ← me" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Book\n", "\n", "- [Nim in Action](https://www.manning.com/books/nim-in-action)\n", "- ![](https://images.manning.com/720/960/resize/book/7/1eee7a5-6cc1-4965-ba03-7486c3a30ef9/Picheta-Nim-HI.png)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## VSCode Extension\n", "\n", "- [vscode-nim](https://marketplace.visualstudio.com/items?itemName=kosz78.nim)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Reference\n", "\n", "- [Features | Nim](https://nim-lang.org/features.html)\n", "- [Nim - Wikipedia](https://ja.wikipedia.org/wiki/Nim)\n", "- [Nimで他の言語との連携方法まとめ - Qiita](https://qiita.com/snowlt23/items/1696687cca61bfedb1cc)" ] } ], "metadata": { "celltoolbar": "Slideshow", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" }, "toc": { "nav_menu": {}, "number_sections": false, "sideBar": true, "skip_h1_title": false, "toc_cell": false, "toc_position": { "height": "780px", "left": "0px", "right": "758px", "top": "110px", "width": "212px" }, "toc_section_display": "block", "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }