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