FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Let's post here other encountered errors.

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT
View previous topic :: View next topic  
Author Message
Blandger



Joined: 21 May 2004
Posts: 50
Location: Ukraine, Kharkov

PostPosted: Sat Jul 03, 2004 2:27 pm    Post subject: Let's post here other encountered errors. Reply with quote

I suggest post here errors. We can collect and share typical Java to D conversion examples.

I was fixing classes then I started getting errors like this in the different classes.
Code:

dwt\graphics\color.d(33): import std conflicts with compatibility.std at dwt\internal\compatibility.d(34)
dwt\graphics\rgb.d(130): undefined identifier std


color.d (33) points to: private import std.string;
compatibility.d(34) : private import std.math;

If I comment 'private import std.string;' as line 33 in the color.d and make implicit call to 'std.string.toString(int)' error appears in the other place. I was fixing the error: "std conflicts with ...." but it's poping up again and again.

Finally I stuck with error:
Code:
dwt\graphics\color.d(328): undefined identifier std


I points to:
Code:

public char[] toString () {
   if (isDisposed()) return "Color {*DISPOSED*}";
-->>>char[] redColor = std.string.toString(getRed()); // line 328
   return "Color {" ~ redColor
   ~ ", " ~ std.string.toString(getGreen()) ~ ", "
   ~ std.string.toString(getBlue()) ~ "}";
}


Error:dwt\graphics\rgb.d(130) points to code:
Code:

public char[] toString () {
-->>   return "RGB {" ~ std.string.toString(red) ~ ", " // line 130
   ~ std.string.toString(green) ~ ", "
   ~ std.string.toString(blue) ~ "}";


I can't understand what's the problem I failed in. What do you think??
_________________
Regards, Yuriy
Back to top
View user's profile Send private message
Blandger



Joined: 21 May 2004
Posts: 50
Location: Ukraine, Kharkov

PostPosted: Sun Jul 04, 2004 4:20 am    Post subject: Re: Let's post here other encountered errors. Reply with quote

Blandger wrote:

Code:

dwt\graphics\color.d(33): import std conflicts with compatibility.std at dwt\internal\compatibility.d(34)

I can't understand what's the problem I failed in. What do you think??


A little addition to this error, for example:

dwt\graphics\rgb.d(33): import std conflicts with imageloader.std at dwt\graphics\imageloader.d(31)

I noticed this error usually points to two conflicting 'private import' statements. First is 'private import std.string;' as in rgb.d(33) and second is 'private import std.stream;' as in imageloader.d(31).

If I comment 'import std.string;' and write it fully qualified name in source code I'm getting error: "...: undefined identifier std"

I still don't understand it. Bit it seems to me it can go from the std.stream.Stream class. It's declared as:

Code:

class Stream : InputStream, OutputStream
...
{
  private import std.string, crc32, std.c.stdlib, std.c.stdio;
....


What do you think? Have somebody already encounterd this error? You might have met it.
_________________
Regards, Yuriy
Back to top
View user's profile Send private message
Blandger



Joined: 21 May 2004
Posts: 50
Location: Ukraine, Kharkov

PostPosted: Sun Jul 04, 2004 11:17 am    Post subject: Re: Let's post here other encountered errors. Reply with quote

Finally I found the reason. The matter is
there are a few classes which have a 'private import' statements outside the class body. The 'private imports' must be moved inside the class body for the one conflicting class from this pair (rgb.d or imageloader.d).
_________________
Regards, Yuriy
Back to top
View user's profile Send private message
Blandger



Joined: 21 May 2004
Posts: 50
Location: Ukraine, Kharkov

PostPosted: Mon Jul 05, 2004 3:03 pm    Post subject: Re: Let's post here other encountered errors. Reply with quote

I'm almost lost in this quantity of 'String' implementation and big lack of one full and consistent 'String' class for the DWT. Now we use four (or five) String (or it's equivalent) classes in all parts of DWT code.

Don't you think it's too much for the DWT?

There are:
1. char[] - which must be implemented for class.toString() as it's inherited from Object. Sad
2. wchar[] - for other 'Unicode' strings.
3. dwt.internal.win32.TCHAR - struct from the Windows
4. dwt.util.util.d (alias wchar[] String;) - I think must be avoided and removed from the code
5. dwt.util.string - String what I liked the most, but as I see it has three 'almost different' string types - String, WString, DString.

Trying to reconcile all this 'string types' makes DWT hardly compiled.

D is really needs one consistent String class/type. It must be universal as it's possible (as in Java) and it should have possibilities for conversion from the different 'base D type' - char[], wchar[], dchar[].

What do you think?
_________________
Regards, Yuriy
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Tue Jul 06, 2004 11:50 am    Post subject: Reply with quote

I have been using String as it is aliased to wchar[] for most of DWT.

The dwt.util.string is not used anywhere (to my knowledge).

char[] should be relpaced with String in most places. Also in use is the TCHAR, which internally uses the alias of String to wchar[].

It appears that we're not very consistent, but I think Andy did the right thing because String in Java is UTF-16, and that translates to wchar in D.

If we're not using dwt.util.string and any of the char[] we should take them out.

BA
_________________
I really like the vest!
Back to top
View user's profile Send private message
Blandger



Joined: 21 May 2004
Posts: 50
Location: Ukraine, Kharkov

PostPosted: Fri Jul 09, 2004 12:55 pm    Post subject: Reply with quote

brad wrote:
I have been using String as it is aliased to wchar[] for most of DWT.

Ok, but...

Quote:
The dwt.util.string is not used anywhere (to my knowledge).

Ops.. May be it was my initiative.

Quote:
char[] should be relpaced with String in most places.

Bad point. I came up to this thing in my local DWT:

ToStringTest.d
Code:

alias wchar[] String;
  public class ToStringTest {
    this() {
    }
    String toString() {
    }
  }

We have an error:
>dmd ToStringTest.d
ToStringTest.d(5): function toString overrides but is not covariant with toString

I think you see it's because of:
Code:

class Object
{
    void print();
    char[] toString();
......

Quote:
It appears that we're not very consistent,

A little bit.

Quote:
but I think Andy did the right thing because String in Java is UTF-16, and that translates to wchar in D.

Andy, what do you say about 'toString' error? How fix it?

Quote:
If we're not using dwt.util.string and any of the char[] we should take them out.

Suppose so.

PS.
Walter wrote a letter to me about subj "Re: Forward reference hell in the DWT. Obviously it's a bug." from NG.

Both problems with f.ref. in the 'simplified DWT' are fixed I checked it also. Now we can use Scons but as I see sometimes it gives different errors then 'makefile'.
_________________
Regards, Yuriy
Back to top
View user's profile Send private message
andy



Joined: 15 Mar 2004
Posts: 71

PostPosted: Sun Jul 25, 2004 10:43 am    Post subject: Reply with quote

ugh. Sorry I missed this. Smile

TCHAR, in SWT, is used as a general purpose string class, whatever char size the host platform is using. It's basically a char[]/wchar[] backing store, depending on the current configuration.

I kind of like this because it means that SWT can work with either ASCII or Unicode without a recompile.

Everything in D revolves around UTF-8 and char[], so it might be best to just use those everywhere. Fighting it is obviously more work than it's worth.
_________________
"Complacency is a far more dangerous attitude than outrage." - Naomi Littlebear
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group