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

Conversion Methodology

 
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
brad
Site Admin


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

PostPosted: Sun Feb 22, 2004 12:55 pm    Post subject: Conversion Methodology Reply with quote

Ant,

We welcome the help. John and I have sporadic time to work on it, and are using it to teach ourselves OO and D. We are by no means experts, so if we ever get anywhere with this, we are going to need some experts to get into our code and fix our bonehead mistakes. I realize that posting some of our progress may scare the hell out of some people who may want to use this lib in the future, but here goes:

<comments embedded>


Ant wrote:
> how it the SWT port going?

Ugh. John is tweaking the makefile to see if we can get around the forward references (remember those from your earlier posts with Lars?). I'm just trying to get the thing to compile with our Hello World app.

>
> I a week or two I'll finish a big project at work
> and take a few weeks (2003) vacations. I would like to help.

Sweet. Send me an email and I'll get you set up to check out the code from our Subversion server. There's also a forum up and running so we can keep track of our questions and not bother the NG here.

>
> Beside partial implementation of interfaces on abstract classes
> how did you solve the other java->D conversion problems:
>
> - How automatic did you made the conversion?

Beyond doing a find/replace for the following, the conversion has been totally manual:

boolean --> bit (could have used aliased bool)
String --> char[]
SWT --> DWT (mostly consts and exception names)
static {} --> commented out
instanceof --> marked with TODO: (John may have one of these done in point.d or rectangle.d somewhere, using typeof)
array initialization { } --> [ ]
listeners --> commented out, waiting for delegates
classes as structs --> kept them classes for now, but may convert later.

Also, I have only worked on the Win32 port, and we will have a bunch of work using the version() {} construct in D when it comes time to fold in linux (gtk+). John is working on linux some, and I know your preference. I just don't have access to a linux box right now...


> - library
> did you create a lib with String, Vector and other very common
> java classes (I would have done so, Walter expressed disagreement)

We did not choose to make libs/utils with common Java classes (String, Vector), but wanted to port to the D way (i.e. try to go with Walter's thoughts).


> and mostly I'm curious on how to you do the static initializations
> (I don't think is called static initialization, here is the example):
> class A
> {
> B b = new B(); // illigal in D (right?)
> public A()
> {
> //
> }
> }
>

Not sure what you're getting at here. Maybe you could look at the code when your project is done...


> Ant
>
>
_________________
I really like the vest!
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Mon Mar 01, 2004 1:32 pm    Post subject: Reply with quote

To those that have been paying attention to this:

I've done little work on DWT during the last week. The last thing I did was to rearrange my project files in eclipse slightly and test the subversion download on Windows. Unfortunately, in the process, I seem to have uploaded a version to the server too. Oops! That was last week. Hopefully it hasn't messed up the project setup for anyone. I've converted the makefile also so that there is now a Linux version. Basically I just had to change most of the '\' to '/'. I tested the makefile on Linux in eclipse and it got just as far as the windows version. So that's good.

My next step is to test putting some import statements within classes to see if I can get a little further than before. I know Brad tried it before, but I'll give it another try. It may eliminate a tolerable amount of forward references in the newer project modifications I made.

The other thing that I would like to do is perhaps set up some test cases for Walter to demonstrate the forward reference problem. It would just be so much easier if this issue could be somewhat resolved in the compiler.

I'm still trying to get familiar with subversion, so updates may not appear right away.

Later,
John
Back to top
View user's profile Send private message
brad
Site Admin


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

PostPosted: Mon Mar 01, 2004 10:12 pm    Post subject: Back from Vacation Reply with quote

Okay, I'm back from vacation, and will attempt to put some hours to DWT and the site as well. Your progress on the makefile sounds cool, as does the progress on linux. We'll need to do some work on the OS class for linux as I have not even begun to look at that.

btw, it snowed a total of 100 inches in Lake Tahoe the two days before we skiied. Nice...
_________________
I really like the vest!
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 Apr 06, 2004 4:42 pm    Post subject: Re: Conversion Methodology Reply with quote

brad wrote:

Beyond doing a find/replace for the following, the conversion has been totally manual:

boolean --> bit (could have used aliased bool)
String --> char[]
SWT --> DWT (mostly consts and exception names)
static {} --> commented out
instanceof --> marked with TODO: (John may have one of these done in point.d or rectangle.d somewhere, using typeof)
array initialization { } --> [ ]
listeners --> commented out, waiting for delegates
classes as structs --> kept them classes for now, but may convert later.
>


Steve talked me into using the "alias bool bit" for the boolean

I just recently saw where static {} blocks may now be working in D.

As for the instanceof tests in DWT, I think John started doing this, but I saw it again recently from Walter in the NG:

Java:

Code:

    if (a instanceof b)
    {    p = (b)a;
        ...
    }


D:
Code:

    p = cast(b) a;
    if (p)
    {
        ...
    }



So, Steve, where are you in regards to DWT? Did you make headway with SWT M8? Is there anything I can do to help? I'd like to get back to work on this...
_________________
I really like the vest!
Back to top
View user's profile Send private message
andy



Joined: 15 Mar 2004
Posts: 71

PostPosted: Wed Apr 07, 2004 12:05 am    Post subject: Reply with quote

Java's static { ... } block is equivalent to static this() { ... } in D, as I understand it.
_________________
"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