Print

Print


At 13:26 19-03-2004 -0800, Richard wrote:

>--On Friday, March 19, 2004 9:55 PM +0200 Jan van Oosterwijk
><[log in to unmask]> wrote:
>
> >     forall(i = 1:n-1, j = i:m-1)
>
> > I can't find a restriction in the standard that forbids this.

Thanks to all who responded (Richard, Dick, Malcolm).
I knew that the statement is illegal as it is.

But ... In the end it was just a typo I overlooked; what I meant was:

   forall(i = 1:n-1, j = 1:m-1)
                        ^^^

>Well, I don't see it forbidden in so many words, but it doesn't
>make sense and is thus indirectly forbidden by either of two
>things.  First, you are referencing an undefined variable
>(I isn't defined when you are needing it to be).  Second,
>the standard doesn't give an interpretation of what this
>would mean (and there's a very general statement that things
>that have no interpretation givven by the standard are
>illegal).
>
>Where are you expecting the value of i to come from for the
>j=i:m-1 part?  Presumably you expect it to be from the i index
>variable, but that doesn't have a defined value yet when you
>need it; it doesn't have a value until you are executing
>the body of the forall.
>
>See 7.5.4.2 of f95 (which is too long to quote in detail).
>In particular note that the determination of the values
>for the index name variables (all of them) is done *FIRST*.
>Then, it is only the forall body that is executed for each
>combination of the index values.  You don't do the determination
>of some of the index values for each of some of the other index
>values.
>
>I think what you basically have is "j=something_undefined:m-1".
>
>--
>Richard Maine                |  Good judgment comes from experience;
>[log in to unmask]       |  experience comes from bad judgment.
>                              |        -- Mark Twain


\---

Best regards,

Jan van Oosterwijk        |  "They that can give up essential liberty
Netherlands               |  to obtain a little temporary safety deserve
                           |  neither liberty nor safety."
                           |                -- Benjamin Franklin   (1759)

       write(*,*)transfer((/778985834,1869504886,1702130543,1785296754 &
          &,1635205227,1868849518,1819160175 /),(/'x'/)) ; end

  mailto:Jan<dot>vanOosterwijk<at>wanadoo<dot>NL
  http://huizen<dot>dto<dot>tudelft<dot>nl/vanOosterwijk/