[フレーム]
PPTX, PDF34,232 views

JSX

JSX is a strictly-typed object-oriented programming language that is compiled to JavaScript. It aims to provide higher productivity than JavaScript through strong typing while generating code that runs faster than plain JavaScript. Some key points: - JSX code is compiled to optimized JavaScript using type information for performance gains - It has classes and functions like Java but compiles to JavaScript - Goals are higher productivity than JavaScript and applications that run faster and are higher quality - It avoids problems of other languages that compile to JavaScript like performance penalties

Embed presentation

Downloaded 178 times
JSX DeNA Co., Ltd. Kazuho Oku
What is JSX? Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 2
kind of a skunk-works project I have been doing for the last week or two... (together with gfx) Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 3
Existing problems with JavaScript low productivity requires skills to write fast and maintainable code esp. in medium to large-scale development slow esp. on iOS (without JIT) memory-consuming esp. on JavaScript runtimes with JIT support Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 4
JSX is... a strictly-typed OO language convertible to JavaScript and runs faster than JavaScript on web browsers Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 5
JSX as a programming language strictly-typed OO programming language syntax: class / function definition like Java function body is JavaScript strict types lead to higher productivity / better quality than JavaScript higher productivity / better quality than C / C++ (JSX has GC, no pointers) Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 6
JSX to JavaScript compiler generated code runs faster than JS by optimizing the generated code using type-info JSX is designed so that there would be no overhead when compiled to JavaScript interoperable with JavaScript generates source-map for debugging source-map is a technology that supports debugging of client-side code on web browsers written in languages other than JavaScript Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 7
The goal of JSX run faster than JavaScript on browsers higher productivity than JavaScript applications developed using JSX will have higher quality than when using JavaScript Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 8
Comparison: Google Web Toolkit write in Java / translate to JavaScript differences bet. Java and JS leads to... different behaviors between when run on Java and on JavaScript makes debugging is difficult the translation introduces speed / size overhead hard to use in conjunction with JS libraries cannot use existing Java code as well JSX has none of the problems listed above Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 9
Comparison: Google Closure Compiler a JavaScript minifier can use type-annotations to optimize JS problem: type-annotations are fragile hard to write, impossible to maintain JSX does not have the problem strict types promise higher productivity and performance: all optimizations possible by Closure Compiler can be applied initial versions of JSX will generate fully type-annotated code and pass it to Closure Compiler  Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 10
Comparison: Dart promoted by Google as an replacement of JavaScript optionally-typed OO language Problems: slower than JavaScript when converted to JS unlikely to be supported by web browsers other than Chrome (as a native language) unlikely to run at native performance optionally-typed languages usually require JIT support to run fast Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 11
Comparison: ActionScript 3 an extension of JavaScript with classes and optional types Problem: cannot be translated to JavaScript without big performance penalty unlikely to run at native performance optionally-typed languages usually require JIT support to run fast Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 12
Sample code import "./foo"; // import foo.jsx to current scope import "./bar" into Bar; // refer to the classes as Bar.clazz class Fib { static function fib(n : number) : number { if (n < 2) return 1; else return fib(n - 1) + fib(n - 2); } } Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 13
Sample code (cont'd) class FizzBuzz { static function main(args : String[]) : number { for (var i = 0; i < 100; i++) { if (i % 15 == 0) log "FizzBuzz"; else if (i % 3 == 0) log "Fizz"; else if (i % 5 == 0) log "Buzz"; else log i; } } } Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 14
Design notes on JSX  no global namespace  namespaces exist for each source file  classes in imported source files will be expanded the top-level namespace (or to the specified namespace)  primitive types: void, null, boolean, int, number, String  int: introduced for future usage  on JS, additional overhead only for div and mod operations (by "| 0", etc.), which are rarely used  functions and member functions:  can be overloaded (internally uses name mangling)  accessing the arguments object is slow in JS  function references and member function references are first-class objects Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 15
Design notes on JSX (cont'd)  built-in log and assert statements  no code will be emitted for release builds  support for typed arrays  will fallback to normal array if not supported by the platform  primary target: to support games on HTML 5  compiler is written in JavaScript  so that it could be run on the web browser  for faster development cycle  will be ported to JSX once self-hosting becomes possible  will be a good test code  may use a preprocessor so that the compiler could be interpreted as both JS and JSX Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 16

More Related Content

Binder: Android IPC
PPTX
Binder: Android IPC
Introduction to fragments in android
PDF
Introduction to fragments in android
ADB(Android Debug Bridge): How it works?
PDF
ADB(Android Debug Bridge): How it works?
OData service from ABAP CDS
PPTX
OData service from ABAP CDS
C# Generics
PPTX
C# Generics
Java Basics
PPT
Java Basics
Android Fragment
PDF
Android Fragment
Properties and Indexers
PPTX
Properties and Indexers
Binder: Android IPC
Binder: Android IPC
Introduction to fragments in android
Introduction to fragments in android
ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?
OData service from ABAP CDS
OData service from ABAP CDS
C# Generics
C# Generics
Java Basics
Java Basics
Android Fragment
Android Fragment
Properties and Indexers
Properties and Indexers

What's hot

Lecture - 2 Environment setup & JDK, JRE, JVM
PPTX
Lecture - 2 Environment setup & JDK, JRE, JVM
Android Components & Manifest
PDF
Android Components & Manifest
Transacciones
PDF
Transacciones
Android studio installation
PPTX
Android studio installation
Understanding binder in android
PDF
Understanding binder in android
Jdbc
PPTX
Java
PPTX
Android Boot Time Optimization
PDF
Android Boot Time Optimization
Top 10 sap abap faqs-www.bigclasses.com
PPTX
Top 10 sap abap faqs-www.bigclasses.com
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
PPT
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
Storage area network
PPTX
Storage area network
Android animations
PPTX
Android animations
Building blocks of android
PPTX
Building blocks of android
XSLT presentation
PPTX
XSLT presentation
Overview of Android binder IPC implementation
PPTX
Overview of Android binder IPC implementation
Java Basics
PPT
Java Basics
Understanding das-nas-san
PPTX
Understanding das-nas-san
Particiones EstáTicas
PDF
Particiones EstáTicas
Var arg methods
PPTX
Var arg methods
URL Class in JAVA
PPT
URL Class in JAVA
Lecture - 2 Environment setup & JDK, JRE, JVM
Lecture - 2 Environment setup & JDK, JRE, JVM
Android Components & Manifest
Android Components & Manifest
Transacciones
Transacciones
Android studio installation
Android studio installation
Understanding binder in android
Understanding binder in android
Java
Android Boot Time Optimization
Android Boot Time Optimization
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.com
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
SAP ABAP Latest Interview Questions with Answers by Garuda Trainings
Storage area network
Storage area network
Android animations
Android animations
Building blocks of android
Building blocks of android
XSLT presentation
XSLT presentation
Overview of Android binder IPC implementation
Overview of Android binder IPC implementation
Java Basics
Java Basics
Understanding das-nas-san
Understanding das-nas-san
Particiones EstáTicas
Particiones EstáTicas
Var arg methods
Var arg methods
URL Class in JAVA
URL Class in JAVA

Similar to JSX

Typescript: Beginner to Advanced
PPTX
Typescript: Beginner to Advanced
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
PPTX
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Introduction to TypeScript
PDF
Introduction to TypeScript
introduction to javascript concepts .ppt
PPT
introduction to javascript concepts .ppt
Web development basics (Part-7)
PPT
Web development basics (Part-7)
You Don t Know JS ES6 Beyond Kyle Simpson
PDF
You Don t Know JS ES6 Beyond Kyle Simpson
Tampering with JavaScript
PPTX
Tampering with JavaScript
Programming TypeScript Making your JavaScript applications scale Boris Cherny
PDF
Programming TypeScript Making your JavaScript applications scale Boris Cherny
Typescript For Beginners The Ultimate Guide Sufyan Bin Uzayr
PDF
Typescript For Beginners The Ultimate Guide Sufyan Bin Uzayr
Basics of Javascript
PPT
Basics of Javascript
Migrating Web SDK from JS to TS
PDF
Migrating Web SDK from JS to TS
JSX Optimizer
PPTX
JSX Optimizer
JSX - developing a statically-typed programming language for the Web
PDF
JSX - developing a statically-typed programming language for the Web
Introduction to mean and mern || Event by DSC UNIDEB
PPT
Introduction to mean and mern || Event by DSC UNIDEB
11_typescript.pptx for north south university course cse425
PPTX
11_typescript.pptx for north south university course cse425
TypeScript . the JavaScript developer best friend!
PPTX
TypeScript . the JavaScript developer best friend!
DEVCON1 - BooJs
PDF
DEVCON1 - BooJs
ES6 - JavaCro 2016
PPTX
ES6 - JavaCro 2016
Expert JavaScript Programming
PDF
Expert JavaScript Programming
The Future of JavaScript (Ajax Exp '07)
PDF
The Future of JavaScript (Ajax Exp '07)
Typescript: Beginner to Advanced
Typescript: Beginner to Advanced
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Introduction to TypeScript
Introduction to TypeScript
introduction to javascript concepts .ppt
introduction to javascript concepts .ppt
Web development basics (Part-7)
Web development basics (Part-7)
You Don t Know JS ES6 Beyond Kyle Simpson
You Don t Know JS ES6 Beyond Kyle Simpson
Tampering with JavaScript
Tampering with JavaScript
Programming TypeScript Making your JavaScript applications scale Boris Cherny
Programming TypeScript Making your JavaScript applications scale Boris Cherny
Typescript For Beginners The Ultimate Guide Sufyan Bin Uzayr
Typescript For Beginners The Ultimate Guide Sufyan Bin Uzayr
Basics of Javascript
Basics of Javascript
Migrating Web SDK from JS to TS
Migrating Web SDK from JS to TS
JSX Optimizer
JSX Optimizer
JSX - developing a statically-typed programming language for the Web
JSX - developing a statically-typed programming language for the Web
Introduction to mean and mern || Event by DSC UNIDEB
Introduction to mean and mern || Event by DSC UNIDEB
11_typescript.pptx for north south university course cse425
11_typescript.pptx for north south university course cse425
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
DEVCON1 - BooJs
DEVCON1 - BooJs
ES6 - JavaCro 2016
ES6 - JavaCro 2016
Expert JavaScript Programming
Expert JavaScript Programming
The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)

More from Kazuho Oku

H2O - the optimized HTTP server
PDF
H2O - the optimized HTTP server
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
PPTX
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
HTTPとサーバ技術の最新動向
PPTX
HTTPとサーバ技術の最新動向
JSX の現在と未来 - Oct 26 2013
PPTX
JSX の現在と未来 - Oct 26 2013
TLS 1.3 と 0-RTT のこわ〜い話
PDF
TLS 1.3 と 0-RTT のこわ〜い話
JSX 速さの秘密 - 高速なJavaScriptを書く方法
PPTX
JSX 速さの秘密 - 高速なJavaScriptを書く方法
HTTP/2時代のウェブサイト設計
PDF
HTTP/2時代のウェブサイト設計
HTTP/2で 速くなるとき ならないとき
PDF
HTTP/2で 速くなるとき ならないとき
JSON SQL Injection and the Lessons Learned
PPTX
JSON SQL Injection and the Lessons Learned
Developing the fastest HTTP/2 server
PDF
Developing the fastest HTTP/2 server
Recent Advances in HTTP, controlling them using ruby
PPTX
Recent Advances in HTTP, controlling them using ruby
H2O - making HTTP better
PDF
H2O - making HTTP better
QUIC標準化動向 〜2017/7
PDF
QUIC標準化動向 〜2017/7
Programming TCP for responsiveness
PPTX
Programming TCP for responsiveness
Cache aware-server-push in H2O version 1.5
PPTX
Cache aware-server-push in H2O version 1.5
Reorganizing Website Architecture for HTTP/2 and Beyond
PDF
Reorganizing Website Architecture for HTTP/2 and Beyond
H2O - making the Web faster
PDF
H2O - making the Web faster
TLS & LURK @ IETF 95
PPTX
TLS & LURK @ IETF 95
Programming TCP for responsiveness
PDF
Programming TCP for responsiveness
HTTP/2の課題と将来
PDF
HTTP/2の課題と将来
H2O - the optimized HTTP server
H2O - the optimized HTTP server
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
HTTPとサーバ技術の最新動向
HTTPとサーバ技術の最新動向
JSX の現在と未来 - Oct 26 2013
JSX の現在と未来 - Oct 26 2013
TLS 1.3 と 0-RTT のこわ〜い話
TLS 1.3 と 0-RTT のこわ〜い話
JSX 速さの秘密 - 高速なJavaScriptを書く方法
JSX 速さの秘密 - 高速なJavaScriptを書く方法
HTTP/2時代のウェブサイト設計
HTTP/2時代のウェブサイト設計
HTTP/2で 速くなるとき ならないとき
HTTP/2で 速くなるとき ならないとき
JSON SQL Injection and the Lessons Learned
JSON SQL Injection and the Lessons Learned
Developing the fastest HTTP/2 server
Developing the fastest HTTP/2 server
Recent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using ruby
H2O - making HTTP better
H2O - making HTTP better
QUIC標準化動向 〜2017/7
QUIC標準化動向 〜2017/7
Programming TCP for responsiveness
Programming TCP for responsiveness
Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5
Reorganizing Website Architecture for HTTP/2 and Beyond
Reorganizing Website Architecture for HTTP/2 and Beyond
H2O - making the Web faster
H2O - making the Web faster
TLS & LURK @ IETF 95
TLS & LURK @ IETF 95
Programming TCP for responsiveness
Programming TCP for responsiveness
HTTP/2の課題と将来
HTTP/2の課題と将来

Recently uploaded

Generative AI in UiPath: Mastering the Generative Extractor for Intelligent D...
PDF
Generative AI in UiPath: Mastering the Generative Extractor for Intelligent D...
Agentic Automation for Testers – A Hands-On Deep Dive
PDF
Agentic Automation for Testers – A Hands-On Deep Dive
Knowing and Doing: Knowledge graphs, AI, and work
PDF
Knowing and Doing: Knowledge graphs, AI, and work
Generative AI in 2026: Hype, Bubble, Winter or The Real Deal?
PDF
Generative AI in 2026: Hype, Bubble, Winter or The Real Deal?
Mobile-Computing-A-Revolution-in-Our-Hands.pdf
PDF
Mobile-Computing-A-Revolution-in-Our-Hands.pdf
API206-S: Transforming Supply Chains with Amazon Bedrock AgentCore - AWS re:I...
PDF
API206-S: Transforming Supply Chains with Amazon Bedrock AgentCore - AWS re:I...
Transforming SAP® Processes Through Automation: 2026 Trends and Challenges.pdf
PDF
Transforming SAP® Processes Through Automation: 2026 Trends and Challenges.pdf
The Future of Search: Why LLM Optimization Matters for Every Website
PDF
The Future of Search: Why LLM Optimization Matters for Every Website
Zero Trust & Defense-in-Depth: The Future of Critical Infrastructure Security
PDF
Zero Trust & Defense-in-Depth: The Future of Critical Infrastructure Security
Safeguarding AI-Based Financial Infrastructure
PDF
Safeguarding AI-Based Financial Infrastructure
Incident Response Planning with a Foundation Model
PDF
Incident Response Planning with a Foundation Model
TPPmark2025 Kenta Inoue's answer 12/04/2025
PDF
TPPmark2025 Kenta Inoue's answer 12/04/2025
Recursive Self Improvement vs Continuous Learning
PDF
Recursive Self Improvement vs Continuous Learning
Ransomware_Resilience_Strategic_Playbook.pdf
PDF
Ransomware_Resilience_Strategic_Playbook.pdf
Ritesh_kumar_Aatmanirbhar Bharat: Make in India, Make for the World.pptx
PPTX
Ritesh_kumar_Aatmanirbhar Bharat: Make in India, Make for the World.pptx
eResource Scheduler Enterprise Resource Management and Scheduling Software.pdf
PDF
eResource Scheduler Enterprise Resource Management and Scheduling Software.pdf
DevSecOps Learning Path - TryHackMe Certificate
PDF
DevSecOps Learning Path - TryHackMe Certificate
Data Donation as Research Method and Pedagogical Tool
PDF
Data Donation as Research Method and Pedagogical Tool
8 LLM Surveys https://tinyurl.com/bdz8e6fp
PDF
8 LLM Surveys https://tinyurl.com/bdz8e6fp
Cybersecurity Prevention and Detection Specialization
PDF
Cybersecurity Prevention and Detection Specialization
Generative AI in UiPath: Mastering the Generative Extractor for Intelligent D...
Generative AI in UiPath: Mastering the Generative Extractor for Intelligent D...
Agentic Automation for Testers – A Hands-On Deep Dive
Agentic Automation for Testers – A Hands-On Deep Dive
Knowing and Doing: Knowledge graphs, AI, and work
Knowing and Doing: Knowledge graphs, AI, and work
Generative AI in 2026: Hype, Bubble, Winter or The Real Deal?
Generative AI in 2026: Hype, Bubble, Winter or The Real Deal?
Mobile-Computing-A-Revolution-in-Our-Hands.pdf
Mobile-Computing-A-Revolution-in-Our-Hands.pdf
API206-S: Transforming Supply Chains with Amazon Bedrock AgentCore - AWS re:I...
API206-S: Transforming Supply Chains with Amazon Bedrock AgentCore - AWS re:I...
Transforming SAP® Processes Through Automation: 2026 Trends and Challenges.pdf
Transforming SAP® Processes Through Automation: 2026 Trends and Challenges.pdf
The Future of Search: Why LLM Optimization Matters for Every Website
The Future of Search: Why LLM Optimization Matters for Every Website
Zero Trust & Defense-in-Depth: The Future of Critical Infrastructure Security
Zero Trust & Defense-in-Depth: The Future of Critical Infrastructure Security
Safeguarding AI-Based Financial Infrastructure
Safeguarding AI-Based Financial Infrastructure
Incident Response Planning with a Foundation Model
Incident Response Planning with a Foundation Model
TPPmark2025 Kenta Inoue's answer 12/04/2025
TPPmark2025 Kenta Inoue's answer 12/04/2025
Recursive Self Improvement vs Continuous Learning
Recursive Self Improvement vs Continuous Learning
Ransomware_Resilience_Strategic_Playbook.pdf
Ransomware_Resilience_Strategic_Playbook.pdf
Ritesh_kumar_Aatmanirbhar Bharat: Make in India, Make for the World.pptx
Ritesh_kumar_Aatmanirbhar Bharat: Make in India, Make for the World.pptx
eResource Scheduler Enterprise Resource Management and Scheduling Software.pdf
eResource Scheduler Enterprise Resource Management and Scheduling Software.pdf
DevSecOps Learning Path - TryHackMe Certificate
DevSecOps Learning Path - TryHackMe Certificate
Data Donation as Research Method and Pedagogical Tool
Data Donation as Research Method and Pedagogical Tool
8 LLM Surveys https://tinyurl.com/bdz8e6fp
8 LLM Surveys https://tinyurl.com/bdz8e6fp
Cybersecurity Prevention and Detection Specialization
Cybersecurity Prevention and Detection Specialization

JSX

  • 1.
  • 2.
    What is JSX? Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 2
  • 3.
    kind of a skunk-works project I have been doing for the last week or two... (together with gfx) Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 3
  • 4.
    Existing problems with JavaScript low productivity requires skills to write fast and maintainable code esp. in medium to large-scale development slow esp. on iOS (without JIT) memory-consuming esp. on JavaScript runtimes with JIT support Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 4
  • 5.
    JSX is... a strictly-typed OO language convertible to JavaScript and runs faster than JavaScript on web browsers Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 5
  • 6.
    JSX as a programming language strictly-typed OO programming language syntax: class / function definition like Java function body is JavaScript strict types lead to higher productivity / better quality than JavaScript higher productivity / better quality than C / C++ (JSX has GC, no pointers) Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 6
  • 7.
    JSX to JavaScript compiler generated code runs faster than JS by optimizing the generated code using type-info JSX is designed so that there would be no overhead when compiled to JavaScript interoperable with JavaScript generates source-map for debugging source-map is a technology that supports debugging of client-side code on web browsers written in languages other than JavaScript Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 7
  • 8.
    The goal of JSX run faster than JavaScript on browsers higher productivity than JavaScript applications developed using JSX will have higher quality than when using JavaScript Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 8
  • 9.
    Comparison: Google Web Toolkit write in Java / translate to JavaScript differences bet. Java and JS leads to... different behaviors between when run on Java and on JavaScript makes debugging is difficult the translation introduces speed / size overhead hard to use in conjunction with JS libraries cannot use existing Java code as well JSX has none of the problems listed above Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 9
  • 10.
    Comparison: Google Closure Compiler a JavaScript minifier can use type-annotations to optimize JS problem: type-annotations are fragile hard to write, impossible to maintain JSX does not have the problem strict types promise higher productivity and performance: all optimizations possible by Closure Compiler can be applied initial versions of JSX will generate fully type-annotated code and pass it to Closure Compiler  Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 10
  • 11.
    Comparison: Dart promoted by Google as an replacement of JavaScript optionally-typed OO language Problems: slower than JavaScript when converted to JS unlikely to be supported by web browsers other than Chrome (as a native language) unlikely to run at native performance optionally-typed languages usually require JIT support to run fast Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 11
  • 12.
    Comparison: ActionScript 3 an extension of JavaScript with classes and optional types Problem: cannot be translated to JavaScript without big performance penalty unlikely to run at native performance optionally-typed languages usually require JIT support to run fast Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 12
  • 13.
    Sample code import "./foo"; // import foo.jsx to current scope import "./bar" into Bar; // refer to the classes as Bar.clazz class Fib { static function fib(n : number) : number { if (n < 2) return 1; else return fib(n - 1) + fib(n - 2); } } Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 13
  • 14.
    Sample code (cont'd) class FizzBuzz { static function main(args : String[]) : number { for (var i = 0; i < 100; i++) { if (i % 15 == 0) log "FizzBuzz"; else if (i % 3 == 0) log "Fizz"; else if (i % 5 == 0) log "Buzz"; else log i; } } } Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 14
  • 15.
    Design notes on JSX  no global namespace  namespaces exist for each source file  classes in imported source files will be expanded the top-level namespace (or to the specified namespace)  primitive types: void, null, boolean, int, number, String  int: introduced for future usage  on JS, additional overhead only for div and mod operations (by "| 0", etc.), which are rarely used  functions and member functions:  can be overloaded (internally uses name mangling)  accessing the arguments object is slow in JS  function references and member function references are first-class objects Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 15
  • 16.
    Design notes on JSX (cont'd)  built-in log and assert statements  no code will be emitted for release builds  support for typed arrays  will fallback to normal array if not supported by the platform  primary target: to support games on HTML 5  compiler is written in JavaScript  so that it could be run on the web browser  for faster development cycle  will be ported to JSX once self-hosting becomes possible  will be a good test code  may use a preprocessor so that the compiler could be interpreted as both JS and JSX Apr 5 2012 Copyright © 2012 DeNA Co., Ltd., All rights reserved 16

AltStyle によって変換されたページ (->オリジナル) /