View previous topic :: View next topic |
Author |
Message |
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon May 31, 2004 6:44 pm Post subject: Mango Beta 7 |
|
|
... is released.
See the readme file for details, but the biggest change is the addition of that Log4J clone. |
|
Back to top |
|
|
Carlos
Joined: 19 Mar 2004 Posts: 396 Location: Canyon, TX
|
Posted: Sat Jun 05, 2004 9:12 pm Post subject: can't compile on linux |
|
|
did you test it on linux? because i can't compile mango there.
first, i get conflicting time_t's in mango.DateLayout and mango.Event, but they can be fixed (I fully qualified them: std.c.time.time_t).
but the worst is after that, when I get:
Code: | mango/io/FileBucket.d(272): Error: expected 1 arguments, not 0
mango/io/FileBucket.d(316): Error: expected 3 arguments, not 1
mango/io/FileBucket.d(316): cannot implicitly convert Buffer to int
|
|
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Jun 07, 2004 12:11 am Post subject: Re: can't compile on linux |
|
|
Carlos wrote: | did you test it on linux? because i can't compile mango there.
first, i get conflicting time_t's in mango.DateLayout and mango.Event, but they can be fixed (I fully qualified them: std.c.time.time_t).
but the worst is after that, when I get:
Code: | mango/io/FileBucket.d(272): Error: expected 1 arguments, not 0
mango/io/FileBucket.d(316): Error: expected 3 arguments, not 1
mango/io/FileBucket.d(316): cannot implicitly convert Buffer to int
|
|
Thanks Carlos.
I don't understand why the import std.c.time in both mango.log.DateLayout and mango.log.Event should conflict ... is there perhaps another time_t defined in std.c.stdio on linux? Because this problem wouldn't be isolated to mango ... any ideas?
The FileBucket issue bothers me a lot, since it appears the compiler has become confused over which method is being invoked. You see, line 272 and 316 refer to methods in the mango.io.Conduit baseclass, which are platform independent. Those error messages are just flat-out wrong ...
I'll get back to you tomorrow on this Carlos. |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu Jun 10, 2004 11:14 am Post subject: |
|
|
Sorry for the delay Carlos;
We got rid of the std.c.time error (two different linux header files declare time_t) and John has confirmed the error in FileBucket.d, which surely identifies a bug in the linux version of dmd.
I'm having difficulty thinking of a way to resolve this because (a) not having a linux box to work with myself, and (b) trying to narrow this down for Walter is likely to be awkward.
Any suggestions guys? |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu Jun 10, 2004 11:59 am Post subject: |
|
|
Some good news! John has figured out what the problem is
Stay tuned for the resolution ... |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu Jun 10, 2004 12:30 pm Post subject: |
|
|
Major kudos, and a very big thank-you, to John Reimer for resolving that! I'll let John describe the issue he uncovered.
There's a Beta_7b on the download page that fixes the problem. Alternatively, move the FileConduit.d "private import std.c.linux.linux" up to module scope instead of within the class body, or just get the latest FileConduit.d from SVN.
- Kris |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Thu Jun 10, 2004 2:55 pm Post subject: |
|
|
First, I apologize for not keeping up with DWT stuff. I've been preoccupied with some other more important issues of late...
Despite this, Kris somehow brought me out of my reveries and got me distracted on a Mango issue . I actually hadn't been reading any of these posts...
This was kind of a lucky find... but for those who are interested (and in case you run into the problem in some other project), here's what I found out.
I verified that the same errors were occuring on my Linux as mentioned above. After being stumped for a bit, I decided that there might be a name resolution problem going on. To test my guess, I forced the compiler to spit out more details for me.
dmd was complaining about file.close() not having enough arguments, so in order to see what arguments the compiler expected, I inserted first an integer:
file.close(1);
...no complaint from the compiler. I still wanted to see the compiler complain, so then I did...
file.close("a");
... and the compiler complained that expected an "int". So it seemed very sure of what it wanted. It seemed that the 3 arguments expected in bucket.file.read() also indicated the same issue.
So here I looked for anything that might cause the problem, any sort of close() and read() that might be getting in the way. I first looked in phobos and then I looked in std.c.linux.linux and found definitons that might just fit the problem: close(int) and read(int, void*, int) exactly fit the issue. After the fact, I noticed that a local import in the class body existed just above the use of these methods in FileConduit.d: private import std.c.linux.linux. The problem seemed pretty obvious to me, at this point.
So it appears D has issues with importing within a class body (something we found so useful in resolving many forward referencing issues). So watch out: local imports will override the name resolution for class methods if the imported functions match in the method name, regardless of whether the arguments and return types differ. Obviously the signatures are not significant here for name resolution. This is actually a frustrating problem in D.
Here's an example:
Code: |
class A {
void close() {}
void read( char[] t ) {}
}
class B : A {
private import std.c.linux.linux;
this() {
close();
read("a");
}
}
int main (char[][] args) {
B b = new B;
} |
DMD compiler will complain about the above code because the local import brings in a close() and read() that overrides the classes inherited methods.
Strange!
Later,
John |
|
Back to top |
|
|
brad Site Admin
Joined: 22 Feb 2004 Posts: 490 Location: Atlanta, GA USA
|
Posted: Thu Jun 17, 2004 11:25 pm Post subject: |
|
|
Found an issue while playing with my Baseball program.
/d/mango/trunk/mango/servlet/ServletProvider.d(343): cannot return value from void function
So I changed:
Code: | return response.sendError (HttpResponses.NotFound); |
to
Code: | response.sendError (HttpResponses.NotFound); |
_________________ I really like the vest! |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sun Jun 20, 2004 8:32 pm Post subject: |
|
|
brad wrote: | Found an issue while playing with my Baseball program.
/d/mango/trunk/mango/servlet/ServletProvider.d(343): cannot return value from void function
So I changed:
Code: | return response.sendError (HttpResponses.NotFound); |
to
Code: | response.sendError (HttpResponses.NotFound); |
|
You found the one place Mango took advantage of the latest DMD feature: return a value from a void function. You need to return at that point, so if the linux DMD doesn't support void returns (yet) then do a
Code: | if (pm is null)
{
response.sendError(...);
return;
} |
|
|
Back to top |
|
|
brad Site Admin
Joined: 22 Feb 2004 Posts: 490 Location: Atlanta, GA USA
|
Posted: Mon Jun 21, 2004 7:08 am Post subject: |
|
|
So I'll get off my lazy ass and upgrade DMD. _________________ I really like the vest! |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Mon Jun 21, 2004 1:16 pm Post subject: |
|
|
That sounds very odd. I don't understand this. How do you return a value from a void function? Or why would you want to do that? It was my impression that void was there for a reason: to indicate nothing was to be returned from a function. This must have been a new strange feature that I missed.... Was it discussed on the newsgroup?
In need of enlightenment,
John |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Jun 21, 2004 1:38 pm Post subject: |
|
|
JJR wrote: | That sounds very odd. I don't understand this. How do you return a value from a void function? Or why would you want to do that? It was my impression that void was there for a reason: to indicate nothing was to be returned from a function. This must have been a new strange feature that I missed.... Was it discussed on the newsgroup?
In need of enlightenment,
John |
Yeah, it does look a bit odd at first glance. Void return was added recently to support generics (via templates) such that you don't have to special-case void returns. It was on the NG, but I forget the title. In the case shown here I just happened to prefer the syntactical element of returning after registering an error, rather than splitting the code across multiple lines; just a personal aesthetic issue I have. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Jun 21, 2004 1:43 pm Post subject: |
|
|
JJR wrote: | Was it discussed on the newsgroup? | Yes, it was. See the thread that started with digitalmars.D:1790. (edited to correct link) |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Mon Jun 21, 2004 1:59 pm Post subject: |
|
|
Ah, I see now. Thanks for the link. Its use in generics now makes sense to me. All it's really doing is just returning void .
Funny how that works. For consistancy in a language, such a feature just makes sense.
Thanks guys,
John |
|
Back to top |
|
|
|