Smalltalk との比較で深まる Citrine の理解

  • Published on
    12-Apr-2017

  • View
    448

  • Download
    2

Embed Size (px)

Transcript

  • CITRINE85th Smalltalk Study Meeting

  • CITRINE PROGRAMMING LANGUAGE85 Smalltalk 2016-02-15TAKANO Mitsuhiro a.k.a. @takano32SORABITO Inc. / jus / CONBU

  • Citrine Citrine Citrine Citrine Smalltalk

  • SELF-INTRODUCTION

  • TAKANO Mitsuhiro@takano32SORABITOUNIXCONBU

  • Smalltalk DeveloperRuby committerIA-64 Citrine committer

    NEW

  • Smalltalk VMWeb

  • CITRINEProgramming Language

  • ABOUT CITRINECitrine

  • CITRINE on the Web

  • Citrine is an easy-to-learn general purpose programming language for UNIX-like operating systems. The Citrine Programming Language focuses on simplicity and emphasizes maintainability through readability. Simplicity is achieved by syntactical and conceptual minimalism.

    Citrine UNIX OSCitrine

  • FEATURES OF CITRINECitrine

  • CITRINE SmalltalkDSL API AST

  • NilBooleanNumberStringBlock Object Object new

  • Nil

    Pen World

    (Nil = Nil) ifTrue: {\ Pen write: 'Nil is Nil!'.}.Nil is Nil!(Nil isNil) ifTrue: {\ Pen write: 'Nil isNil is True!'.}.Nil isNil is True!

  • Boolean

    True False Smalltalky `ifTrue:`

    True ifTrue: {\ Pen write: 'True is True'.}.True is True

  • Number

    5 times: {\ Pen write: 'ho'. }.hohohohoho

  • String

    `trim`, `ltrim`, `rtrim`

    Pen write: ('title' asciiUpperCase1st).Title

  • Block`{\` `{` `}` `{\` `{` `{\` `{` fizzbuzz.ctr

  • SMALLTALK

    True ifTrue: {\ Pen write: 'True is True'.}.5 times: {\ Pen write: 'ho'. }.

  • Animal := Object new.Animal on: 'eat' do: {\ Pen write: 'munch! munch!'.}.dog := Animal new.dog eat.fruits := Array

  • PHP PHP see also PHP: - Manual

  • `respondTo:` PHP `__invoke()` Smalltalk `#doesNotUnderstand:`

  • DSL API

    echo := Object new.echo on: 'respondTo:' do: { sound |2 times: {\ Pen write: sound. }. }.echo ho!. #prints ho!ho!

  • You can make objects respond to arbitrary messages, in some languages this is known as 'magic methods.

  • PHP-ER

  • AST AST Abstract Syntax TreeWikipedia abstract syntax treeASTparse tree

  • AST AST

  • PARSER.C

  • PARSER.C +

  • system.c

  • INSIDE THE CITRINECitrine

  • CITRINE Git GitHub

  • CITRINE else if ctr_build_number_from_string$ git grep malloc | wc -l # => 162$ git grep free | wc -l # => 119 malloc

  • MALLOC FREE

  • SMALLTALK AND CITRINESmalltalk Citrine

  • Boolean`ifTrue:` `ifFalse:` `ifTrue:ifFalse:` `ifFalse:ifTrue:` boolean.ctr Smalltalk

  • CONCLUSION

  • CITRINE Smalltalk PHP Perl PHP-er Chttps://github.com/gabordemooij/citrine/commit/7741df969f080ae8897b7bbafbeb3292b5aee14dhttps://github.com/gabordemooij/citrine/pull/31

  • THANK YOU FOR LISTENING

  • SORABITO RubyUNIXCONBUWeb GitHub:Enterprise SORABITO ALLSTOCKER.com 2Web Smalltalk 2

  • 5 eject MacBook

Recommended

View more >