[ nice-Bugs-969777 ] Creating a closure in a custom constructor
"SourceForge.net" <[email protected]> Thu, 10 Jun 2004 22:02:40 -0700
| Newsgroups | gmane.comp.lang.nice.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #969777, was opened at 2004-06-09 19:22
Message generated for change (Comment added) made by bonniot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=969777&group_id=12788
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Bryn Keller (xoltar)
Assigned to: Daniel Bonniot (bonniot)
Summary: Creating a closure in a custom constructor
Initial Comment:
C:\src\nice>nicec --version
Nice compiler version 0.9.8 prerelease (build
2004.05.28, 18:05:16 UTC)
Compiled using JDK 1.4.2
Copyright (C) 2003 Daniel Bonniot
Visit the Nice homepage: http://nice.sourceforge.net
import java.awt.*;
class Square extends Polygon {
int x() = this.getBounds().x;
int y() = this.getBounds().y;
}
<T,U> T fst((T,U) tup) {
(T t,U u) = tup;
return t;
}
<T,U> U snd((T,U) tup) {
(T t, U u) = tup;
return u;
}
new Square(int x, int y, int width) {
let points = [(0,0), (0,1), (1,1), (1,0)];
this(points.map(fst), points.map(snd), points.length);
}
void main(String[] args) {
}
Compiles, but fails at runtime:
C:\src\nice>java -jar test.jar
Exception in thread "main" java.lang.VerifyError:
(class: test/fun, method: x signature:
(Ltest/Square;)I) Incompatible object argument for
function call
at test.dispatch.main(dispatch.nice)
----------------------------------------------------------------------
Comment By: Daniel Bonniot (bonniot)
Date: 2004-06-11 07:02
Message:
Logged In: YES
user_id=88952
This bug has been fixed. The next release of the compiler will
include this correction. In the mean time, I encourage you try
the development version. It contains a version of the compiler
that fixes the bug. Please try it and reopen the bug-report if
you find any problem with it.
To know how to get an install the development version of the
compiler that fixes this bug, please read
http://nice.sourceforge.net/cgi-bin/twiki/view/Dev/DevelopmentVersion
Note that the bug has first been fixed in the CVS version, and it
might take one or two hours until the development version
includes the fix.
Thanks again for your help by submiting this bug report.
Daniel Bonniot
----------------------------------------------------------------------
Comment By: Daniel Bonniot (bonniot)
Date: 2004-06-10 16:04
Message:
Logged In: YES
user_id=88952
This error arises when creating a closure inside a custom
constructor (or an instance initializer). I'll fix it.
If you need a workaround in the mean time, call a regular
method from the custom constructor to do the job.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=969777&group_id=12788
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504