What should the following method do?

        static def foo():int {
                return at (here.next()) {
                        return 0;
                };
        }

According to the language report it is fundamentally correct to put 
"return" into an at expression. However, the report also says

   Limitation: X10 does not currently allow break, continue, or return
   to exit from an at.

In my opinion, the X10 compiler should output a warning, that this is 
"not yet implemented" or something. The generated C++ code looks as 
intended, though.

Removing the first return, should still be correct code:

        static def foo():int {
                at (here.next()) {
                        return 0;
                };
        }

However, this results in the following (incorrect) errors.

Test.x10:4: Cannot return value from void method or closure.
Test.x10:4: Cannot return expression; base type incompatible with method 
return type.
         Expression: 0
         Base type: x10.lang.Int
         Expected base type: void
Test.x10:5: Unreachable statement.
3 errors.


-- 
Andreas Zwinkau

  Karlsruhe Institute of Technology (KIT)
  Institut für Programmstrukturen und Datenorganisation (IPD)
  Lehrstuhl Prof. Snelting
  Adenauerring 20a
  76131 Karlsruhe

  Phone:  +49 721 608 48351
  Fax:    +49 721 608 48457
  Email:  zwin...@kit.edu
  Web:    http://pp.info.uni-karlsruhe.de/person.php?id=107

  KIT – University of the State of Baden-Wuerttemberg and
  National Research Center of the Helmholtz Association

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a 
definitive record of customers, application performance, security 
threats, fraudulent activity and more. Splunk takes this data and makes 
sense of it. Business sense. IT sense. Common sense.. 
http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to