Development

จุดอ่อนอันยิ่งใหญ่ของ JavaScript นั้นเป็นผลพวงจากการที่ตัวภาษาถูกออกแบบมาไม่ดีเท่าที่ควร ไม่ว่าจะเป็นการใช้ scope แบบ functional (คล้ายภาษา LISP) แต่กลับเขียนไวยากรณ์ในแบบ procedural (คล้ายภาษา C) ซ้ำยังอนุญาตให้เลือกว่าจะใส่ semicolon (;) ท้ายประโยคหรือไม่ก็ได้ ไปจนถึงชื่อของภาษาที่ทำให้หลายคนเข้าใจผิดว่ามันคือ Java ขนาดย่อมๆ เสียอีก นี่ทำให้การพัฒนาโปรแกรมที่ดีบน JavaScript ยุ่งยากมากสำหรับมือใหม่

แต่เนื่องจาก JavaScript ถูกใช้อย่างล้นหลาม การจะประกาศเลิกใช้ฟังก์ชันหรือไวยากรณ์ที่เป็นจุดอ่อนจึงเป็นไปได้ยากมาก ทางออกที่มีประสิทธิภาพกว่าคือการสร้างภาษาขึ้นมาใหม่หมด ภายใต้เงื่อนไขที่ว่าภาษาใหม่นี้ต้องแปลงกลับไปเป็น JavaScript ได้ (เพื่อรับประกันว่า อย่างน้อยมันก็จะสามารถทำงานได้บนทุก browser ในปัจจุบัน)

ความพยายามที่ผ่านมาก็ได้แก่ CoffeeScript โดย Jeremy Ashkenas, Dart โดย Google และตอนนี้ Microsoft ก็ขอลงแข่งขันในสมรภูมินี้ด้วย TypeScript ครับ

ไวยากรณ์ของ TypeScript นั้นยังคงความเป็น JavaScript เดิมๆ อยู่เยอะมาก ต่างจาก CoffeeScript ที่ออกแบบใหม่ทั้งหมด (คล้ายจับ Ruby, Haskell มารวมกัน) และไม่เหมือนกับ Dart ที่เป็น structure เต็มรูป

โดยความสามารถของ TypeScript ที่เพิ่มขึ้นจาก JavaScript คือ

  • เลือกได้ว่าจะทำเป็น static type หรือไม่
  • เพิ่มไวยากรณ์สำหรับประกาศ class
  • รองรับระบบโมดูล
  • ปลั๊กอินสำหรับ Visual Studio

ตอนนี้ Microsoft ยังปล่อย TypeScript ออกมาเพียงขั้น preview อยู่ ถ้าสนใจก็ไปทดลองเล่นผ่านหน้าเว็บได้เลย ส่วนด้าน source code นั้นเป็น open source ภายใต้สัญญาอนุญาต Apache 2.0 ครับ

ที่มา: TechCrunch

Hiring! บริษัทที่น่าสนใจ

Carmen Software company cover
Carmen Software
Hotel Financial Solutions
Next Innovation (Thailand) Co., Ltd. company cover
Next Innovation (Thailand) Co., Ltd.
We are web design with consulting & engineering services driven the future stronger and flexibility.
KKP Dime company cover
KKP Dime
KKP Dime บริษัทในเครือเกียรตินาคินภัทร
Kiatnakin Phatra Financial Group company cover
Kiatnakin Phatra Financial Group
Financial Service
Fastwork Technologies company cover
Fastwork Technologies
Fastwork.co เว็บไซต์ที่รวบรวม ฟรีแลนซ์ มืออาชีพจากหลากหลายสายงานไว้ในที่เดียวกัน
Thoughtworks Thailand company cover
Thoughtworks Thailand
Thoughtworks เป็นบริษัทที่ปรึกษาด้านเทคโนโยลีระดับโลกที่คว้า Great Place to Work 3 ปีซ้อน
Iron Software company cover
Iron Software
Iron Software is an American company providing a suite of .NET libraries by engineer for engineers.
CLEVERSE company cover
CLEVERSE
Cleverse is a Venture Builder. Our team builds several tech companies.
Nipa Cloud company cover
Nipa Cloud
#1 OpenStack cloud provider in Thailand with our own data center and software platform.
Bangmod Enterprise company cover
Bangmod Enterprise
The leader in Cloud Server and Hosting in Thailand.
CIMB THAI Bank company cover
CIMB THAI Bank
MOVING FORWARD WITH YOU - CIMB is the leading ASEAN Bank
Bangkok Bank company cover
Bangkok Bank
Bangkok Bank is one of Southeast Asia's largest regional banks, a market leader in business banking
MuvMi (Urban Mobility Tech Co.,Ltd.) company cover
MuvMi (Urban Mobility Tech Co.,Ltd.)
Shape the future of urban mobility towards affordable, clean, and safe solutions
T.N. Digital Solution Co., Ltd. company cover
T.N. Digital Solution Co., Ltd.
TNDS has been involving in every first move of banking’s major digital transformation.
KBTG - KASIKORN Business-Technology Group company cover
KBTG - KASIKORN Business-Technology Group
KBTG - "The Technology Company for Digital Business Innovation"
Siam Commercial Bank Public Company Limited company cover
Siam Commercial Bank Public Company Limited
"Let's start a brighter career future together"
Icon Framework co.,Ltd. company cover
Icon Framework co.,Ltd.
Global Standard Platform for Real Estate แพลตฟอร์มสำหรับธุรกิจอสังหาริมทรัพย์ครบวงจร มาตรฐานระดับโลก
REFINITIV company cover
REFINITIV
The Financial and Risk business of Thomson Reuters is now Refinitiv
H LAB company cover
H LAB
Re-engineering healthcare systems through intelligent platforms and system design.
The Gang Technology Co., Ltd. company cover
The Gang Technology Co., Ltd.
We're a Digital Agency that helps our customers transform their business into digital with ease.
LTMH company cover
LTMH
LTMH มุ่งเน้นการพัฒนาผลิตภัณฑ์ที่สามารถช่วยพันธมิตรของเราให้บรรลุเป้าหมาย
Seven Peaks company cover
Seven Peaks
We Drive Digital Transformation
Wisesight (Thailand) Co., Ltd. company cover
Wisesight (Thailand) Co., Ltd.
The Best Choice For Handling Social Media · High Expertise in Social Data · Most Advanced and Secure
MOLOG Tech company cover
MOLOG Tech
We are Modern Logistic Platform, Specialize in WMS, OMS and TMS.
Data Wow Co.,Ltd company cover
Data Wow Co.,Ltd
We enable our clients to realize increased productivity by solving their most complex issues by Data
LINE Company Thailand company cover
LINE Company Thailand
LINE, the world's hottest mobile messaging platform, offers free text and voice messaging + Call
LINE MAN Wongnai company cover
LINE MAN Wongnai
Join our journey to becoming No.1 food platform in Thailand

โค้ดอ่านง่าย เข้าใจง่ายดีครับ
ในโค้ดตัวอย่างนี่ semicolon มีมั่งไม่มีมั่ง
กำลังจะบอกว่ามีหรือไม่มีก็ได้รึเปล่าหว่า...

นึกถึงตอนที่มีทั้ง VB Script กับ JavaScript เลย (;¬_¬)ซึ่งสงครามจบที่ JavaScript แต่ตอนนี้ท่าจะหนักกว่าตอนนั้นนะ

ถ้าให้ต้อง compile ให้เป็น JavaScript ทุกครั้งที่แก้โปรแกรมก็ไม่ไหวนะ สุดท้ายกลับไปเขียน JavaScript อยู่ดี ( ̄ε(# ̄)

ลืมเอา video intro to TypeScript ของ Anders มาใส่หรือเปล่าครับ?

ปล. จริงๆ ควรจะบอกว่า TypeScript คือส่วนต่อขยายจาก JavaScript ในปัจจุบัน(extend/superset) แปลว่าเอา JavaScript ธรรมดาไปเปิดใน TypeScript Editor ได้

คิดเหมือนกัน เป็นตัวแปรสำคัญที่ยังยึดกับ Javascript ต่อไป

ต่อให้ดันมีบริษัทใดจ่ายเงินให้ JQuery มีภาษาของตัวเองขึ้นมา แล้ว community เดิมๆ ผู้พัฒนาปลั๊กอินเดิมๆ ไม่เอาด้วย ก็แป๊กอยู่ดี

เข้าใจครับว่ามันคนละเรื่องกัน

เพียงแต่อ่านข่าวแล้วรู้สึกว่า ทำภาษาใหม่แล้วแปลงกลับมาเป็น JavaScript เพื่อให้พัฒนาโปรแกรมง่ายขึ้น
ก็เลยรู้สึกว่า Microsoft มีภาษาอยู่แล้วตั้งหลายภาษา ถ้าทำ Tool แปลงภาษาตระกูล .Net ให้เป็น Java Script น่าจะดีกว่าใหม เพราะ Dev จะได้ไม่ต้องเรียนรู้ภาษาใหม่

ผมคิดเล่นๆครับ ^^

มีวิธีทำอยู่นะครับแต่หลายขั้นตอนหน่อย คือเขียนโปรแกรมด้วยจาวาหรือภาษาตระกูลด็อทเน็ทแล้วคอมไพล์เป็นไบท์โค้ด เมื่อเสร็จแล้วแปลงไบท์โค้ดที่ได้เป็นซอสโค้ดของ c++ ด้วย xmlvm เสร็จแล้วคอมไพล์โค้ดภาษา c++ ด้วย Clang ให้เป็น LLVM bitcode เสร็จแล้วแปลงต่อด้วย Emscripten ตัวนี้มีหน้าที่แปลง LLVM bitcode เป็น javascript ครับ ....(ละมั้ง!)

tontpong Sun, 04/11/2012 - 04:18

typescript dogfooding by ms, in development of tfs .. http://blogs.msdn.com/b/bharry/archive/2012/10/24/typescript-a-real-world-story-of-adoption-in-tfs.aspx

ใครไม่รุจัก tfs ก้อลองแวะดูที่ http://tfs.visualstudio.com/ ละกัน (ตอนนี้มัน RTM แล้วด้วย ใช้กับงาน production ได้ละ ถ้าไม่เกิน 5 คน ใช้ได้ฟรี)