Tags:
Dart

จากที่ กูเกิลเปิดตัวภาษา Dart ภาษาโปรแกรมชนิดใหม่สำหรับงานบนเว็บ โดยออกมาชนกับ JavaScript โดยตรง (ด้วยคุณสมบัติบางอย่างที่เหนือกว่า) ล่าสุดกูเกิลออก ตารางเปรียบเทียบโค้ด ของทั้งสองภาษานี้แล้ว

รายละเอียดของโค้ดค่อนข้างเยอะ ยกตัวอย่างบางส่วนนะครับ

  • ตัวแปรของ Dart สามารถกำหนดชนิดได้
  • ค่าตั้งต้นของตัวแปรจะเป็น null (ในขณะที่ JavaScript จะเป็น undefined)
  • กำหนด final variable ได้
  • Dart ใช้ List() แทน Array()
  • มีตัวแปรชนิด rawString (จะ escape character ให้เลย)
  • การประกาศฟังก์ชันไม่ต้องใช้คำว่า function
  • จงใจไม่มี eval()

ที่มา - Google Code Blog via Infoworld

Comments

By: iStyle
ContributorAndroidSymbianWindows
iStyle's blog
on 01/02/12 10:30 #379050 toggle
iStyle's picture

จะกลับเข้าสูตรเดิมของเกียร์มั้ยนะ? คือออกมาเพื่อผลักดันมาตรฐานเดิมเฉยๆ พอมาตรฐานเดิมมันดีขึ้นแล้วก็ยกเลิกของตัวเอง..


May the Force Close be with you.

By: tekkasit
ContributorAndroidWindowsIn Love
tekkasit's blog
on 01/02/12 10:45 #379059 Reply to:379050 toggle
tekkasit's picture

คือถ้ามาตรฐานใดๆ มันยังไม่มีสิ่งที่มาแก้ปัญหาของเราได้ ก็ต้องทำ interim solution ไปก่อน แต่ถ้าเมื่อใดที่มีมาตรฐานได้ การต้องดูแลโค้ดสองชุดที่ตอบสนองปัญหาเดียวกันก็นับว่าซ้ำซ้อนและไม่มีประสิทธิภาพ

ผมว่าต่อให้มันเป็นอย่างนั้นก็ดีกว่าสมัย Browser War อ่ะนะ

ปล. ก็ดีไม่ใช่หรือ นักพัฒนาจะได้มีงานทำ

By: rattananen
AndroidWindows
rattananen's blog
on 01/02/12 10:34 #379052 toggle
rattananen's picture

support all browser หรือ โลกนี้เหลือแต่ Chrome browser เมื่อไร เราคงได้เจอกัน


no system is safe.

By: polawing
polawing's blog
on 01/02/12 10:40 #379057 toggle
polawing's picture

งง ว่า เขาจะออกมาทำไม ถ้า มันไม่ support ทุก Browser แล้วใครจะใช้ได้ในวงกว้าง มันก็ใช้ได้ในวงแคบๆสิ

By: thedesp
WriteriPhoneAndroidUbuntu
thedesp's blog
on 01/02/12 10:52 #379064 Reply to:379057 toggle
thedesp's picture

ผมว่า Google กำลังพยายามทำวงแคบๆให้กว้างขึ้นด้วย Chrome

By: lew
FounderJusci's WriterMEconomicsAndroid
lew's blog
on 01/02/12 11:14 #379075 Reply to:379057 toggle
lew's picture

มันคอมไพล์เป็น JavaScript ได้ครับ

อีกอย่างคือมาตรฐานเว็บใหม่ๆ ล้วนแต่ถูกสร้างโดยเบราเซอร์แยกกันแทบทั้งสิ้นครับ ตัวอย่างที่ชัดคือ CSS round-corner ที่ทุกเบราเซอร์มีวิธีการประกาศของตัวเองและใช้ร่วมกันไม่ได้


LewCPE's Google+

By: toooooooon
iPhoneWindows PhoneAndroidBlackberry
toooooooon's blog
on 01/02/12 12:08 #379108 Reply to:379057 toggle
toooooooon's picture

นี่แหละครับ ปัญหา ของ Developer

ถ้าจะอิงทุกเบราเซอร์ต้องหาอะไรที่มันกลางๆที่สุด

By: LuvStry
ContributorAndroid
LuvStry's blog
on 01/02/12 12:29 #379115 Reply to:379108 toggle
LuvStry's picture

IE6

เงิบ


Blognone = 138.1 news/w เยอะมากๆ

By: kicub2
iPhoneWindows PhoneAndroidBlackberry
kicub2's blog
on 01/02/12 10:59 #379068 toggle
kicub2's picture

รอให้มี dQuery ก่อนแล้วจะมาใช้ละกัน 55

By: orpheous
UbuntuWindowsIn Love
orpheous's blog
on 01/02/12 11:30 #379089 Reply to:379068 toggle
orpheous's picture

55+

By: kurosame
ContributoriPhone
kurosame's blog
on 01/02/12 12:01 #379104 Reply to:379068 toggle
kurosame's picture

++1


เข้าท่ากับบ้าบอ

By: kobkrit
iPhoneAndroidSymbianUbuntu
kobkrit's blog
on 01/02/12 12:56 #379124 Reply to:379068 toggle
kobkrit's picture

dart มัน query ได้ด้วยตัวมันเองอยู่แล้่วนะ document.query('#main') แต่มันยาวจังอ่ะ อยากได้แค่เนี้ย $('#main')

By: rattananen
AndroidWindows
rattananen's blog
on 01/02/12 14:07 #379141 Reply to:379124 toggle
rattananen's picture

คุณก็เอา

$ = document.query;

ไปสิครับ


no system is safe.

By: sake
sake's blog
on 01/02/12 22:03 #379357 Reply to:379068 toggle
By: Jonix
iPhoneAndroidSymbianUbuntu
Jonix's blog
on 01/02/12 11:31 #379090 toggle
Jonix's picture

เกมบน Chrome กะ Google App ทั้งหลายเช่น Gmail คงจะทดลองใช้ Dart กันก่อน มีสิทธิ์เกิดหรือดับตาม Chrome แต่ว่าผมว่าเกิดนะ :)


http://www.embes.com

By: narasak
iPhoneAndroidUbuntu
narasak's blog
on 01/02/12 11:40 #379100 Reply to:379090 toggle
narasak's picture

ถ้าอยากให้เกิด กูเกิ้ลต้องใช้เป็นตัวอย่าง ในผลิตภัณฑ์หลักของตัวเอง

By: mementototem
ContributorJusci's WriterWindowsIn Love
mementototem's blog
on 01/02/12 11:39 #379096 toggle
mementototem's picture

ฟังชั่น loudify (JS) พารามิเตอร์เป็น msg แต่สั่ง size.toUpperCase(); ซะงั้น ; )


Jusci - Google Plus - Twitter - FSN

By: chatck
Symbian
chatck's blog
on 01/02/12 14:18 #379153 toggle
chatck's picture

Don't be eval() :P

By: Invisible Force
ContributoriPhoneAndroidUbuntu
Invisible Force's blog
on 01/02/12 14:19 #379154 toggle
Invisible Force's picture

ท่าจะยาก, น่าจะเน้นทาง native client มากกว่า .. ถ้าดีกว่า Javascript นิดๆหน่อยๆ ควรจะหันมาปรับปรุง Javascript เสียดีกว่า

By: Thaina
Windows
Thaina's blog
on 02/02/12 3:29 #379447 Reply to:379154 toggle
Thaina's picture

Dart มัน Interop กับ Browser อื่นได้น่ะสิครับ แต่ Native Client คือ ไม่มีวัน


My Blog

By: Invisible Force
ContributoriPhoneAndroidUbuntu
Invisible Force's blog
on 02/02/12 14:51 #379652 Reply to:379447 toggle
Invisible Force's picture

As of January 2012, Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari do not have plans to implement support for Dart.

By: Thaina
Windows
Thaina's blog
on 03/02/12 1:54 #379970 Reply to:379652 toggle
Thaina's picture

Dart มันคอมไพล์กลับให้เป็น JavaScript โดยที่ทำงานได้เหมือนเดิมหมดทุกอย่าง เข้าใจมั้ยครับว่าต่างกับ NaCl ยังไง ?


My Blog

By: rattananen
AndroidWindows
rattananen's blog
on 03/02/12 10:17 #380079 Reply to:379970 toggle
rattananen's picture

เข้าใจครับว่า NaCl มันเค็ม


no system is safe.

By: ipats
ContributorWindows PhoneAndroidExteen Official
ipats's blog
on 01/02/12 15:05 #379179 toggle
ipats's picture

บางฟีเจอร์นี่เจ๋งดีแฮะ เช่นพวก string interpolation เนี่ย


iPAtS

By: mr_tawan
ContributoriPhoneAndroidWindows
mr_tawan's blog
on 01/02/12 16:22 #379214 toggle
mr_tawan's picture

หรือว่าจริง ๆ เราควรดันให้ javascript เป็น type-aware (หรือ strong type ไปเลย) ดี :P


By: btoy
iPhoneAndroidWindows
btoy's blog
on 02/02/12 16:35 #379699 toggle
btoy's picture

อยู่นอกวงการจริงๆตู ห้า ห้า


..: เรื่อยไป