Ports and language interoperability · 3 Lessons
English

Open Agila: Architecture, Ada & V

Module 2 – Ports and language interoperability

Page 2 of 3 · About 15 minutes per lesson, including practice.

Prevent stale references after a port closes

15-minute session: read for 3 minutes, trace for 3, experiment for 7, and complete the check for 2. Spend longer whenever you need.

A slot alone is not enough to identify a port: it may be reused. The handle also contains a generation. Closing advances that generation; an old handle then fails validation. The model below uses the same eight-slot arithmetic. Generation exhaustion retires a slot instead of wrapping.

Your experiment

Use slot 7 and compare handles before and after close. Explain why creating a new Manager starts a new lifetime and cannot preserve old handles.

slots=8
slot=0
old=1*slots+slot
new=2*slots+slot
print(old,new)
print(old==new)

Expected result: 8 16 False

Practice and evidence

Keep three notes: your prediction, the actual result, and why they match or differ. The completion check grades understanding; the practice task builds skill.

Language reference

Example code on Agila Forge ↗

Complete this lesson

Answer every check correctly to earn your lesson certificate. Feedback helps you review and try again.

Sign in · Save your progress and earn a certificate for this lesson.