This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

NICE Language Committee: ms-multbranch

From Michael Schweitzer
Date: Sat, 16 Apr 94 15:10:53 +0200
To: bertrand@eiffel.com
Subject: MS-MULTI_BRANCH-SYNTAX
Cc: tynor@atlanta.twr.com
Content-Length: 2137
Status: RO
X-Lines: 85

-----------------------------------------------------------
Key   : MS-MULTI_BRANCH-SYNTAX
Title : Two proposals on the syntax of multi branch instructions.
-----------------------------------------------------------

As an exception to the general rule, I've bundeled two proposals
into one message, since they are closely related.

A)

Discussion:

The list of constants and/or intervals in the 'when' part
of an inspect instruction is optional, i.e. the instruction

            inspect i
                when then
                    something
                ...
            end

is legal.

Question:

Does this serve any useful purpose? As far as I know, ISE's
compiler rejects this as does our compiler.

Proposal A:

The syntax for 'Choices' should be changed to

        Choices = {Choice "," ...}+

i.e. there should be at least one 'Choice'.
-----------------------------------------------------------

B)

Discussion:

It is not allowed to use constant attributes in an interval,
since, for example, 'Integer_interval' is defined as

    Integer_interval = Integer_constant ".." Integer_constant

and 'Integer_constant' covers manifest constants of type INTEGER
only (pages 387, 568).

Therefore the instruction

            inspect i
                when Red .. Yellow then
                    something
                ...
            end

is syntactically illegal. Since Bertrand uses this (illegal)
form in ETL (page 265) I suppose he did not intend to re-
strict intervals to manifest constants only.

Proposal B:

I propose changing the syntax of 'Integer_interval' and
'Character_interval' as follows:

 Integer_interval   = Integer_inspect_constant ".."
                      Integer_inspect_constant

 Character_interval = Character_inspect_constant ".."
                      Character_inspect_constant

and

 Integer_inspect_constant   = Constant
 Character_inspect_constant = Constant

with the additional rule that an 'Integer_inspect_constant'
must be of type INTEGER, a 'Character_inspect_constant' of type
CHARACTER.
-----------------------------------------------------------

Best regards,
    Michael