It is too late to “chicken out” now (Lee Yee)
Pro-establishment camp keeps spreading news about postponement of the Legislative Council (LegCo) elections. Following Tam Yiuchung, Tong Kawah said the government could put the elections on hold for 14 days as many times as necessary. Tanya Chan pointed out that the government seems to intend extending the current LegCo session in view of the absence of gazetted announcement of when it will end.
Communist China and Hong Kong originally planned to threaten Hong Kong people with the National Security Law, then browbeat candidates into signing a confirmation in support of the law that is to be used as evidence to disqualify (DQ) the opposition faction from the elections. By doing so, they are to get the elections in the bag. However, to everyone’s surprise, the National Security Law has stirred up worldwide backlash, putting China under siege. Meanwhile, Hong Kong have not overawed, as evidenced by their will to resist demonstrated in the primary elections of pro-democracy camp, in which a large number of young pro-resistance hopefuls were elected. So long as the Carrie Lam regime massively disqualifies candidates, it will certainly give rise to an even fiercer global backlash. Providing that the anti-China measures escalate, neither will China be able to stay authoritative in front of its compatriots by showing the white feather, nor will it be courageous enough to wage a head-to-head battle.
It seems that the DQ strategy has been relinquished. Swift and decisive enforcement of the National Security Law was seen merely on the first day of its implementation. Since then, it has rarely been cited for law enforcement. Even though Communist China and Hong Kong stubbornly refuses to admit a fault, they are inarguably aware of having been a bit “cheeky”. Ditching the DQ strategy, they may suffer a crushing defeat in the elections. What should they do now? To counterplot, the epidemic could be a convenient pretext for putting off the elections.
Nonetheless, while the plight in which China is under siege by the world has gotten in shape, it is too late to “chicken out” . On July 21, Pompeo met with Nathan Law, an activist from Hong Kong. Law said to him that disqualifying candidates from elections amounts to a severe challenge to the values of democracy, calling on the international community to respond to it with a tough stance. So, even if the elections are put off, the U.S.’s sanctions will not be delayed.
On the same day, a fire outbreak broke the news to the world that the U.S. ordered closure of the Consulate General of the People's Republic of China(PRC) in Houston. The U.S. State Department said: The consulate was directed to close in order to protect American intellectual property and Americans' private information. China has been engaging in espionage and infiltration for decades, and in recent years, it has gone deeper and more extensive.
U.S. senator Marco Rubio said the Consulate General of the PRC in Houston is not a diplomatic unit , but the central point of China’s enormous operation network of espionage and infiltration, which should have been closed. Holding a concurrent post of the Deputy Chairman of the U.S. Senate Intelligence Committee, Rubio has access to the classified information of the U.S. Congress.
Gordon G. Chang, a prominent American academic, said the U.S. should direct the Consulate General of the PRC in New York to close as well for it is the core operation center of the CCP in eastern America.
Trump said yesterday there is a possibility that other consulates of China are ordered to close as well.
China indicated that “necessary reactions would be made”. According to Reuters, China is considering closing the Consulate General of the U.S. in Wuhan for retaliation. Global Times Editor in Chief Hu Xijin said “80%” of the Reuters’ coverage is “wrong”, being of the opinion that Beijing would highly likely adopt a tit-for-tat strategy to close the Consulate General of the United States in Hong Kong, which is as equally important as the one in Beijing, or expel half of the personnel from Hong Kong.
China had better ditch the rhetoric and do it fast. Although “80%” of Reuters’ coverage may be “wrong”, I’m afraid what is wrong is China dare not even close the Consulate General of the U.S. in Wuhan. The response yesterday of the spokesperson of the Ministry of Foreign Affairs of the PRC to closure of the Consulate General of the PRC in Houston was also empty rhetoric. And its reaction to the UK offering BNO holders right of abode in the UK was: “China will consider denying BNO passports as valid travel documents.” It is not only empty rhetoric, but literally moonshine.
Earlier on, Minister of Foreign Affairs of the PRC Wang Yi said in a forum held by China-U.S. Think Tanks that the Sino-U.S. relations should “activate and open conduits for dialogues” and “get back to the right track”. On July 21, being asked about the Sino-U.S. relations on CCTV, Cui Tiankai, the Ambassador of the PRC in the U.S., remarked: “It is necessary to activate and open conduits for dialogues. Now that there isn’t even a conversation, it should be deemed abnormal”. It has suggested that China craves reopening a dialogue with the U.S.. However, Trump openly said he did not want to talk to Xi Jinping. The U.S. has already turned a deaf ear to China.
The Hong Kong version of National Security Law certainly plays a major role in contributing to the current predicament. The law has shown to the international community China would not live up to any promise. When the basic trust is gone, the basis for a dialogue is gone. Action is way more down-to-earth than rhetoric!
同時也有3部Youtube影片,追蹤數超過17萬的網紅魏巍,也在其Youtube影片中提到,記錄自己學習Android 的過程。會錄下短片是期待透過觀眾的監督,我可以有動力持續學下去。今天的進度,是學習 Kotlin 語言的lambda。一句話做總結,Lambda 就是 Swift 的 Closure ~。...
「closure swift」的推薦目錄:
- 關於closure swift 在 李怡 Facebook 的最佳貼文
- 關於closure swift 在 โปรแกรมเมอร์ไทย Thai programmer Facebook 的精選貼文
- 關於closure swift 在 Michelle Lee Facebook 的精選貼文
- 關於closure swift 在 魏巍 Youtube 的最佳貼文
- 關於closure swift 在 魏巍 Youtube 的最佳貼文
- 關於closure swift 在 魏巍 Youtube 的最佳貼文
- 關於closure swift 在 Multiple Trailing Closures - apple/swift-evolution · GitHub 的評價
- 關於closure swift 在 Why is Swift @escaping closure not working? - Stack Overflow 的評價
- 關於closure swift 在 Part 1 (語法與化簡) 的評價
- 關於closure swift 在 愛瘋一切為蘋果的彼得潘iOS Swift App 程式設計 - Facebook 的評價
closure swift 在 โปรแกรมเมอร์ไทย Thai programmer Facebook 的精選貼文
Functional programming ชื่อไทยคือ “การโปรแกรมเชิงฟังก์ชั่น” ชื่อย่อ FP เป็นแนวคิดหนึ่งของการเขียนโปรแกรม (programming paradigm) ชื่อขึ้นต้นด้วย functional แต่ไม่ได้มีดีแค่ประกาศ function ปุ๊บเสร็จ แล้วเรียกใช้ มันมีเบื้องลึกมากกว่านั้นแน่ๆ
🤔 มันจะต่างจากการเขียนโปรแกรมทีละสเตป ตามลำดับก่อนหลัง มีการวนลูป ที่เน้นแก้ state ของโปรแกรมเป็นหลัก
แต่แนวทาง functional programming จะไม่แก้ state ของโปรแกรมเลย ไม่มีการวนลูบ (ใช้ recursion แทน)
ซึ่งแนวคิดก็ต้องเน้นสร้างฟังก์ชั่นนั่นแหละ แต่หลักสำคัญต้องออกแบบให้หลีกเลี่ยง side-effect (ผลข้างเคียง) ที่จะเกิดต่อ function ตัวเอง และตัวอื่น โดยมีหลักยึด 2 อย่างใหญ่คือ
👉 1) function ที่สร้างขึ้นมา เมื่อมีอินพุตค่าเดิมส่งไปหา (เป็นค่าอากิวเมนต์) ไม่ว่าจะกี่ครั้งก็ตาม function จะรีเทิร์นค่าออกมาเหมือนเดิมทุกครั้ง ...(ไอเดียมาจากฟังก์ชั่นในทางคณิตศาสตร์เลยครับ)
เช่น
func(1); // เรียกครั้งที่ 1 ก็จะได้ค่ารีเทิร์นออกมาเป็น 30
func(1); // เรียกครั้งที่ 2 ก็จะได้ค่ารีเทิร์นออกมาเป็น 30 เหมือนเดิม
func(1); // เรียกครั้งที่ 3 ก็จะได้ค่ารีเทิร์นออกมาเป็น 30 เหมือนเดิม
👉 2) function ต้องไม่ไปเปลี่ยนแปลงค่าของตัวแปรจำพวก global variable หรือ static variable หรือตัวแปรที่อยู่ข้างนอก function ...เพื่อไม่ให้ function อื่นได้รับผลกระทบ
ถ้า function ที่เราประกาศไว้ มีคุณสมบัติ 2 อย่างที่ว่านี้ ก็จะเรียกว่า pure function (ฟังก์ชั่นบริสุทธ์แท้ๆ) 👌
สำหรับอีกคุณลักษณะหนึ่งที่จะไม่กล่าวถึงไม่ได้เลยก็คือ
👉 3) First-class function และ Higher-order function
คำว่า first-class function มาจาก "first class citizen" ที่หมายถึง "พลเมืองชั้นหนึ่ง" ดังนั้น first-class function จะหมายถึง ฟังก์ชั่นเป็นพลเมืองชั้นหนึ่งจริงๆ เลยนะ
คุณสมบัตินี้ function จะถูกมองเป็นข้อมูลประเภทหนึ่ง ไม่ต่างจากข้อมูลตัวเลข สตริง บูลีน ด้วยเหตุนี้จึงสามารถนำ function ไปกำหนดค่าให้กับตัวแปรยังได้เลย เช่น
x = function(){ .....}
ส่วนคุณสมบัติ Higher-order function:
คุณสมบัตินี้หมายถึง เราสามารถใช้ function ส่งไปเป็นค่าอากิวเมนต์แก่ function ตัวอื่น หรือ function จะรีเทิร์นออกมาจาก function ตัวอื่นออกมาก็ได้ด้วย เช่น
- ส่ง function_A เป็นค่าอากิวเมนต์ไปให้ function_X(function_A);
- จากนั้น function_X() ก็จะสร้าง function_Y แล้วรีเทิร์นมันออกมาได้
😜 ===ประโยชน์ functional programming===
🔥 เอาไปเขียนโปรแกรมโดยไม่มีการวนลูป เช่น ไม่ต้องมานั่งเขียน for … หรือ while… วนลูป เพื่อเข้าถึงข้อมูลโครงสร้างพวก array , list ฯลฯ เป็นต้น
🔥 การทำ currying หมายถึงทำให้ฟังก์ชั่น จากเดิมที่มี parameter หลายตัวให้เหลือแค่ตัวเดียว ด้วยการส่งผลลัพธ์เป็น function ที่รับ Parameter ที่เหลือ ...ใช้เทคนิค closure
🔥 หรือจะทำ function Composition (เอาฟังก์ชั่นมาประกอบกัน)
🔥 หรือจะเอาไปใช้เขียนโปรแกรมแบบ parallel computing (โปรแกรมคู่ขนาน)
🔥 หรือจะเขียนโปรแกรมแบบ asynchronous โดยที่โค้ดหลักไม่ต้องรอการประมวลผลฝั่ง I/O ให้แล้วเสร็จ โค้ดหลักสามารถข้ามไปยังบรรทัดถัดไปก่อนได้เลย
🔥 Testability — ผลพลอยได้ก็คือ เอาแนวคิดนี้ไปใช้ทำ test function ได้ง่าย โดยแต่ละการ test จะเป็นอิสระต่อกัน เมื่อใช้วิธีการเดิมในการทดสอบ 10 ครั้ง ก็ควรได้ผลเหมือนเดิม 10 ครั้ง เป็นต้น
++++ 🤔 ++++++
เมื่อเปรียบเทียบกับแนวคิด OOP (โปรแกรมเชิงวัตถุ object-oriented programming)
ถ้าโจทย์ปัญหาเป็น parallel computing หรือ asynchronous การใช้แนวคิด functional programming ดูแล้วคล่องแคล่วปราดเปรียวไม่ยุ่งยาก
เนื่องจากแนวคิด functional programming ไม่มีอะไรซับซ้อนมากนัก เขียนโปรแกรมก็จะกระชับ ง่าย...ง๊าย เมื่อเทียบกับ OOP ที่โค้ดจะเยอะกว่า เพราะมี class มากมาย ยิ่งถ้า inheritance โดยให้มีการสืบทอดสมาชิกหลายชั้น ก็จะสับสนตาลาย มึนงงได้ คงต้องพึ่ง IDE ให้เป็นพี่เลี้ยงช่วยแนะนำว่ามีสมาชิกอะไรที่สืบทอดมา
แต่จุดเด่นเรื่อง OOP จะมีความเป็น Modularity ที่สูง โค้ดที่เขียนเป็นอ็อบเจ็กต์แต่ละตัวจะเป็นอิสระต่อกัน เนื่องจากข้อมูลหรือ state ซึ่งอยู่ภายในตัวอ็อบเจ็กต์เอง จะมีเป็นของใครของมัน ขณะเดียวกันแต่ละอ็อบเจ็กต์จะปฏิสัมพันธ์กันได้ สามารถเอาอ็อบเจ็กต์ที่มีอยู่แล้วมา reuse ใช้ได้ง่าย รวมทั้งถอดเข้าถอดออกขณะโปรแกรม run time
แล้วแต่สถานการณ์ว่าจะใช้แนวทางเขียนโปรแกรมแบบไหน
แต่ก็ยอมรับว่าบางทีเขียนแบบ functional programming ก็ยากต่อการทำความเข้าใจ เพราะโค้ดมันสั้นกระชับเกิ๊น
ยิ่งหลายภาษาโปรแกรมมิ่งสมัยใหม่ในปัจจุบันนี้ มีการแทรกแนวคิด functional programming เข้ามา นอกเหนือจากแนวคิด OOP เช่น JavaScript, Python, Java, C#, Swift, Kotlin แต่ก็อาจประยุกต์แนวคิดนี้ได้ไม่ 100% มากนัก
จะไม่เหมือนบ้างภาษาเช่น Haskell ที่มาพร้อมกับ immutable data structure หมายถึงข้อมูลที่ไม่สามารถแก้ไขค่าได้เลย จึงทำให้ function กลายเป็น functional programming แท้ๆ (pure function)
✍ สรุป แนวคิดนี้ไม่ได้เรื่องใหม่มีมานานก่อนบางคน ...อุ้แว ...อุ้แวเกิดเสียอีก แต่ตอนโน่นแนวคิดนี้ยังไม่ดังเปรี้ยงเหมือน OOP คนที่เขียนภาษา JavaScript รวมไปถึง Node.js ย่อมใช้หลักการนี้อย่างไม่รู้ตัว ยิ่งภาษาสมัยใหม่หลายตัวก็ยอมรับแนวคิด functional programming เข้ามาในภาษาเรียบร้อยแล้ว ไม่มีนี้ถือว่าแปลกมาก
--------
เขียนโดย โปรแกรมเมอร์ไทย thai programmer
closure swift 在 Michelle Lee Facebook 的精選貼文
BREAKING NEWS!
Chelsea winger Callum Hudson-Odoi becomes the first Premier League player to be tested positive for COVID-19.
🏥🏥🏥
Chelsea FC training facility will undergo partial closure as a precautionary step in line with the UK government's guidelines.
😷😷😷
We wish him a speedy recovery and hope for a swift resolution to this pandemic.
closure swift 在 魏巍 Youtube 的最佳貼文
記錄自己學習Android 的過程。會錄下短片是期待透過觀眾的監督,我可以有動力持續學下去。今天的進度,是學習 Kotlin 語言的lambda。一句話做總結,Lambda 就是 Swift 的 Closure ~。

closure swift 在 魏巍 Youtube 的最佳貼文
練習 Swift 語言中陣列的 reduce 方法。雖然現在弄懂了,可是我猜一段時間就會忘記,所以把現在知道的錄影錄下來教之後的自己...

closure swift 在 魏巍 Youtube 的最佳貼文
最完整的中文 iPhone 開發線上課程:
https://www.udemy.com/swift3-level1
(本短片為其中的一堂課程)

closure swift 在 Part 1 (語法與化簡) 的推薦與評價
Closures are self-contained blocks of functionality that can be passed ... Swift Programming Guide Closure 簡單來說就是匿名的function, ... ... <看更多>
closure swift 在 Multiple Trailing Closures - apple/swift-evolution · GitHub 的推薦與評價
Since its inception, Swift has supported trailing closure syntax: a bit of syntactic sugar that lets you "pop" the final argument to a function out of the ... ... <看更多>