Hi Manu,
I'm down to 1 compile-time error to fix, but it seems the compiler has saved the best (or worst) for last. The error is a VEVI, raised in class TEXT_PANEL. Here's what the compiler says:
VEVI: Variable is not properly set. Attribute(s): refresh_line_number_agent, update_scroll_agent
Error code: VEVI
Error: variable is not properly set.
What to do: ensure the variable is properly set by the corresponding
setter instruction.
Class: TEXT_PANEL
Feature: register_observers
Creation procedure: default_create declared in TEXT_PANEL
Attribute(s): refresh_line_number_agent, update_scroll_agent
Line: 185
do
-> text_displayed.add_lines_observer (Current)
text_displayed.add_edition_observer (Current)
The attributes in question are defined in TEXT_PANEL this way:
refresh_line_number_agent: PROCEDURE [ANY, TUPLE]
update_scroll_agent: PROCEDURE [like Current, TUPLE]
They're initialized to temporary values in "default_create"
default_create
-- Default creation
do
create widget
-- Initialize with unexecutable agent.
initialize
is_initialized := True
update_scroll_agent := agent do check False end end
refresh_line_number_agent := agent do check False end end
end
and set to useful values in "user_initialization", which is called by "initialize", in turn called in "default_create":
update_scroll_agent := agent update_scrollbars_display
refresh_line_number_agent := agent refresh_line_number_display
IOW, it appears to me that "update_scroll_agent" and "refresh_line_number_agent" are actually properly set twice during object creation: once in "default_create", and again for good measure and correctly in "user_initialization". Apparently the compiler however thinks otherwise.
(I should point out that I moved the call to "initialize" in "default_create" up from where it was originally, to correct a larger number of VEVI errors for other attributes that are also set in "user_initialization".)
I can fix this by making the attributes self-initializing
update_scroll_agent: PROCEDURE [like Current, TUPLE]
attribute
Result := agent do check False end end
end
but once I do, other attributes start appearing as VEVI errors, not properly set. I can fix all of them by making them self-initializing, but before I do I thought I'd ask you first.
I must not fully understand the rules for complete void safety involving agents.
So close, and yet so far ...