Ada-mode doesn’t like

package Buttons with Elaborate_Body is
end Buttons;

package body Buttons is
  protected Button
  is
     function Current_Index return Natural;
     procedure Handler;
  private
     Index : Natural := 0;
  end Button;

  protected body Button is
     function Current_Index return Natural is (Index);  -- <<<<<<<<
     procedure Handler is
     begin
        Index := (Index + 1) mod 42;
     end Handler;
  end Button;
end Buttons;

because the syntax follows the ARM in not allowing an expression function as 
the completion of a protected function.

GNAT does allow it (i.e. the code above compiles).

Following my posting on c.l.a., Randy copied to Ada-Comment, and there was 
agreement from Tucker Taft and Bob Duff that the omission was an oversight.

The attached patch brings ada-mode up to compatibility with GNAT (note that 
Randy suggested that null_procedure_declaration was also missing, but GNAT 
doesn’t allow it, and I don't think it has as much relevance? - but if the ARG 
agree it’s good and we wanted to allow it, the additional change is obvious).

—S

Attachment: protected-operation-item.diff
Description: Binary data

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to