www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - is dwt alive?

reply theambient <tiabaldu gmail.com> writes:
is dwt alive?
May 10 2010
next sibling parent Jacob Carlborg <doob me.com> writes:
On 5/11/10 00:35, theambient wrote:
 is dwt alive?

I'm updating dwt-mac to 3.5.1 but the progress is slow (working on other things). It was a long time since I uploaded any changes. I have no plans on abandoning dwt, don't know about Frank, his last update was six month ago.
May 10 2010
prev sibling next sibling parent reply torhu <no spam.invalid> writes:
On 11.05.2010 00:35, theambient wrote:
 is dwt alive?

Not much happening lately, but I'm still using it. I'm using dwt-win, and dwt2 on windows, and just started using dwt-linux. I've been trying to keep the Windows versions up to date with Tango and DMD. At the moment I'm debugging a crashing bug with virtual tables in dwt-linux. I haven't got a proper debugging setup on linux, so I could use a hand with debugging. Printf debugging takes forever. I have narrowed it down to a 50-line test case if anyone wants to have a go. ;)
May 10 2010
parent reply Jacob Carlborg <doob me.com> writes:
On 5/11/10 04:01, torhu wrote:
 On 11.05.2010 00:35, theambient wrote:
 is dwt alive?

Not much happening lately, but I'm still using it. I'm using dwt-win, and dwt2 on windows, and just started using dwt-linux. I've been trying to keep the Windows versions up to date with Tango and DMD. At the moment I'm debugging a crashing bug with virtual tables in dwt-linux. I haven't got a proper debugging setup on linux, so I could use a hand with debugging. Printf debugging takes forever. I have narrowed it down to a 50-line test case if anyone wants to have a go. ;)

Do you have this problem on linux only? Post it here and I can have a look.
May 11 2010
parent reply torhu <no spam.invalid> writes:
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 11.05.2010 13:12, Jacob Carlborg wrote:
 Do you have this problem on linux only? Post it here and I can have a look.

Yes, it works as expected on Windows. I've attached the files, versions both for dwt-linux and dwt2. Somehow the SetData event ends up in the wrong table widget. If you remove the second table, it works just fine.
May 11 2010
parent reply Jacob Carlborg <doob me.com> writes:
On 5/11/10 21:33, torhu wrote:
 On 11.05.2010 13:12, Jacob Carlborg wrote:
 Do you have this problem on linux only? Post it here and I can have a
 look.

Yes, it works as expected on Windows. I've attached the files, versions both for dwt-linux and dwt2. Somehow the SetData event ends up in the wrong table widget. If you remove the second table, it works just fine.

I forgot that I don't have access to a computer running linux and X. I can perhaps install it on some computer or run it through a virtual machine.
May 16 2010
parent torhu <no spam.invalid> writes:
On 16.05.2010 22:15, Jacob Carlborg wrote:
 On 5/11/10 21:33, torhu wrote:
  On 11.05.2010 13:12, Jacob Carlborg wrote:
  Do you have this problem on linux only? Post it here and I can have a
  look.

Yes, it works as expected on Windows. I've attached the files, versions both for dwt-linux and dwt2. Somehow the SetData event ends up in the wrong table widget. If you remove the second table, it works just fine.

I forgot that I don't have access to a computer running linux and X. I can perhaps install it on some computer or run it through a virtual machine.

I've figured out that the CallbackData object that Display.cellDataProcFunc receives is the wrong one. It's one of those handed to gtk by Display.addWidget, but for the first Table instead of the second one. This is what happens, it's all wrong after the setItemCount call: tor tor-ubuntu:~/dev/test$ ./build-debug.sh && ./setdatabug Display.addWidget(b6d13d00) handle = 9b86048 index = 5 Display.addWidget(b6d13d00) handle = 9aa6a00 index = 6 Display.addWidget(b6d13d00) handle = 9a7a360 index = 7 Display.addWidget(b6d13d00) handle = 9b81800 index = 8 Left table address: b6d13d00 Display.addWidget(b6d13c00) handle = 9b86218 index = 13 Display.addWidget(b6d13c00) handle = 9aa68e0 index = 14 Display.addWidget(b6d13c00) handle = 9a7a4c8 index = 15 Display.addWidget(b6d13c00) handle = 9a93ce0 index = 16 Right table address: b6d13c00 setItemCount(5) for b6d13d00 Display.cellDataProcFunc with data pointer 9b86218 <-- WRONG HANDLE Display.cellDataProc for widget b6d13c00 cellDataProc for b6d13c00 Table.checkData sending SetData event for b6d13c00 BAD: right table's SetData listener called
May 24 2010
prev sibling parent reply torhu <no spam.invalid> writes:
On 11.05.2010 00:35, theambient wrote:
 is dwt alive?

I just uploaded a patch that updates dwt-linux to Tango 0.99.9 and DMD 1.060. http://www.dsource.org/projects/dwt-linux/ticket/13
May 15 2010
next sibling parent reply Mengu <mengukagan gmail.com> writes:
will dwt support phobos in near future?
Jun 20 2010
parent reply Jacob Carlborg <doob me.com> writes:
On 2010-06-20 17:27, Mengu wrote:
 will dwt support phobos in near future?

DWT2 is a work in progress on supporting both tango and D2 (phobos) -- /Jacob Carlborg
Jun 21 2010
parent reply torhu <no spam.invalid> writes:
On 21.06.2010 10:57, Jacob Carlborg wrote:
 On 2010-06-20 17:27, Mengu wrote:
  will dwt support phobos in near future?

DWT2 is a work in progress on supporting both tango and D2 (phobos)

I've got a small example running (Display, Shell and Combo) in D2. There are some things that need to be decided, like what the String alias should be. Would be nice if could be a Phobos string, ie. immutable(char)[]. That seems to work so far, and is a better match for the Java string semantics that DWT have inherited. DMD 2's stricter conversion rules have actually caught some bugs in DWT. In some places, a wchar is implicitly converted to a char, which is not allowed in D 2. It would be great if DMD 1.x would accept the __gshared keyword, though. It sucks to have to use string mixins or static this to work around that.
Jun 21 2010
parent reply Jacob Carlborg <doob me.com> writes:
On 2010-06-21 22:46, torhu wrote:
 On 21.06.2010 10:57, Jacob Carlborg wrote:
 On 2010-06-20 17:27, Mengu wrote:
 will dwt support phobos in near future?

DWT2 is a work in progress on supporting both tango and D2 (phobos)

I've got a small example running (Display, Shell and Combo) in D2. There are some things that need to be decided, like what the String alias should be. Would be nice if could be a Phobos string, ie. immutable(char)[]. That seems to work so far, and is a better match for the Java string semantics that DWT have inherited. DMD 2's stricter conversion rules have actually caught some bugs in DWT. In some places, a wchar is implicitly converted to a char, which is not allowed in D 2. It would be great if DMD 1.x would accept the __gshared keyword, though. It sucks to have to use string mixins or static this to work around that.

I guess we have to look at all these D2 things. I haven't done any dwt development lately, haven't had time, which I don't like. -- /Jacob Carlborg
Jun 21 2010
parent reply torhu <no spam.invalid> writes:
On 2010-06-21 22:46, torhu wrote:
 On 21.06.2010 10:57, Jacob Carlborg wrote:
 I've got a small example running (Display, Shell and Combo) in D2. There
 are some things that need to be decided, like what the String alias
 should be. Would be nice if could be a Phobos string, ie.
 immutable(char)[]. That seems to work so far, and is a better match for
 the Java string semantics that DWT have inherited.

 DMD 2's stricter conversion rules have actually caught some bugs in DWT.
 In some places, a wchar is implicitly converted to a char, which is not
 allowed in D 2.

 It would be great if DMD 1.x would accept the __gshared keyword, though.
 It sucks to have to use string mixins or static this to work around that.

I guess we have to look at all these D2 things. I haven't done any dwt development lately, haven't had time, which I don't like.

I'm considering creating at least a a temporary fork of DWT 2 on bitbucket.org. Then I can just check in some stuff and see how it turns out. It's possible that I'll have time to do some work on it this summer, but that might change quickly...
Jun 21 2010
parent reply Jacob Carlborg <doob me.com> writes:
On 2010-06-22 01:40, torhu wrote:
 On 2010-06-21 22:46, torhu wrote:
 On 21.06.2010 10:57, Jacob Carlborg wrote:
 I've got a small example running (Display, Shell and Combo) in D2. There
 are some things that need to be decided, like what the String alias
 should be. Would be nice if could be a Phobos string, ie.
 immutable(char)[]. That seems to work so far, and is a better match for
 the Java string semantics that DWT have inherited.

 DMD 2's stricter conversion rules have actually caught some bugs in DWT.
 In some places, a wchar is implicitly converted to a char, which is not
 allowed in D 2.

 It would be great if DMD 1.x would accept the __gshared keyword, though.
 It sucks to have to use string mixins or static this to work around
 that.

I guess we have to look at all these D2 things. I haven't done any dwt development lately, haven't had time, which I don't like.

I'm considering creating at least a a temporary fork of DWT 2 on bitbucket.org. Then I can just check in some stuff and see how it turns out. It's possible that I'll have time to do some work on it this summer, but that might change quickly...

You can see if Frank can give you access to the repository, try sending him an e-mail. I know we can use some more people on this project. I don't even know if I have commit access to the DWT2 repository, what I do know is that I have at least access to the dwt-mac repository. -- /Jacob Carlborg
Jun 22 2010
parent reply torhu <no spam.invalid> writes:
On 22.06.2010 14:49, Jacob Carlborg wrote:
 On 2010-06-22 01:40, torhu wrote:

  I'm considering creating at least a a temporary fork of DWT 2 on
  bitbucket.org. Then I can just check in some stuff and see how it turns
  out. It's possible that I'll have time to do some work on it this
  summer, but that might change quickly...

You can see if Frank can give you access to the repository, try sending him an e-mail. I know we can use some more people on this project. I don't even know if I have commit access to the DWT2 repository, what I do know is that I have at least access to the dwt-mac repository.

I've set up my own project on Bitbucket. I've made enough changes to build my DWT app on Windows, and it's works like a charm. A lot of the Phobos code was already there, and I've added what was needed for my use. Since DWT enforces that all GUI code is run in the same thread (usually the main thread), I didn't need to add shared and __gshared that many places. I had to add a lot of casts because D2 compilers are stricter about narrowing conversions. In some places Java's char type was kept as char, and not changed into wchar. I've changed the ones I came across to wchar, to avoid truncating code points that are outside of ASCII. Some conversions between char[] and wchar had to be added. The String alias is D2 string, which works just fine. http://bitbucket.org/torhus/dwt2
Jul 11 2010
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2010-07-11 19.09, torhu wrote:
 On 22.06.2010 14:49, Jacob Carlborg wrote:
 On 2010-06-22 01:40, torhu wrote:

 I'm considering creating at least a a temporary fork of DWT 2 on
 bitbucket.org. Then I can just check in some stuff and see how it turns
 out. It's possible that I'll have time to do some work on it this
 summer, but that might change quickly...

You can see if Frank can give you access to the repository, try sending him an e-mail. I know we can use some more people on this project. I don't even know if I have commit access to the DWT2 repository, what I do know is that I have at least access to the dwt-mac repository.

I've set up my own project on Bitbucket. I've made enough changes to build my DWT app on Windows, and it's works like a charm. A lot of the Phobos code was already there, and I've added what was needed for my use. Since DWT enforces that all GUI code is run in the same thread (usually the main thread), I didn't need to add shared and __gshared that many places. I had to add a lot of casts because D2 compilers are stricter about narrowing conversions. In some places Java's char type was kept as char, and not changed into wchar. I've changed the ones I came across to wchar, to avoid truncating code points that are outside of ASCII. Some conversions between char[] and wchar had to be added. The String alias is D2 string, which works just fine. http://bitbucket.org/torhus/dwt2

So this is working with D2? If that's the case then it's great news. I've also found two other guys who want to work on DWT2 so this is starting to look pretty promising. Are your fork windows only? Have you looked anything on the linux port? I'll try to have a look at your branch and see if I can merge it with the main branch. I'm also thinking that we may need to organize our self a bit so we don't work on the same things. -- Jacob Carlborg
Jul 11 2010
parent reply torhu <no spam.invalid> writes:
On 11.07.2010 20:30, Jacob Carlborg wrote:
 On 2010-07-11 19.09, torhu wrote:
  On 22.06.2010 14:49, Jacob Carlborg wrote:
  On 2010-06-22 01:40, torhu wrote:



  I've set up my own project on Bitbucket. I've made enough changes to
  build my DWT app on Windows, and it's works like a charm. A lot of the
  Phobos code was already there, and I've added what was needed for my
  use. Since DWT enforces that all GUI code is run in the same thread
  (usually the main thread), I didn't need to add shared and __gshared
  that many places.

  I had to add a lot of casts because D2 compilers are stricter about
  narrowing conversions. In some places Java's char type was kept as char,
  and not changed into wchar. I've changed the ones I came across to
  wchar, to avoid truncating code points that are outside of ASCII. Some
  conversions between char[] and wchar had to be added.

  The String alias is D2 string, which works just fine.

  http://bitbucket.org/torhus/dwt2

So this is working with D2? If that's the case then it's great news. I've also found two other guys who want to work on DWT2 so this is starting to look pretty promising. Are your fork windows only? Have you looked anything on the linux port? I'll try to have a look at your branch and see if I can merge it with the main branch. I'm also thinking that we may need to organize our self a bit so we don't work on the same things.

I've only looked at the Windows version, so if anyone else wants to work on the other platforms, feel free. At the moment my fork won't compile as D1 code, but that's easy to fix. I didn't take a very systematic approach to the porting, since I didn't know how much work it would take or how it would work out. You are welcome to review my changes and make suggestions. There were some methods that were synchronized in a couple of the java.* modules. I removed synchronized from their declaration, since D2 doesn't accept this when the methods override superclass or interface methods that are not synchronized. I can't recall the details, but I think it looked like synchronized implies shared, meaning it changes the type of the method. They are not synchronized in the Java version of the code, so I don't know why they were in the D code.
Jul 12 2010
next sibling parent reply torhu <no spam.invalid> writes:
On 13.07.2010 00:01, Jeremy Powers wrote:
[snip]
 Being one of the guys Jacob mentioned, wanted to chime in and second
 his thoughts - this is cool, we need to coordinate, etc.  I haven't
 had much time to work on this yet, but it looks like most of my
 changes parallel yours.  I started by getting (most) things to work
 with D1/Tango first, and got most of the snippets working on
 Windows... was waiting to make sure I didn't break anything for the
 Linux build before saying anything.

 Encountered the same thing with synchronized you did, but my solution
 was simply to move to a synchronized block surrounding the method
 body.  Didn't examine why things were synchronized, but according to
 what I've read D will treat a "synchronized { foo }" block like a
 block on the object, which is the same as the synchronized tag on a
 method in Java.  Didn't check the original Java code though...

We should probably check out if any part of DWT actually need those methods to be synchronized. I removed synchronized because it seemed the cleaner solution, but yours is obviously safer.
 What are your thoughts on how we should coordinate efforts?  I'm
 mostly interested in doing D2/Phobos work, but have a setup where I
 can (relatively) easily switch between to make sure things work w/
 Tango and D2.

For me cooperation would have to be pretty loose, as I don't know how much more time I'll spend on this now that I've got enough ported to make my own app work with D2. It's possible that a lot of what is needed is deciding how to solve the various issues that crop up, maybe more than actual editing of code. We could just use this newsgroup for that, I suppose. Or the DWT forum on dsource.org if that's what people prefer. One issue is what to do with the snippets? Making them work with both D1 and D2 would make a lot of them ugly. Is that worth it, do we add a simple compatibility wrapper module, or what? And what about the larger examples that are still missing from DWT2?
Jul 12 2010
parent reply Jacob Carlborg <doob me.com> writes:
On 2010-07-13 01.20, torhu wrote:
 On 13.07.2010 00:01, Jeremy Powers wrote:
 [snip]
 Being one of the guys Jacob mentioned, wanted to chime in and second
 his thoughts - this is cool, we need to coordinate, etc. I haven't
 had much time to work on this yet, but it looks like most of my
 changes parallel yours. I started by getting (most) things to work
 with D1/Tango first, and got most of the snippets working on
 Windows... was waiting to make sure I didn't break anything for the
 Linux build before saying anything.

 Encountered the same thing with synchronized you did, but my solution
 was simply to move to a synchronized block surrounding the method
 body. Didn't examine why things were synchronized, but according to
 what I've read D will treat a "synchronized { foo }" block like a
 block on the object, which is the same as the synchronized tag on a
 method in Java. Didn't check the original Java code though...

We should probably check out if any part of DWT actually need those methods to be synchronized. I removed synchronized because it seemed the cleaner solution, but yours is obviously safer.

Yes, we need to look into this.
 What are your thoughts on how we should coordinate efforts? I'm
 mostly interested in doing D2/Phobos work, but have a setup where I
 can (relatively) easily switch between to make sure things work w/
 Tango and D2.

For me cooperation would have to be pretty loose, as I don't know how much more time I'll spend on this now that I've got enough ported to make my own app work with D2. It's possible that a lot of what is needed is deciding how to solve the various issues that crop up, maybe more than actual editing of code. We could just use this newsgroup for that, I suppose. Or the DWT forum on dsource.org if that's what people prefer.

When we coordinate things I just want to make sure we're not working on the same code, for example, we don't want ones work to render any other work unusable.
 One issue is what to do with the snippets? Making them work with both D1
 and D2 would make a lot of them ugly. Is that worth it, do we add a
 simple compatibility wrapper module, or what? And what about the larger
 examples that are still missing from DWT2?

I don't know how much of the runtime library is used in the snippets, how much will need to be changed to make it work with both D1 and D2. There are already runtime independent functions in DWT hopefully most of them can be used. -- Jacob Carlborg
Jul 13 2010
parent reply bioinfornatics <bioinfornatics gmail.com> writes:
when i do:
$ hg log -r -1 rpmbuild/SOURCES/dwt-linux/
changeset:   364:2bcb17ebe0be
tag:         tip
user:        Frank Benoit <benoit tionex.de>
date:        Sun Nov 08 20:57:46 2009 +0100
summary:     fix: thx torhu
______________________________________

So dwt project is die for linux?
i am fedora packager and i would like packaget it, but not a project where is
die!
Jul 28 2010
parent bioinfornatics <bioinfornatics gmail.com> writes:
ok on http://www.dsource.org/projects/dwt link is:
hg clone http://hg.dsource.org/projects/dwt2
but website is not up to date
hg clone http://bitbucket.org/torhus/dwt2

Someone can update please this website thanks
Jul 28 2010
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2010-07-13 00.01, Jeremy Powers wrote:
 On Mon, Jul 12, 2010 at 11:21 AM, torhu<no spam.invalid>  wrote:
 On 11.07.2010 20:30, Jacob Carlborg wrote:
 On 2010-07-11 19.09, torhu wrote:
   On 22.06.2010 14:49, Jacob Carlborg wrote:
   On 2010-06-22 01:40, torhu wrote:



[...]
   I've set up my own project on Bitbucket. I've made enough changes to
   build my DWT app on Windows, and it's works like a charm. A lot of the
   Phobos code was already there, and I've added what was needed for my
   use. Since DWT enforces that all GUI code is run in the same thread
   (usually the main thread), I didn't need to add shared and __gshared
   that many places.

   I had to add a lot of casts because D2 compilers are stricter about
   narrowing conversions. In some places Java's char type was kept as char,
   and not changed into wchar. I've changed the ones I came across to
   wchar, to avoid truncating code points that are outside of ASCII. Some
   conversions between char[] and wchar had to be added.

   The String alias is D2 string, which works just fine.

   http://bitbucket.org/torhus/dwt2

So this is working with D2? If that's the case then it's great news. I've also found two other guys who want to work on DWT2 so this is starting to look pretty promising. Are your fork windows only? Have you looked anything on the linux port? I'll try to have a look at your branch and see if I can merge it with the main branch. I'm also thinking that we may need to organize our self a bit so we don't work on the same things.

I've only looked at the Windows version, so if anyone else wants to work on the other platforms, feel free. At the moment my fork won't compile as D1 code, but that's easy to fix. I didn't take a very systematic approach to the porting, since I didn't know how much work it would take or how it would work out. You are welcome to review my changes and make suggestions. There were some methods that were synchronized in a couple of the java.* modules. I removed synchronized from their declaration, since D2 doesn't accept this when the methods override superclass or interface methods that are not synchronized. I can't recall the details, but I think it looked like synchronized implies shared, meaning it changes the type of the method. They are not synchronized in the Java version of the code, so I don't know why they were in the D code.

Being one of the guys Jacob mentioned, wanted to chime in and second his thoughts - this is cool, we need to coordinate, etc. I haven't had much time to work on this yet, but it looks like most of my changes parallel yours. I started by getting (most) things to work with D1/Tango first, and got most of the snippets working on Windows... was waiting to make sure I didn't break anything for the Linux build before saying anything. Encountered the same thing with synchronized you did, but my solution was simply to move to a synchronized block surrounding the method body. Didn't examine why things were synchronized, but according to what I've read D will treat a "synchronized { foo }" block like a block on the object, which is the same as the synchronized tag on a method in Java. Didn't check the original Java code though... What are your thoughts on how we should coordinate efforts? I'm mostly interested in doing D2/Phobos work, but have a setup where I can (relatively) easily switch between to make sure things work w/ Tango and D2. Jeremy

I think what's most important is that we don't work on the same code, we don't want ones work to render any other work unusable. I'll probably focus on finishing the Mac port in the dwt-mac repository, merge changes to the repository and coordinate things. Then I'll add the Mac port to the DWT2 repository. I'll probably use D1 and Tango for most of the time. -- Jacob Carlborg
Jul 13 2010
prev sibling parent reply aarti_pl <aarti interia.pl> writes:
W dniu 2010-07-11 19:09, torhu pisze:
 On 22.06.2010 14:49, Jacob Carlborg wrote:
 On 2010-06-22 01:40, torhu wrote:

 I'm considering creating at least a a temporary fork of DWT 2 on
 bitbucket.org. Then I can just check in some stuff and see how it turns
 out. It's possible that I'll have time to do some work on it this
 summer, but that might change quickly...

You can see if Frank can give you access to the repository, try sending him an e-mail. I know we can use some more people on this project. I don't even know if I have commit access to the DWT2 repository, what I do know is that I have at least access to the dwt-mac repository.

I've set up my own project on Bitbucket. I've made enough changes to build my DWT app on Windows, and it's works like a charm. A lot of the Phobos code was already there, and I've added what was needed for my use. Since DWT enforces that all GUI code is run in the same thread (usually the main thread), I didn't need to add shared and __gshared that many places. I had to add a lot of casts because D2 compilers are stricter about narrowing conversions. In some places Java's char type was kept as char, and not changed into wchar. I've changed the ones I came across to wchar, to avoid truncating code points that are outside of ASCII. Some conversions between char[] and wchar had to be added. The String alias is D2 string, which works just fine. http://bitbucket.org/torhus/dwt2

Sorry for getting into middle of the thread. I just would like to say that it is a great news! After discovering that for Java: ---- double sum = 0.0; for (int i = 0; i < 10; i++) sum += 0.1; ---- sum is equal: 0.9999999999999999 I am looking at D with greater and greater sentiment :-) SWT and good precision of calculations is necessary for my program... It's also possible that I will be able to help with some smaller things... BR Marcin Kuszczak (aarti_pl)
Jul 11 2010
parent reply =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

aarti_pl wrote:
 I just would like to say that it is a great news! After discovering tha=

 for Java:
 ----
 double sum =3D 0.0;
 for (int i =3D 0; i < 10; i++) sum +=3D 0.1;
 ----
=20
 sum is equal: 0.9999999999999999
=20
 I am looking at D with greater and greater sentiment :-) SWT and good
 precision of calculations is necessary for my program...
=20

surprising since 0.1 cannot be represented exactly in base 2) and I would expect D to give the same result... Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jul 11 2010
parent reply aarti_pl <aarti interia.pl> writes:
W dniu 2010-07-11 22:45, "Jérôme M. Berger" pisze:
 aarti_pl wrote:
 I just would like to say that it is a great news! After discovering that
 for Java:
 ----
 double sum = 0.0;
 for (int i = 0; i<  10; i++) sum += 0.1;
 ----

 sum is equal: 0.9999999999999999

 I am looking at D with greater and greater sentiment :-) SWT and good
 precision of calculations is necessary for my program...

surprising since 0.1 cannot be represented exactly in base 2) and I would expect D to give the same result... Jerome

On my computer it is exactly 1.0 (one). I know that there is explanation of why it is like that, as I found article about it. I did not get deeper into it (good few pages of text) as I believe there must better solution for programmers. My calculator shows proper results, spreadsheet shows proper results and I think that calculations in my program for such a big fractions should also give correct result. Just thought: maybe calculations in D are done internally in more than 64bits and then casted into 64bits? It's a bit surprising for me that C is also wrong about this sum... BR Marcin Kuszczak (aarti_pl)
Jul 11 2010
parent reply aarti_pl <aarti interia.pl> writes:
W dniu 2010-07-11 23:39, aarti_pl pisze:
 W dniu 2010-07-11 22:45, "Jérôme M. Berger" pisze:
 aarti_pl wrote:
 I just would like to say that it is a great news! After discovering that
 for Java:
 ----
 double sum = 0.0;
 for (int i = 0; i< 10; i++) sum += 0.1;
 ----

 sum is equal: 0.9999999999999999

 I am looking at D with greater and greater sentiment :-) SWT and good
 precision of calculations is necessary for my program...

surprising since 0.1 cannot be represented exactly in base 2) and I would expect D to give the same result... Jerome

On my computer it is exactly 1.0 (one). I know that there is explanation of why it is like that, as I found article about it. I did not get deeper into it (good few pages of text) as I believe there must better solution for programmers. My calculator shows proper results, spreadsheet shows proper results and I think that calculations in my program for such a big fractions should also give correct result. Just thought: maybe calculations in D are done internally in more than 64bits and then casted into 64bits? It's a bit surprising for me that C is also wrong about this sum... BR Marcin Kuszczak (aarti_pl)

Ok. You are right. D is not better in this case. It seems that it's just writeln cut number of decimal digits and printed 1. Using: writefln("%.25f", sum); we get: 0.99999999999999988897 Does it mean that the only way to get better precision is to use some custom classes like BigDecimal in Java? BR Marcin Kuszczak (aarti_pl)
Jul 11 2010
parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

aarti_pl wrote:
 W dniu 2010-07-11 23:39, aarti_pl pisze:
 W dniu 2010-07-11 22:45, "J=C3=A9r=C3=B4me M. Berger" pisze:
 aarti_pl wrote:
 I just would like to say that it is a great news! After discovering
 that
 for Java:
 ----
 double sum =3D 0.0;
 for (int i =3D 0; i< 10; i++) sum +=3D 0.1;
 ----

 sum is equal: 0.9999999999999999

 I am looking at D with greater and greater sentiment :-) SWT and goo=




 precision of calculations is necessary for my program...

surprising since 0.1 cannot be represented exactly in base 2) and I would expect D to give the same result... Jerome

On my computer it is exactly 1.0 (one). I know that there is explanation of why it is like that, as I found article about it. I did not get deeper into it (good few pages of text=


 as I believe there must better solution for programmers.

 My calculator shows proper results, spreadsheet shows proper results a=


 I think that calculations in my program for such a big fractions shoul=


 also give correct result.

 Just thought: maybe calculations in D are done internally in more than=


 64bits and then casted into 64bits? It's a bit surprising for me that =


 is also wrong about this sum...

 BR
 Marcin Kuszczak
 (aarti_pl)

Ok. You are right. D is not better in this case. It seems that it's jus=

 writeln cut number of decimal digits and printed 1.
=20
 Using:
 writefln("%.25f", sum);
=20
 we get:
 0.99999999999999988897
=20
 Does it mean that the only way to get better precision is to use some
 custom classes like BigDecimal in Java?
=20

in base 2, no matter what precision you use. So your choices are (from fastest to slowest): - decide that the precision of a double is enough for your application after all; - use some arbitrary precision library like gmp to increase precision, being aware that no matter how much you increase the precision, the loop above will *never* give 1 (although it can come close enough that conversion to a double will give 1) - use some symbolic computations library. This will give you absolute precision, but may be slow and won't always give you a numerical result, i.e sqrt(2) is sqrt(2) and that's that, if you try to get a numerical result out of it, then you wind up with the same limitations as the other solutions. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jul 12 2010
prev sibling next sibling parent Jeremy Powers <jpowers wyrdtech.com> writes:
 I've got a small example running (Display, Shell and Combo) in D2.

Don't suppose you'd like to share? I started messing with this last night, and the tip of DWT2 in the repo doesn't even appear to compile w/ D2 at the moment. Speaking of which, who is currently maintaining the branch? It doesn't appear to have had any changes for some time... Jeremy (who is just getting back to using D after a few years hiatus) On Mon, Jun 21, 2010 at 1:46 PM, torhu <no spam.invalid> wrote:
 On 21.06.2010 10:57, Jacob Carlborg wrote:
 On 2010-06-20 17:27, Mengu wrote:
 =C2=A0will dwt support phobos in near future?

DWT2 is a work in progress on supporting both tango and D2 (phobos)

I've got a small example running (Display, Shell and Combo) in D2. There =

 some things that need to be decided, like what the String alias should be=

 =C2=A0Would be nice if could be a Phobos string, ie. immutable(char)[]. =

 seems to work so far, and is a better match for the Java string semantics
 that DWT have inherited.

 DMD 2's stricter conversion rules have actually caught some bugs in DWT. =

 some places, a wchar is implicitly converted to a char, which is not allo=

 in D 2.

 It would be great if DMD 1.x would accept the __gshared keyword, though. =

 sucks to have to use string mixins or static this to work around that.

Jun 21 2010
prev sibling parent Jeremy Powers <jpowers wyrdtech.com> writes:
On Mon, Jul 12, 2010 at 11:21 AM, torhu <no spam.invalid> wrote:
 On 11.07.2010 20:30, Jacob Carlborg wrote:
 On 2010-07-11 19.09, torhu wrote:
 =C2=A0On 22.06.2010 14:49, Jacob Carlborg wrote:
 =C2=A0On 2010-06-22 01:40, torhu wrote:



[...]
 =C2=A0I've set up my own project on Bitbucket. I've made enough changes=



 =C2=A0build my DWT app on Windows, and it's works like a charm. A lot o=



 =C2=A0Phobos code was already there, and I've added what was needed for=



 =C2=A0use. Since DWT enforces that all GUI code is run in the same thre=



 =C2=A0(usually the main thread), I didn't need to add shared and __gsha=



 =C2=A0that many places.

 =C2=A0I had to add a lot of casts because D2 compilers are stricter abo=



 =C2=A0narrowing conversions. In some places Java's char type was kept a=



 =C2=A0and not changed into wchar. I've changed the ones I came across t=



 =C2=A0wchar, to avoid truncating code points that are outside of ASCII.=



 =C2=A0conversions between char[] and wchar had to be added.

 =C2=A0The String alias is D2 string, which works just fine.

 =C2=A0http://bitbucket.org/torhus/dwt2

So this is working with D2? If that's the case then it's great news. I've also found two other guys who want to work on DWT2 so this is starting to look pretty promising. Are your fork windows only? Have you looked anything on the linux port? I'll try to have a look at your branch and see if I can merge it with the main branch. I'm also thinking that we may need to organize our self a bit so we don't work on the same things.

I've only looked at the Windows version, so if anyone else wants to work =

 the other platforms, feel free.

 At the moment my fork won't compile as D1 code, but that's easy to fix. =

 didn't take a very systematic approach to the porting, since I didn't kno=

 how much work it would take or how it would work out. =C2=A0You are welco=

 review my changes and make suggestions.

 There were some methods that were synchronized in a couple of the java.*
 modules. =C2=A0I removed synchronized from their declaration, since D2 do=

 accept this when the methods override superclass or interface methods tha=

 are not synchronized. =C2=A0I can't recall the details, but I think it lo=

 like synchronized implies shared, meaning it changes the type of the meth=

 =C2=A0They are not synchronized in the Java version of the code, so I don=

 why they were in the D code.

Being one of the guys Jacob mentioned, wanted to chime in and second his thoughts - this is cool, we need to coordinate, etc. I haven't had much time to work on this yet, but it looks like most of my changes parallel yours. I started by getting (most) things to work with D1/Tango first, and got most of the snippets working on Windows... was waiting to make sure I didn't break anything for the Linux build before saying anything. Encountered the same thing with synchronized you did, but my solution was simply to move to a synchronized block surrounding the method body. Didn't examine why things were synchronized, but according to what I've read D will treat a "synchronized { foo }" block like a block on the object, which is the same as the synchronized tag on a method in Java. Didn't check the original Java code though... What are your thoughts on how we should coordinate efforts? I'm mostly interested in doing D2/Phobos work, but have a setup where I can (relatively) easily switch between to make sure things work w/ Tango and D2. Jeremy
Jul 12 2010