[ nice-Bugs-885149 ] compiler stack overflow - recursive params

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #885149, was opened at 2004-01-26 16:09
Message generated for change (Comment added) made by igouy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=885149&group_id=12788

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Isaac Gouy (igouy)
Assigned to: Nobody/Anonymous (nobody)
Summary: compiler stack overflow - recursive params

Initial Comment:
interface Ring < E | E <: Ring<E> > { 
   E zero();
}


I:\pls\Nice\polynomial>nicec --sourcepath .. -a t.jar 
polynomial
nice.lang: parsing
polynomial: parsing

An exception has occured in the compiler
Please fill-in a bug report at the following webpage:
http://sourceforge.net/tracker/?
func=add&group_id=12788&atid=112788

Stack trace:
Exception in thread "main" java.lang.StackOverflowError



Nice compiler version 0.9.6 prerelease (build 2004.01.26, 
15:04:20 UTC)

----------------------------------------------------------------------

>Comment By: Isaac Gouy (igouy)
Date: 2004-01-26 16:41

Message:
Logged In: YES 
user_id=536291

I found it curious that this will compile without complaint
   < E | E <: Ring<E> > interface Ring<E>  { }

but with a method declaration it fails?
   < E | E <: Ring<E> > interface Ring<E>  { 
      void zero();
   }


Happily I remembered something Arjan demonstrated, and 
wrote this:
   < E, ER | ER <: Ring<E> > interface Ring<ER>  { 
      ER zero();
   }

Of course, I really don't know what that's doing ;-)

>trying some F-bounded typed code 
Some Generic C#
You know me, fearlessly wandering into things I don't 
understand.

(I'll look at the Nice way later).

>academic paper on abstract interfaces 
I do read that sometimes, understanding is another matter ;-)



----------------------------------------------------------------------

Comment By: Daniel Bonniot (bonniot)
Date: 2004-01-26 16:24

Message:
Logged In: YES 
user_id=88952

Yes, I've know this behaviour for some time. The type is
incorrect (Ring has a type parameter), but the compiler does
not detect it and goes into an infinite recursion. It should
detect it more nicely, of course.

It seems like you are trying some F-bounded typed code from
somewhere. it would be interesting to know the precise
example, but a priori you should not need to go into such
convolutions in Nice :-)

What about:

   interface Ring {
    alike zero();
  }

which is syntactic sugar for:

  interface Ring {}
  <Ring T> T zero(T);

My academic paper on abstract interfaces (kinds) come come
handy, too.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=885149&group_id=12788


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.