TAILIEUCHUNG - THE JR PROGRAMMING LANGUAGE phần 6

Báo cáo đầu vào hỗ trợ xử lý các trường hợp ngoại lệ trong một cách tương tự để hoạt động. Đối với mỗi hoạt động, năng lực phục vụ bởi một tuyên bố đầu vào, ném khoản phải liệt kê tất cả các trường hợp ngoại lệ có thể được ném ra từ cơ thể của lệnh hoạt động tương ứng. | 174 Exceptions clause. This requirement prevents attempts to propagate out of invocations of capabilities and operations exceptions not listed in the respective throws clauses. Input Statements Input statements now support exception handling in a manner similar to operations. For each operation or capability serviced by an input statement a throws clause must list all exceptions that may be thrown from the body of the respective operation command. For instance if the servicing code for an operation includes file I O then an lOException may be thrown. If this exception is propagated out of the body of the operation command then it must be included in the throws clause as demonstrated by the following code inni String readFilet throws lOException . 1 void writeFile string data throws lOException . The general form of the input statement discussed in Section now includes an optional throws clause as part of each operation command. An operation command now has the general form return-type op-expr .formal-list throws exception-list st synch-exprby sched-expr block The exceptions listed in the throws clause of an operation command must match those listed in the throws clause of the operation or capability specified by the op-expr of the operation command. An exception thrown from the body of an operation command is propagated except as discussed in Section back to the invoker. Such an exception is never propagated into the enclosing scope of the offending input statement. As such the enclosing scope does not require a catch clauses for the exceptions listed in the operation commands. Asynchronous Invocation The exception handling mechanisms provided by sequential programming languages rely upon the call chain for the propagation of exceptions. A thrown exception is propagated either implicitly or explicitly up the call chain until an appropriate handler is found. Figure depicts such a propagation in a parser program. Method read throws an .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.