Re: Pasting illegal character causes segmentation fault

2009-12-30 Thread Frank Benoit
sorry, i thought i can take the time.
but i haven't, so i can get you the support and fix the problem.

I someone else willing to fix that?



Re: Pasting illegal character causes segmentation fault

2009-12-25 Thread Frank Benoit
Am 25.12.2009 23:26, schrieb Mitja:
 strace output:
 select(4, [3], [3], NULL, NULL) = 1 (out [3])
 writev(3, [{\24\0\6\000...@\5\343\2\0\0\0\0\0\0\0\0\0\0\377\377\377\37..., 
 24}], 1) = 24
 select(4, [3], [], NULL, NULL)  = 1 (in [3])
 read(3, \1\10S6\4\0\0\0006\1\0\0\0\0\0\0\17\0\0\0VJ\25\10\374\325 
 \10tc\346\277\203..., 4096) = 48
 read(3, 0x840a2fc, 4096)= -1 EAGAIN (Resource temporarily 
 unavailable)
 select(4, [3], [3], NULL, NULL) = 1 (out [3])
 writev(3, [{+\0\1\0..., 4}], 1)   = 4
 select(4, [3], [], NULL, NULL)  = 1 (in [3])
 read(3, \1\2t6\0\0\0\0...@\5\374\325 
 \10tc\346\277x+\177\td\\36\10Y3\t\10..., 4096) = 32
 read(3, 0x840a2fc, 4096)= -1 EAGAIN (Resource temporarily 
 unavailable)
 select(4, [3], [3], NULL, NULL) = 1 (out [3])
 writev(3, [{\23\0\3\000...@\5\343\2\0\0+\0\1\0..., 16}], 1) = 16
 select(4, [3], [], NULL, NULL)  = 1 (in [3])
 read(3, 
 \34\u6...@\5\343\2\0\0\0\252fc\1\2\0\0\4\0\0\0\1\0\0\0@B\233\t\1..., 4096) 
 = 64
 read(3, 0x840a2fc, 4096)= -1 EAGAIN (Resource temporarily 
 unavailable)
 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
 +++ killed by SIGSEGV +++
 

Oh, i did not mean strace (which is a trace of the OS calls a process
does), instead i mean stack trace. You can perhaps get it with the
current tango (i think) or by running the program in GDC and after the
segfault run the backtrace command in it. It show the code line where
the segfault happens and the code lines where this one was called from.


 Example code:
 module text;
 
 import dwt.DWT;
 import dwt.custom.StyleRange;
 import dwt.widgets.Text;
 import dwt.layout.FillLayout;
 import dwt.widgets.Display;
 import dwt.widgets.Shell;
 
 void main() {
 Display display = new Display();
 Shell shell = new Shell(display);
 shell.setLayout(new FillLayout());
 Text text = new Text(shell, DWT.BORDER);
 shell.pack();
 shell.open();
 while (!shell.isDisposed()) {
   if (!display.readAndDispatch())
 display.sleep();
 }
 display.dispose();
 }
 

thanks.


 I cannot reproduce the character.
 The way I got it was by pasting block of Japanese or Chinese characters into 
 text widget and then selecting by mouse and copying a few characters from 
 that block.
 Illegal character(s) would as a result of copying appear in Klipper (KDE 
 clipboard), usually in front or at the end of copied selection.
 Segmentation fault would occur when I pasted back the very same selection, 
 now with prepended or appended illegal characters.
 

Hm, perhaps you can paste the same into a editor and open it with a
hex-view (hexdump) to make the byte values visible.



Re: Developing a browser (Firefox) extension with D

2009-11-18 Thread Frank Benoit
Justin Johansson schrieb:
 Hi Frank,
 
 Thanks for this very valuable information.  I was soon to post about D
 interoperability with JNI (Java Native Interface), but sounds like as
 you say D extensions for Java could also be problematic.  Okay if you
 are the only guy in there but big trouble if your extension is trying
 to co-exist with other vendor extensions in D.

There might be also a problem if firefox or something else in the same
process uses signals.

 
 I am left wondering though, is this a permanent show-stopper for the
 future (technically) or could something, at least in theory, be worked
 out to overcome the GC issue?

Perhaps start a child process and do inter process communication.
For one of my application I use a Java GUI and then I start a D process
and use stdin+stdout for JSON communication.



Re: Developing a browser (Firefox) extension with D

2009-11-17 Thread Frank Benoit
Justin Johansson schrieb:
 I'm just wondering for a moment if D might be a good vehicle for
 developing a browser extension for Firefox, or any other browser for
 that matter.
 
 Has anyone either considered doing, or has actually done, any browser
 extension development with D and have some thoughts or experience to share?
 
 Thanks for all feedback,
 Justin Johansson

As an extension, there might be more than one extension running in one
Firefox process. Each extension written in D must bring in its own GC,
here comes the problem. The GC is implemented in D using signals, which
are global to the process. So if there are two D extensions, they will
get confused by each other. This is also the reason, i give up about
running D and Java in the same process. Also Java uses those signals for
its own GC.

But nevertheless, if you want to give it a try, the DWT firefox bindings
might be of interest for you.



Re: We should deprecate C-style declarations

2009-11-16 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 ...(such as length in array index expressions) ...

finally yay!


Re: Making alloca more safe

2009-11-16 Thread Frank Benoit
dsimcha schrieb:
 Yes, but it stops the program in such a way that it's very hard to figure out
 why/where it died.  The solution, which I've wanted for a while and I think 
 others
 have proposed, is for DMD to implicitly assert that every pointer is non-null
 before dereferencing it when in debug mode.

This would be great. The compiler could also optimize those away in
cases of repeated access without ref assign in between

void foo( Object o){
  o.toString(); // o !is null checked
  o.toHash();   // o !is null not checked, because already done
}


Re: struct mixins

2009-11-16 Thread Frank Benoit
Reminds me of an older thread:
http://www.digitalmars.com/d/archives/digitalmars/D/Implicit_castable_structs_64764.html


Re: static interface

2009-11-16 Thread Frank Benoit
Leandro Lucarella schrieb:

 What do you think?
 

I like it.


Re: @safe leak fix?

2009-11-11 Thread Frank Benoit
Walter Bright schrieb:
 Consider the code:
 
   @safe:
 T[] foo(T[] a) { return a; }
 
 T[] bar()
 {
 T[10] x;
 return foo(x);
 }
 

If D would have something like a slice-info which could be returned
instead of the slice itself, then foo would be safe.

slice-info would be something like a struct/Tuple storing the start and
end index.

That applied onto the original array gives the slice.

SliceInfo foo( T[] a){
  // do something, resulting in e.g. a[2..6]
  return SliceInfo(2, 6);
}

T[] bar(){
T[] x = new T[10];
return x[foo(x)]; // safe compile OK
}

T[] bar(){
T[10] x;
return x[foo(x)]; // safe error, because x slice escapes
}

This shifts responsibility of memory safety to the caller with little
extra effort.


Re: dwt-win on dmd 1.047 or later?

2009-11-07 Thread Frank Benoit
torhu schrieb:
 Has anyone successfully built dwt-win (r339) with dmd 1.047 or later?
 I've tried all version from 1.047 through 1.051, but only run into new
 compiler bugs.

If you are willing to supply a patch, that would be great.


Re: 2 File IO Questions (Phobos)

2009-11-07 Thread Frank Benoit
Zane schrieb:
 Doh! I still need help with number 2, but for number 1, all I needed
 was to use 'writeString' instead of 'write'.  Like I said, still
 getting used to Phobos.  Like I said, I still need help on the
 destructor question (#2).
 
 Thanks, Zane

desctructors are called in not defined order. The GC puts your class
instance 'sw' and the File instance 'sw.file' onto the list for
destruction. So the 'sw.file' might be destructed before 'sw' is.
Deferencing sw.file from withing sw.~this then fails.

A general rule: in a dtor, never dereference member variables.

You have to rely on the File dtor, to close himself if still open.


Re: Safety, undefined behavior, @safe, @trusted

2009-11-05 Thread Frank Benoit
safe should be the default. The unsafe part should take the extra
typing, not the other way. Make the user prefer the safe way.


Re: Arrays passed by almost reference?

2009-11-05 Thread Frank Benoit
Ali Cehreli schrieb:
 I haven't started reading Andrei's chapter on arrays yet. I hope I won't find 
 out that the following behavior is expected. :)
 
 import std.cstream;
 
 void modify(int[] a)
 {
 a[0] = 1;
 a ~= 2;
 
 dout.writefln(During: , a);
 }
 
 void main()
 {
 int[] a = [ 0 ];
 
 dout.writefln(Before: , a);
 modify(a);
 dout.writefln(After : , a);
 }
 
 The output with dmd 2.035 is
 
 Before: [0]
 During: [1,2]
 After : [1]
 
 I don't understand arrays. :D
 
 Ali
 

int[] a;
a is kind of a pointer, one with the extra length information.
When passed to modify(), a is passed by-value, the contained data is
certainly passed by-reference since a points to the data.

This is why the a.length was not updated.

If you change modify to :
void modify(ref int[] a){...

it should work as you expected.


Re: Modules/packages and cryptic errors

2009-10-31 Thread Frank Benoit
al schrieb:
 module bar is in multiple defined

This often indicates a modules file name and the identifier in the
module statement are unequal (case sensitivity)


Re: Modules/packages and cryptic errors

2009-10-31 Thread Frank Benoit
al schrieb:
 Frank Benoit Wrote:
 
 al schrieb:
 module bar is in multiple defined
 This often indicates a modules file name and the identifier in the
 module statement are unequal (case sensitivity)
 
 I have all files and imports lowercase. I have class names following 
 filenames capitalized, but that shouldn't matter, should it?
 
 
 When I run:
 
 dmd foo/bar.d
 
 is that assuming module foo.bar or bar? If that's the latter, it might 
 explain why I'm getting an error (import finds this file under foo.bar), but 
 how should I compile files then?
 
 

if 'foo' shall be package, in bar.d there should be module foo.bar;.
If imported from somewhere else, it should be import foo.bar;.

Class/Type names should not matter.


Re: dwt-linux with ldc successfully built

2009-10-19 Thread Frank Benoit
digited schrieb:
 Gian Perrone Wrote:
 
 I just wanted you to know that i built dwt-linux (from the repository) 
 with ldc, just a few small changes were made:

 ...patch here...

 The browser widget had to be ignored (move away dwt/browser and 
 dwt/internals/mozilla). The simple example was run successfully, i 
 didn't test more.

 dwt-addons doesn't work because of a bug with tuples in ldc.
 
 Thanks for the patch!
 
 I've compiled some HelloWorlds with LDC trunk, Tango trunk and xfbuild on 
 openSUSE 11.1 x86_64:
 
 xfbuild dwt-samples/examples/helloworld/HelloWorld1.d -Idwt-linux 
 -Jdwt-linux/res -d-version=TANGOSVN -d +ohw1 -L-lz -L-lgtk-x11-2.0 
 -L-lgdk-x11-2.0 -L-latk-1.0 -L-lgdk_pixbuf-2.0 -L-lgthread-2.0 
 -L-lpangocairo-1.0 -L-lfontconfig -L-lXtst -L-lXext -L-lXrender -L-lXinerama 
 -L-lXi -L-lXrandr -L-lXcursor -L-lX11 -L-lXfixes -L-lpango-1.0 
 -L-lgobject-2.0 -L-lgmodule-2.0 -L-ldl -L-lglib-2.0 -L-lcairo
 
 However, i have problems with Gtk/Gdk and locale - when i try to run a DWT 
 app, i get:
 
 (process:9804): Gdk-WARNING **: locale not supported by C library
 (process:9804): Gtk-WARNING **: Locale not supported by C library.
 Using the fallback 'C' locale.
 
 And the app halts without showing any window. 'locale' returns en_US.UTF-8 
 everywhere, resetting it with 'localedef' also doesn't change the error. May 
 it be some DWT bug?

I know this warning. I do not remember what the solution was, to make it
go away, but my application always worked with it.
So the not showing window or halt might not be related to the warning.


Re: Working with files over 2GB in D2

2009-10-17 Thread Frank Benoit
Jeremie Pelletier schrieb:
 Frank Benoit wrote:
 dsimcha schrieb:
 == Quote from Jeremie Pelletier (jerem...@gmail.com)'s article
 dsimcha wrote:
 Does anyone know how to work with huge (2GB+) files in D2? 
 std.stream has
 overflow bugs (I haven't isolated them yet) and can't return their
 size
 correctly, std.stdio.File throws a ConvOverflowError in seek()
 because fseek()
 apparently takes an int when it should take a long, and std.file
 only supports
 reading the whole file, which I can't do in 2GB address space.

 It appears none of the file I/O on Phobos has been tested on huge
 files (until
 now).
 What platform are you using? You should report your issue on bugzilla.
 I had similar issues on windows when using stdio's fseek and ftell, I
 had no problems using GetFilePointerEx, you could try that while it is
 fixed.
 Jeremie
 Mostly Linux.  Everything seems to be working on Windows, though I
 haven't tested
 it that thoroughly.  I will file Bugzillas eventually, but I'm still
 trying to
 understand some of these issues, i.e. to what extent they're
 limitations vs. real
 bugs.

 What I'm really interested in knowing is:

 1.  To what extent is the fact that working with 2GB+ files a
 platform limitation
 rather than a real bug?  (I vaguely understand that it has to do with
 files being
 indexed by signed ints, but I don't know the details of how it's
 implemented on
 each platform and what is different between platforms.)

 2.  Does anyone know of a method of doing file I/O in D2 that is
 well-tested with
 files above 2GB?

 Tango has full support for that. On linux platform, there are two C
 APIs, one up to 2GB and one for LFS - Large File Support.

 
 I just had a quick peek at std.stdio, it is using the C standard library
 for file I/O on every platform.
 
 Phobos should support the CreateFile related APIs on windows and LFS on
 linux to get around quirks like that 2Gb limitation.
 
 Jeremie

In Tango search for __USE_LARGEFILE64 to find the relevant places. Not
only other functions are used, also types and structures are different.


Re: dmd support for IDEs and the D tool chain

2009-10-16 Thread Frank Benoit
Jacob Carlborg schrieb:
 On 10/16/09 13:03, digited wrote:
 Jacob Carlborg Wrote:

 IDE: Descent

 Poseidon + xfBuild may do the job (but Poseidon needs work to run on
 linux and mac). Eclipse itself is too heavy and too java's.
 
 I totally forgot about Poseidon. It has already been ported to the new
 DWT library, I don't know if it's complete and if it's running.

Needs debugging, but can run.
I wanted to port it to the jface.text editor component, but lost
motivation :)


Re: Working with files over 2GB in D2

2009-10-16 Thread Frank Benoit
dsimcha schrieb:
 == Quote from Jeremie Pelletier (jerem...@gmail.com)'s article
 dsimcha wrote:
 Does anyone know how to work with huge (2GB+) files in D2?  std.stream has
 overflow bugs (I haven't isolated them yet) and can't return their size
 correctly, std.stdio.File throws a ConvOverflowError in seek() because 
 fseek()
 apparently takes an int when it should take a long, and std.file only 
 supports
 reading the whole file, which I can't do in 2GB address space.

 It appears none of the file I/O on Phobos has been tested on huge files 
 (until
 now).
 What platform are you using? You should report your issue on bugzilla.
 I had similar issues on windows when using stdio's fseek and ftell, I
 had no problems using GetFilePointerEx, you could try that while it is
 fixed.
 Jeremie
 
 Mostly Linux.  Everything seems to be working on Windows, though I haven't 
 tested
 it that thoroughly.  I will file Bugzillas eventually, but I'm still trying to
 understand some of these issues, i.e. to what extent they're limitations vs. 
 real
 bugs.
 
 What I'm really interested in knowing is:
 
 1.  To what extent is the fact that working with 2GB+ files a platform 
 limitation
 rather than a real bug?  (I vaguely understand that it has to do with files 
 being
 indexed by signed ints, but I don't know the details of how it's implemented 
 on
 each platform and what is different between platforms.)
 
 2.  Does anyone know of a method of doing file I/O in D2 that is well-tested 
 with
 files above 2GB?

Tango has full support for that. On linux platform, there are two C
APIs, one up to 2GB and one for LFS - Large File Support.



Re: DIP6

2009-10-14 Thread Frank Benoit
Jeremie Pelletier schrieb:
 Back when I started programming on a french canadian layout, most of
 these symbols were located at crazy places, like ? is shift-6, [], {},
  are all found using right-alt + one of the many keys close to enter,
 which are used for accents, really annoying. Even the backslash is
 located at right-alt + the key left to 1.
 
 And people here wonder why I custom order my laptops and keyboards to
 get native US layouts..
 
 Jeremie

Hehe, same here in Germany


Re: Eliminate assert and lazy from D?

2009-10-13 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 Right now, the language has enough power to express assert as a library
 function, as opposed to a primitive construct. (See e.g. enforce.) I
 think it would be good to relegate assert to object.d.
 
 This also brings up lazy, which seems to be quite botched. Are there
 suggestions on how to replicate its functionality in a different way? I
 even seem to recall lazy was discussed as a disadvantage in the recent
 dialog on reddit, see
 
 http://www.reddit.com/r/programming/comments/9qf8i/i_wrote_some_d_today_and_its_completely_blowing/
 
 
 I personally believe it's useful to be able to pass an unevaluated
 expression into a function, for example assert and enforce themselves
 use that.
 
 But let's open this for discussion: should assert and/or lazy be
 removed? If not, why not? It yes, why? How can we replicate their
 functionality?
 
 
 Andrei

I have seen lazy only used in its own show case. In log functions. In
Tango too it is used in log functions. I use delegates as function
parameters often, but not lazy. This is because I may add parameters and
 on the caller site, IMO it must be obvious, this expression is not
evaluated as others. Maybe it is acceptable to remove lazy and write
logging statements with delegate and the curly braces.
log({ bla bla ~info });

A related issue with passing arguments, that i think needs a better
solution in D are the variadic arg list. No magic param names and the
possibility to pass this list - or a slice of it - to another function.


Re: Eliminate assert and lazy from D?

2009-10-13 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 Frank Benoit wrote:
 Andrei Alexandrescu schrieb:
 Right now, the language has enough power to express assert as a library
 function, as opposed to a primitive construct. (See e.g. enforce.) I
 think it would be good to relegate assert to object.d.

 This also brings up lazy, which seems to be quite botched. Are there
 suggestions on how to replicate its functionality in a different way? I
 even seem to recall lazy was discussed as a disadvantage in the recent
 dialog on reddit, see

 http://www.reddit.com/r/programming/comments/9qf8i/i_wrote_some_d_today_and_its_completely_blowing/



 I personally believe it's useful to be able to pass an unevaluated
 expression into a function, for example assert and enforce themselves
 use that.

 But let's open this for discussion: should assert and/or lazy be
 removed? If not, why not? It yes, why? How can we replicate their
 functionality?


 Andrei

 I have seen lazy only used in its own show case. In log functions. In
 Tango too it is used in log functions. I use delegates as function
 parameters often, but not lazy. This is because I may add parameters and
  on the caller site, IMO it must be obvious, this expression is not
 evaluated as others. Maybe it is acceptable to remove lazy and write
 logging statements with delegate and the curly braces.
 log({ bla bla ~info });
 
 std.contracts.enforce also uses it.
 

Yes, this is, both are functions that try to help the programmer itself
and are part of the infrastructure. But is lazy useful for e.g. user
libs? Is it useful in an API the user is not fully aware of?
I mean if you call a function and you did not know the argument is lazy,
it may have strange effects. This is why i would avoid lazy. I think the
callers code should have the noticeable different syntax, and we already
have that with the curly braces.

 A related issue with passing arguments, that i think needs a better
 solution in D are the variadic arg list. No magic param names and the
 possibility to pass this list - or a slice of it - to another function.
 
 I'm hoping that template variadics + arrays of Variant cover all needs.

Doesn't that mean, each call with different arguments will instantiate
another template instance?


Re: Eliminate assert and lazy from D?

2009-10-13 Thread Frank Benoit
Jeremie Pelletier schrieb:
 
 For example, there is no way to tell a parameter is lazy from a function
 call, you need to look at the prototype. But the same can be said with
 ref and out too so if you remove lazy you also need to rethink these two.
 

ref and out are not the same category of weirdness for the caller. the
compiler will tell that a lvalue is needed for ref and out. But the
expression may have side effects, evaluating never/once/multiple is easy
to hide errors.

 I therefore made myself a simple convention on how I use lazy: if the
 value is evaluated only once I use lazy, otherwise I use a delegate.
 This makes it clear from the call context what I'm doing.

If it is evaluated exactly once, you do not need lazy at all. And if it
may also not be evaluated, the callers code is not less safe as when
evaluated multiple times.


Re: dmd support for IDEs

2009-10-11 Thread Frank Benoit
Walter Bright schrieb:
 They say that the productivity gains of D's improvements are
 overbalanced by the loss of productivity by moving away from an IDE. And
 what is it about an IDE that is so productive?

If you use Eclipse for Java, you have:
- Debugger in place
- Automatic builder, compile on save
* Jump to line from error list
* Jump to declaration
- Show JavaDoc in tooltip, even in autocompletion
- Show hierarchy tree
- Autocompletion
- Quick assist, e.g.
- assign ctor parameter to new field
- extract selected text into local variable
- Mark source portion, extract to method, the IDE evaluates the needed
parameters and return value
- ...
There is so much more. But the main thing is, you are not only able to
use grep and friends on the pure text level. With an IDE you have
semantic support. This makes refactoring your code so much easier. You
can say rename this method and it works, all references to this method
are also altered. Move this inner class to a top level class in that
package, Derive from that class, yes add the needed ctors. There is
even an API to automate refactorings.

I think Descent is the right way. But here, a port of DMD is directly
integrated into the plugin. To put more manpower in this project would
be the best way imo.





Re: putting more smarts into a == b

2009-09-27 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 Consider two objects a and b with a of class type. Currently, the
 expression a == b is blindly rewritten as a.opEquals(b). I argue it
 should be rewritten into a call to an (imaginary/inlined) function
 equalObjects(a, b), with the following definition:
 
 bool equalObjects(T, U)(T a, U b) if (is(T == class))
 {
 static if (is(U == class))
 {
 if (b is null) return a is null;
 if (a is null) return b is null;
 }
 else
 {
 enforce(a !is null);
 }
 return a.opEquals(b);
 }
 
 This hoists the identity test outside the opEquals call and also deals
 with null references. What do you think?
 
 
 Andrei

What about interfaces?


Re: putting more smarts into a == b

2009-09-27 Thread Frank Benoit
Frank Benoit schrieb:
 What about interfaces?

I mean, this is a point that annoyes me a lot in D, that interfaces
(instances) cannot be treated like objects. I cannot do

if( someiface == someobj ){ ... }

With that technique, the compiler could do a dynamic cast to Object in
place, do the null checks and then call opEquals.

Certainly, this should also work for the other methods of Objects like
toHash, toString, ...


Re: putting more smarts into a == b

2009-09-27 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 Frank Benoit wrote:
 In DWT, I cast always first to Object.
 Java if( intf1.equals(intf2) ){
 D1.0 if( ((cast(Object)intf1).opEquals( cast(Object)intf2 )){
 
 I think in D the cast is inserted automatically. Walter?
 
 Andrei

there is a related bug report
http://d.puremagic.com/issues/show_bug.cgi?id=2794


Re: dwt-linux with ldc successfully built

2009-09-17 Thread Frank Benoit
Thats good news. How long was the compile time? How big the executable?


Re: Descent support dmd2.032£¿

2009-09-04 Thread Frank Benoit
Ary Borenszweig schrieb:
 As for translations, you can checkout from svn and see all the
 ..properties files. You need to translate those. But I'm curious: is
 Eclipse available in other languages? Is JDT available in other languages?

see
http://babel.eclipse.org/babel/


Re: DWT Status

2009-09-01 Thread Frank Benoit
Colin Barnes schrieb:
 DWT doesnt seem to have been touched in a while.
 
 Is it dead in the water?
 
 
 col.

from my side yes, i am not working on it atm.
in the future, i don't know.

If you want to update the port to swt 3.5, you are welcome :)


Re: Turkish 'I's can't D either

2009-08-25 Thread Frank Benoit
Rainer Deyke schrieb:
 I know ICU can use different case mappings for different locales, but I
 don't think it has D bindings.
 
 

There are existing ICU bindings in the mango project, see dsource.org


Re: Memory allocation problem

2009-08-09 Thread Frank Benoit
bearophile schrieb:
 In a small program on Windows XP I have to allocate a large chunk of
 RAM, about 1847 MB of RAM. This PC has 2 GB RAM. So I use
 std.c.stdio.malloc(), with DMD v1.042 (or v2.031). But it's not able
 to allocate it, and produces at runtime: Error: Access Violation
 
 An equal program written in C and compiled with GCC, that allocates
 the same amount of memory using malloc, is able to run (with just a
 little hard disk trashing at the beginning). Do you know why DMD
 doesn't allow me to allocate more RAM, and can this be fixed?
 
 Bye, bearophile

Is it the malloc that fails (returning null) or the handling of the
block? D arrays afaik can only handle 16e6 elements.


Re: some strange behavior

2009-08-09 Thread Frank Benoit
//o schrieb:
 Writing a small opengl text printer (vertex based) I have found that the next 
 lines are illegal to dmd (2.031):
 
 invariant float[][][] CHARS =[
 [//A
   [0,0],
   [1/2f,2],
   [1,0],
   [3/4f,1],
   [1/4f,1]
 ]
 ];
 
 dmd complains (compiling with dmd -c bug.d):
 bug.d(9): Error: cannot implicitly convert expression ([0.5F,2F]) of type 
 float[2u] to int[]
 bug.d(9): Error: cannot implicitly convert expression ([0.75F,1F]) of type 
 float[2u] to int[]   
 bug.d(9): Error: cannot implicitly convert expression ([0.25F,1F]) of type 
 float[2u] to int[]  
 
 is this a bug?
 
 thanks.
 --
 if this mesage is repeated there's a problem with my browser

The type of the first element makes the type of the array literal. 0
is of type int, try 0f.

invariant float[][][] CHARS =[
[//A
[0f,0],
[1/2f,2],
[1,0],
[3/4f,1],
[1/4f,1]
]
];


Re: DIP6: Attributes

2009-08-04 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 Ary Borenszweig wrote:
 call!(foo)(5, hello)

 with varaidic args?
 
 Well some don't like to need to remember the order of arguments.
 
 Andrei

Assigning the argument by name instead of order has two other benefits,
i can think of...
1. on the call side, it is documented for what the given values are used.
2. it may be possible to let all parameters have default values and for
example just give a value for the last parameter. This is not possible
with just the parameter order.


Re: property syntax strawman

2009-08-02 Thread Frank Benoit
KennyTM~ schrieb:
 Frank Benoit wrote:
 Or how about making it a single method?

 bool empty=(bool* value){
 if( value ) _empty = *value;
 return _empty;
 }

 The compiler rewrites the calling code to either pass the address or
 null.
 
 So properties can't be used in SafeD?

Hm, right pointers are not allowed there. So the in operator for AAs
is also disallowed? That surprises me.


Re: static this sucks, we should deprecate it

2009-05-28 Thread Frank Benoit
Unknown W. Brackets schrieb:
 Probably a silly idea, but what about (or similar):
 
 static this: mod.name, mod.name2, mod.name3
 {
 }
 
 For a dependency list.  I may be wrong, but afaik the main problems stem
 from either wrong order or co-dependence (which needs to be solved by
 the programmer.)
 
 At least with this, you could ask the compiler for an order,
 potentially.  If the other modules had no static this, it could ignore
 it, allowing future proofing.
 
 But, maybe that's an ugly hack.
 
 -[Unknown]
 

In Java the
static { /* static ctor code */ }
does not have the circular dependency problem. why is that?


Re: static this sucks, we should deprecate it

2009-05-28 Thread Frank Benoit
Ary Borenszweig schrieb:
 Steven Schveighoffer wrote:
 On Thu, 28 May 2009 11:32:19 -0400, Ary Borenszweig
 a...@esperanto.org.ar wrote:

 Unknown W. Brackets wrote:
 Probably a silly idea, but what about (or similar):
  static this: mod.name, mod.name2, mod.name3
 {
 }
  For a dependency list.  I may be wrong, but afaik the main problems
 stem from either wrong order or co-dependence (which needs to be
 solved by the programmer.)
  At least with this, you could ask the compiler for an order,
 potentially.  If the other modules had no static this, it could
 ignore it, allowing future proofing.
  But, maybe that's an ugly hack.
  -[Unknown]
   davidl wrote:
 Why on earth we still let the tumor grow?
 I would love to specify the order by myself not by the arbitrary order
 generated by the compiler.


 Hi,

 Can someone explain me what is exactly the problems with static this?
 Something like a small example that shows the problem, so I can at
 least think of a solution (because I don't know the problem).

 Thanks!
 Ary


 Something like:

 file1.d:

 import file2.d;

 static this()
 {
 }

 file2.d:

 import file1.d;

 static this()
 {
 }

 fails to compile due to the perceived circular dependency, even though
 none exists.
 
 Thanks, yes, it fails to run. But why? What could happen if that error
 wasn't issued? I'm looking for an example where something wrong could
 happen.

If that error would be generated, there would be no other way to prevent
you from accessing another module which is not yet initialized (static
this not yet run).


Re: any html parser with d binding

2009-05-21 Thread Frank Benoit
Robert Fraser schrieb:
 reimi gibbons wrote:
 2) how reliable is bcd to create binding for c libraries?
 
 C? Very reliable (unless it uses weird compiler directives). C++ is a
 bit trickier.

Last time I used BCD, it had no support for bitfields and generated
struct definition that do not match in size with their original.

So in general when doing C bindings, i do a check of struct sizes by
writing a C and a D program outputting the sizes and compare the outputs
with kdiff3 for manual tweaking the structs in D.


Re: with still sucks + removing features + adding features

2009-05-19 Thread Frank Benoit
Alexander Pánek schrieb:
 Andrei Alexandrescu wrote:
 bearophile wrote:
 Andrei Alexandrescu:

 Thank you for bringing a real example that gives something to work on.

 Awful!

 Well, one of your cases was wrong. Using the +1 at the end one of
 those cases become:
 case 'A' .. 'Z'+1, 'a' .. 'z'+1:
 Instead of what you have written:
 case 'A' .. 'Z'+1: case 'a' .. 'z'+1:

 I agree that that syntax with +1 isn't very nice looking. But the
 advantage of +1 is that it introduces (almost) no new syntax, it's
 not easy to miss, its meaning is easy to understand. AND you don't
 have to remember that in a case the .. is inclusive while in foreach
 is exclusive on the right, keeping the standard way in D to denote
 ranges.

 You don't understand. My point is not that people will dislike 'Z'+1.
 They will FORGET TO WRITE THE BLESSED +1. They'll write:

 case 'A' .. 'Z':
 
 You know, Ruby solves this by introducing a “seperate” range syntax for
 exclusive ranges: “...”. An inclusive range is written the same as an
 exclusive range in D: “..”.
 
 a[1 .. 2].length #= 1 ([a[1]])
 a[1 ... 2].length #= 2 ([a[1], a[2]])
 
 I see no reason not to include such a seperate syntax in D. “..” being
 exclusive and “...” being inclusive, not the other way round as in Ruby
 — see “Programmer’s Paradox” @
 http://www.programmersparadox.com/2009/01/11/ruby-range-mnemonic/ .
 
 Kind regards, Alex

Yes, this is useful for all use cases of ranges.
I like '...'.


Re: D users in Munich, Rome, Venice, or Frankfurt?

2009-05-11 Thread Frank Benoit
Robert Fraser schrieb:
 I'm going to be in Munich from June 24-27, Venice June 28-July 1, Rome
 July 2-3, and Frankfurt on July 4, if there are any D users in the area
 who want to meet up. Like your typical American, I can only speak
 English, though ;-P (I might be able to manage some Japanese...).

Nice trip. Pity, i am in Stuttgart that is 200km from Frankfurt and
220km from München.


Re: Plotting Using PLPlot

2009-05-10 Thread Frank Benoit
What is needed to add a dwt device driver?


Re: assignment: left-to-right or right-to-left evaluation?

2009-05-09 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 Consider:
 
 uint fun();
 int gun();
 
 int[] a = new int[5];
 a[fun] = gun;
 
 Which should be evaluated first, fun() or gun()? It's a rather arbitrary
 decision. C/C++ don't even define an order. Python chooses
 left-to-right, EXCEPT for assignment, which is right-hand side first.
 Lisp and C# choose consistent left-to-right. I don't like exceptions and
 I'd like everything to be left-to-right. However, this leads to some odd
 cases. Consider this example in TDPL:
 
 import std.stdio, std.string;
 
 void main() {
   uint[string] dic;
   foreach (line; stdin.byLine) {
 string[] words = split(strip(line));
 foreach (word; words) {
   if (word in dic) continue; // nothing to do
   uint newID = dic.length;
   dic[word] = newID;
   writeln(newID, '\t', word);
 }
   }
 }
 
 If we want to get rid of newID, we'd write:
 
   writeln(dic.length, '\t', word);
   dic[word] = dic.length;
 
 by the Python rule, and
 
   writeln(dic.length, '\t', word);
   dic[word] = dic.length - 1;
 
 by the C# rule.
 
 What's best?
 
 
 Andrei

From my POV, it would be nice if it would be the same as in Java,
because i am porting lots of it to D.






Re: assignment: left-to-right or right-to-left evaluation?

2009-05-09 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 Frank Benoit wrote:
 From my POV, it would be nice if it would be the same as in Java,
 because i am porting lots of it to D.
 
 Good point. I searched for that one and found:
 
 http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html
 
 The Java programming language guarantees that the operands of operators
 appear to be evaluated in a specific evaluation order, namely, from left
 to right.

I think, code relying on the order is bad code. And iI think there is no
right way.

But...
+ it is good to have it defined
+ it is good if ported code will not break because of that difference

I see no other argument. So the question would be, from which language
would you expect the most ported code?

I think it will be C/C++ bindings for libs and Java code

For bindings/declarations the evaluation order is not of relevance. So
choose Java's scheme. :)





Re: What's the current state of D?

2009-05-08 Thread Frank Benoit
Walter Bright schrieb:
 dsimcha wrote:
 Exactly my feelings, but I'll add that the time to make huge, sweeping
 changes
 like the ones we're seeing now is before the language becomes
 mainstream.  Once
 the language has a large base of crufty production code that nobody still
 understands and can fix quickly and easily when the language changes,
 it becomes
 much harder to make these kinds of changes.
 
 Yes.
 
 The next D2 update will have one such change, which has been planned for
 maybe the past year. All static and global variables will default to
 being thread local (instead of being implicitly shared). Doing this is
 disruptive, but is critical to credibly supporting multithreaded
 programming.
 
 In testing this out, I've uncovered at least a dozen implicit sharing
 bugs in Phobos. I think this change will have a big payoff for
 multithreaded code.

can you allow shared or __gshared in D1 as do-nothing keywords? That
will make it more easy to write code that compiles for D1 and D2.
Or is there a trick to accomplish this?




Precedence of 'new' vs '.'

2009-05-05 Thread Frank Benoit
In Java one can write:

new MyClass().run();

in D this does not compile, parenthesis are needed.

(new MyClass()).run();

But why is the D language designed like that?


Re: Precedence of 'new' vs '.'

2009-05-05 Thread Frank Benoit
Robert Fraser schrieb:
 me too... Bugzilla, anyone?

http://d.puremagic.com/issues/show_bug.cgi?id=2945


Re: Self function

2009-05-04 Thread Frank Benoit
bearophile schrieb:
 Sometimes I rename recursive functions, or I duplicate and modify them, and 
 they stop working because inside them there's one or more copy of their old 
 name, so for example they recurse to their old name.
 So inside a function I'd like to have a standard name to call the function 
 itself, useful for recursivity.
 (If you have two or more recursive functions that call each other this idea 
 can't be used, but I think such situations are uncommon enough to not deserve 
 help from the language).
 
 I have just discussed this in the Python newsgroup too:
 http://groups.google.com/group/comp.lang.python/browse_thread/thread/d265da85d4b70eaf#
 
 I use more recursivity in D than in Python, because Python has troubles with 
 it.
 
 In future in D2 you may use:
 
 int ANUGLYNAME(int n) {
 if (n = 1)
 return 1;
 else
 mixin(__FUNCTION__ ~ (n - 1) * n);
 }
 
 But you can't use __FUNCTION__ into a delegate/function pointer/lambda 
 because the name isn't available, and it's a bit ugly syntax anyway...
 
 This looks a bit better:
 
 int ANUGLYNAME(int n) {
 if (n = 1)
 return 1;
 else
 __self(n - 1) * n;
 }
 
 Other syntaxes are possible.
 
 __self is a way to denote the pointer/delegate of the function currently 
 being run, so I think the compiler is always able to that, for delegate/ 
 function pointers/ lambdas/ methods/ virtual methods/ opCalls too.
 
 Bye,
 bearophile

how about

scope.function// the surrounding function
scope.method  // the surrounding method
scope.class   // the surrounding class
scope.class.outer // the outer class of the surrounding class

The current functions name, was requested so often:
scope.function.name

?


Re: Throwable, Exception, and Error

2009-05-03 Thread Frank Benoit
Walter Bright schrieb:
 Steve Teale wrote:
 If I want a catch-all catch, which should I be using.

 Out of habit I use Exception, but if I do that then I will miss some
 things thrown from Phobos.

 Is it the intention that Throwable be used for this purpose?

 
 Yes.

Why is it possible to throw an Object?
I think throw and catch should be restricted to Throwable and
derived types.


Re: -nogc

2009-04-23 Thread Frank Benoit
I am using D for a real time test system. There i have to make sure that
real time code does never use direct or indirect allocations.
I can use the GC in the non real time thread and at start up. I can
preallocate as much as I want. Just, it is not allowed in IRQ handler,
certainly.

What i did is, i patched the GC to have a callback in the allocation
function. My application can register for that callback and checks the
current thread. If it is a real time thread, an error is generated.

The disadvantage is, it is a runtime check. The advantage is, i can mix
code that can use the GC and code that can't.


What does this linker messages try to tell me?

2009-04-19 Thread Frank Benoit
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(AbstractObservableList)
 Offset F0567H Record
Type 00C3
 Error 1: Previous Definition Different :
_D3org7eclipse4core11databinding10observable4list22AbstractObservabl
eList22AbstractObservableList3addMFC6ObjectZb
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(AbstractObservableList)
 Offset F070DH Record
Type 00C3
 Error 1: Previous Definition Different :
_D3org7eclipse4core11databinding10observable4list22AbstractObservabl
eList22AbstractObservableList6removeMFC6ObjectZb
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(PrintWriter)  Offset 0ABF6H
Record Type 00C3
 Error 1: Previous Definition Different :
_D4java2io11PrintWriter11PrintWriter5printMFAaZv
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(PrintWriter)  Offset 0AEA6H
Record Type 00C3
 Error 1: Previous Definition Different :
_D4java2io11PrintWriter11PrintWriter7printlnMFAaZv
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(PrintWriter)  Offset 0AFF3H
Record Type 00C3
 Error 1: Previous Definition Different :
_D4java2io11PrintWriter11PrintWriter5writeMFAaZv
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(PrintWriter)  Offset 0B038H
Record Type 00C3
 Error 1: Previous Definition Different :
_D4java2io11PrintWriter11PrintWriter5writeMFAaiiZv
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(PrintStream)  Offset 0827CH
Record Type 00C3
 Error 1: Previous Definition Different :
_D4java2io11PrintStream11PrintStream5printMFAaZv
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(PrintStream)  Offset 0852CH
Record Type 00C3
 Error 1: Previous Definition Different :
_D4java2io11PrintStream11PrintStream7printlnMFAaZv
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(NumberToFloatConverter)
 Error 42: Symbol Undefined _D3com3ibm3icu4text12NumberFormat12__ModuleInfoZ
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(UpdateStrategy)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text12NumberFormat12NumberFormat18getIntegerInstanceFZC3com3ibm3icu
4text12NumberFormat12NumberFormat
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(UpdateStrategy)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text12NumberFormat12NumberFormat17getNumberInstanceFZC3com3ibm3icu4
text12NumberFormat12NumberFormat
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(BindingMessages)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text13MessageFormat13MessageFormat6formatFAaAC6ObjectZAa
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(BindingMessages)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text13MessageFormat12__ModuleInfoZ
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(DateConversionSupport)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text10DateFormat10DateFormat15getTimeInstanceFiZC3com3ibm3icu4text1
0DateFormat10DateFormat
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(DateConversionSupport)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text10DateFormat10DateFormat19getDateTimeInstanceFiiZC3com3ibm3icu4
text10DateFormat10DateFormat
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(DateConversionSupport)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text10DateFormat10DateFormat15getDateInstanceFiZC3com3ibm3icu4text1
0DateFormat10DateFormat
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(DateConversionSupport)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text16SimpleDateFormat16SimpleDateFormat7__ClassZ
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(DateConversionSupport)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text16SimpleDateFormat16SimpleDateFormat5_ctorMFAaZC3com3ibm3icu4te
xt16SimpleDateFormat16SimpleDateFormat
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(DateConversionSupport)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text10DateFormat10DateFormat7__ClassZ
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(DateConversionSupport)
 Error 42: Symbol Undefined
_D3com3ibm3icu4text16SimpleDateFormat12__ModuleInfoZ
C:\Project\dwtinst\dwt-rcp\lib\org.eclipse.core.databinding.lib(DateConversionSupport)
 Error 42: Symbol Undefined _D3com3ibm3icu4text10DateFormat12__ModuleInfoZ
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(AbstractSet)
 Error 42: Symbol Undefined
_D4java4util18AbstractCollection18AbstractCollection8iteratorMFZC4java4util8Iterat
or8Iterator
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(AbstractSet)
 Error 42: Symbol Undefined
_D4java4util18AbstractCollection18AbstractCollection4sizeMFZi
C:\Project\dwtinst\dwt-rcp\lib\dwt-base.lib(AbstractSet)
 Error 42: Symbol Undefined
_D4java4util10Collection10Collection7opApplyMFDFKC6ObjectZiZi


Re: What does this linker messages try to tell me?

2009-04-19 Thread Frank Benoit
Christopher Wright schrieb:
 There are two definitions for AstractObservableList.add(Object) in
 org.eclipse.core.databinding.observable.list.AstractObservableList.
 
 Most of the rest of the problems are the same issue, just for different
 functions.
 
 I would guess that you built one version, updated, and built again
 without first cleaning, and somehow got duplicate object files somewhere.
 
 There are also some undefined symbols. If you haven't modified your dwt
 working copy, I'd delete it and install from scratch.

Thanks, that helped a lot.


Re: Navigate from ClassInfo to TypeInfo

2009-04-16 Thread Frank Benoit
Fawzi Mohamed schrieb:

 For people interested in runtime introspection tango.core.RuntimeTraits
 might be interesting.
 
 Fawzi
 

After the next tango release :)


Re: Navigate from ClassInfo to TypeInfo

2009-04-15 Thread Frank Benoit
Daniel Keep schrieb:
 
 davidl wrote:
 在 Wed, 15 Apr 2009 10:14:42 +0800,Jarrett Billingsley
 jarrett.billings...@gmail.com 写道:

 2009/4/14 davidl dav...@nospam.org:
 Send this object to vararg func, and retrieve the TypeInfo there and
 return?
 No.  The typeinfo passed to vararg functions is also determined at
 compile-time.
 so it's a bug?

 I think vararg funcs always want the real typeinfo of the object
 
 No, they get the typeinfo of what they're passed.
 
 class A {}
 class B : A {}

 void foo(...) {}

 void bar(A a) { foo(a); }

 void main()
 {
 scope b = new B;
 bar(b);
 }
 
 bar cannot possibly know what the real TypeInfo of a is.  But that
 doesn't matter because it's passing an A with A's TypeInfo.  And if foo
 is maybe interested in Bs, then it can just try to up-cast.
 
   -- Daniel

Or it can request the classinfo of the passed object. Hey, and now the
typeinfo please :)


Re: Navigate from ClassInfo to TypeInfo

2009-04-15 Thread Frank Benoit
Daniel Keep schrieb:
 Ok.  What do you propose to do with this TypeInfo?
 
 The ONLY thing a given TypeInfo_Class gives you is the ClassInfo, which
 you already have.  The TypeInfo object itself gives you getHash, equals
 and compare, all of which are in Object and thus redundant, tsize which
 is the size of a pointer, swap which I can't see a use for, next which
 is useless, init which is also redundant and flags which is already in
 ClassInfo.
 
 Again, why do you even want that specific TypeInfo when it is less
 useful than the ClassInfo?
 
   -- Daniel

I need to have a something to retrieve and pass around to hold all
available information about a type. Including classes, interfaces and
primitives.
Because of ClassInfo cannot have information about primitives, I need to
work with TypeInfo.
Because of I have that need to retrieve that something from any object
reference also, i need a way from classinfo to typeinfo.



Re: Navigate from ClassInfo to TypeInfo

2009-04-15 Thread Frank Benoit
Daniel Keep schrieb:
 
 Frank Benoit wrote:
 Daniel Keep schrieb:
 Ok.  What do you propose to do with this TypeInfo?

 The ONLY thing a given TypeInfo_Class gives you is the ClassInfo, which
 you already have.  The TypeInfo object itself gives you getHash, equals
 and compare, all of which are in Object and thus redundant, tsize which
 is the size of a pointer, swap which I can't see a use for, next which
 is useless, init which is also redundant and flags which is already in
 ClassInfo.

 Again, why do you even want that specific TypeInfo when it is less
 useful than the ClassInfo?

   -- Daniel
 I need to have a something to retrieve and pass around to hold all
 available information about a type. Including classes, interfaces and
 primitives.
 Because of ClassInfo cannot have information about primitives, I need to
 work with TypeInfo.
 Because of I have that need to retrieve that something from any object
 reference also, i need a way from classinfo to typeinfo.

 
 I remember having to do something similar once.  I think I solved it by
 carrying around these:
 
 struct ExTypeInfo
 {
 TypeInfo ti;
 ClassInfo ci;
 }
 
 That, or you could store them as Objects, and then use upcasts to work
 out which it is.
 
 if( auto ti = cast(TypeInfo) info )
 // It's a general type info

 else if( auto ci = cast(ClassInfo) info )
 // It's a class

 else
 assert(false);
 
   -- Daniel

Ick! Right, that is doable.
But still, D lacks this navigation and it should be added.
Working with Object is really the ugly way.





Re: Navigate from ClassInfo to TypeInfo

2009-04-15 Thread Frank Benoit
Frank Benoit schrieb:
 I need to retrieve an instance of TypeInfo from an object instance at
 runtime.
 
 TypeInfo info = typeid(obj) // does not work, only compile time
 
 TypeInfo info = obj.classinfo.; // how to navigate to TypeInfo?
 
 Is that possible?
 If not, why? And can it be added (D1)?

See also:
http://d.puremagic.com/issues/show_bug.cgi?id=2836


Navigate from ClassInfo to TypeInfo

2009-04-14 Thread Frank Benoit
I need to retrieve an instance of TypeInfo from an object instance at
runtime.

TypeInfo info = typeid(obj) // does not work, only compile time

TypeInfo info = obj.classinfo.; // how to navigate to TypeInfo?

Is that possible?
If not, why? And can it be added (D1)?


DWT for D2+Phobos help wanted

2009-04-14 Thread Frank Benoit
The DWT2 repository is prepared to work with D2+phobos.
It compiles. But there are some methods, that have only the D1+Tango
implementation and lack the version the phobos specific code.
Doing that is straight forward and just need to be done.
Help from the phobos users would be very appreciated.
Thanks

http://hg.dsource.org/projects/dwt2
Ready for Phobofication:
- base
- org.eclipse.swt.gtk.linux.x86
- org.eclipse.swt.win32.win32.x86
- org.eclipse.swt.snippets


Re: org.eclipse.core.jobs works test case

2009-04-13 Thread Frank Benoit
yidabu schrieb:
 Exception with test case:
 
 3249 Fatal dwt - java\util\HashSet.d 31: implementation missing in file 
 java\util\HashSet.d line 31
 3255 Fatal dwt - java\util\HashSet.d 31: Please create a bug report at 
 http://www.dsource.org/projects/dwt
 3261 Fatal dwt - java\util\HashSet.d 31: exiting ...
 
 
 the code:
 

I did some fixes


Re: Std Phobos 2 and logging library?

2009-04-11 Thread Frank Benoit
Andrei Alexandrescu schrieb:
 Zz wrote:
 Hi,

 Are there any plans for a logging library in Std Phobos 2.0?

 Zz
 
 I wanted to add logging support for a while now but am undecided about
 the API to use. Log4J is quite popular but quite complicated. There are
 a number of simpler APIs out there but I couldn't figure out which is
 the best.
 
 If anyone has ideas and/or code to contribute, that would be great.
 
 
 Andrei

Why not start with the one from tango? Why has everything to be
different? If it really is not important, why do you have to make it
different than tango? Every code that uses tango and phobos, or wants to
support both has to reimplemnent an intermediate abstraction layer.




Re: Format.convert problme

2009-04-05 Thread Frank Benoit
Qian Xu schrieb:
 Hi All,
 
 tango.text.convert.Format provides a nice function to convert anything
 to string.
 
 It works perfect except the argument is a pointer type.
 It will print the address of a pointer instead of its value
 
 For instance: 
 int* i = new int;
 *i = 10;
 Format.convert({}, i); // - the address of the pointer
 --
 
 How to let it print the value instead of the address?
 Because I wanna write a dump function to dump the value of any data type
 (also void, null)
 
 
 
 

This is not really an exact answer to your question... :)
It seems you want to output trace information. Stdout (which seems you
are using) is not thread safe and will generate AV/segf if accessed
concurrently.
Specially for printing trace info, there is
tango.util.log.Trace
it is a Stdout replacement that is synchronized, and it also has a
memory() function, that lets you print raw memory as a dump.


Re: dsss with dmd2?

2009-03-30 Thread Frank Benoit
Trass3r schrieb:
 I got the dmd2 compiler in the PATH, thus dsss correctly uses phobos
 imports and stuff from the dmd2 directory.
 BUT what it does not is setting the D_Version2 version??? Why does that
 happen, isn't that set by the compiler?

It is set by the compiler. But dsss has an own D compiler included to
retrieve the imports and pragmas. If you see error messages, they might
come from the dsss internal DMD frontend.
You can set the versions in the compiler profile, see dsss/etc/rebuild/


Re: Problem building DWT addons

2009-03-29 Thread Frank Benoit
Mike James schrieb:
 I'm having a problem building the DWT addons. It takes about 45 minutes then 
 fails with the following problem:
 
 D:\dwt-addonsdsss build -version=TANGOSVN
 WARNING: Section for nonexistant file test.d.
 Creating imports for DD-dwtx
 
 dwtx = DD-dwtx
 Digital Mars Librarian Version 8.02n
 Copyright (C) Digital Mars 2000-2007 All Rights Reserved
 http://www.digitalmars.com/ctg/lib.html
 
 Error: cannot open response file
 Command c:\dsss\bin\rebuild.exe returned with code -1, aborting.
 Error: Command failed, aborting.
 
 D:\dwt-addonsdsss build -version=TANGOSVN
 WARNING: Section for nonexistant file test.d.
 Creating imports for DD-dwtx
 
 dwtx = DD-dwtx
 Digital Mars Librarian Version 8.02n
 Copyright (C) Digital Mars 2000-2007 All Rights Reserved
 http://www.digitalmars.com/ctg/lib.html
 
 Error: cannot open response file
 Command c:\dsss\bin\rebuild.exe returned with code -1, aborting.
 Error: Command failed, aborting.
 
 D:\dwt-addons
 
 I'm using Windows XP, DMD 1.041, Tango 0.99.8 and the latest DWT trunk.
 
 
 Regards, mike.
 

Yes, i can confirm this behavior.
But i don't know the cause nor a solution.


Re: Failed to build dwt-addons

2009-03-27 Thread Frank Benoit
Mike James schrieb:
 Hi.
 
 I've tried to build the dwt-addons but get the following error messages:
 
 D:\dwt-addonsdsss build -version=TANGOSVN
 WARNING: Section for nonexistant file test.d.
 Creating imports for DD-dwtx
 
 dwtx = DD-dwtx
 dwtx\sleak\Sleak.d(238): Error: incompatible types for ((line) ~ (\x0a)): 
 'Fra
 meInfo' and 'char[1u]'
 dwtx\sleak\Sleak.d(238): Error: Can only concatenate arrays, not (FrameInfo ~ 
 ch
 ar[1u])
 Command c:\dsss\bin\rebuild.exe returned with code 1, aborting.
 Error: Command failed, aborting.
 
 D:\dwt-addons
 
 
 I am using the latest dwt trunk, dmd 1.041 and Tango trunk. Is this another 
 problem with the compiler differences?
 
 Regards, Mike.
 

It is fixed now.


Re: digitalmars lib.exe, what does the pagesize mean?

2009-03-27 Thread Frank Benoit
Kagamin schrieb:
 Frank Benoit Wrote:
 
 What does the pagesize mean? When is it needed to increase? What is the
 cost?
 
 How's the pagesize related to lib.exe? You should specify context more 
 precisely.

http://www.digitalmars.com/ctg/lib.html
The question is about the -p parameter.


Re: The new DWT2

2009-03-26 Thread Frank Benoit
Saaa schrieb:
 Meanwhile the org.eclipse.swt.win32.win32.x86 tree builds for D2. But
 will not be usable until the missing impls are done.
 
 What does it mean for an implMissing to not be encapsulated within a version 
 check?
 Didn't the tango version need those implementations? 
 
 

Yes, also did add those in the beginning of dwt. So if there is no tango
implementation, that means, that function was never called before. So it
can stay not implemented.


Re: The new DWT2

2009-03-25 Thread Frank Benoit
Saaa schrieb:
 dmd 2.026
 phobos
 newest ruby one-click :)
 
 What am I doing wrong ?
 
  C:\_D\Compiler\dwt2rake
 (in C:/_D/Compiler/dwt2)
 Cleaning
 Building dwt-base
 Building org.eclipse.swt.win32.win32.x86
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\COMTYPES.d(19):
  
 Error: org.eclipse.swt.internal.win32.WINTYPES.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\win32\WINTYPES.d(190)
  
 conflicts with
 org.eclipse.swt.internal.ole.win32.extras.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\extras.d(54)
 
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\OBJIDL.d(125):
 Error: org.eclipse.swt.internal.ole.win32.extras.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\extras.d(54)
 conflicts with
 org.eclipse.swt.internal.win32.WINTYPES.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\win32\WINTYPES.d(190)
 
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\OBJIDL.d(382):
 Error: org.eclipse.swt.internal.ole.win32.extras.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\extras.d(54)
 conflicts with
 org.eclipse.swt.internal.win32.WINTYPES.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\win32\WINTYPES.d(190)
 
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\OBJIDL.d(785):
 Error: org.eclipse.swt.internal.ole.win32.extras.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\extras.d(54)
 conflicts with
 org.eclipse.swt.internal.win32.WINTYPES.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\win32\WINTYPES.d(190)
 
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\ifs.d(65):
 Error: org.eclipse.swt.internal.win32.WINTYPES.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\win32\WINTYPES.d(190)
 conflicts with
 org.eclipse.swt.internal.ole.win32.extras.IID
 at
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\internal\ole\win32\extras.d(54)
 
 C:\_D\Compiler\dwt2\org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\events\SelectionListener.d(19):
 module Traits cannot read file 'tango\core\Traits.d'
 rake aborted!
 compile error
 C:/_D/Compiler/dwt2/rakefile:138:in `buildTree'
 
 

Meanwhile the org.eclipse.swt.win32.win32.x86 tree builds for D2. But
will not be usable until the missing impls are done.


Re: Allowing relative file imports

2009-03-25 Thread Frank Benoit
Daniel Keep schrieb:
 There have been at least two reports thus far (2103 and 2759) of people
 attempting to use relative imports with the -J compile-time file import
 feature.

Please note also my posting Proposal for fixing import(file) on 14th
March in this NG.


Re: No map file?

2009-03-25 Thread Frank Benoit
Derek Parnell schrieb:
 On Mon, 23 Mar 2009 10:02:28 +0100, Frank Benoit wrote:
 
 How can i make DMD (link/optlink) not to generate a map file?

 -L/NOM or -LNOMAP

 both seem not work.
 
 You can't using dmd. It doesn't generate the right linker options for you
 to avoid the map file. I do it in Bud by not having DMD invoke the linker,
 instead I have Bud invoke the linker with the right options.
 
 The easiest way is to delete the .map files after compiling.
 

Ok, so i created http://d.puremagic.com/issues/show_bug.cgi?id=2760
Thanks for the answer.


idup portable D1/D2

2009-03-25 Thread Frank Benoit
I want to make code compilable with D1+D2.

So i thought, i can make

version(D_Version2){
} else { // D1
  string idup( char[] str ){ return str.dup; }
}

But this does not work.
D1:
str.idup;   // compile error
str.idup(); // OK

D2:
str.idup;   // OK
str.idup(); // compile error

Ideas?


Re: idup portable D1/D2

2009-03-25 Thread Frank Benoit
hm, the moment of pressing the send button is often enough a moment of
enlightment :)

version( D_Version2 ){
mixin(invariant(T)[] _idup(T)( T[] str ){ return str.idup; });
} else { // D1
String _idup( char[] str ){
return str.dup;
}
}

str._idup(); // compiles with D1+D2


digitalmars lib.exe, what does the pagesize mean?

2009-03-25 Thread Frank Benoit
What does the pagesize mean? When is it needed to increase? What is the
cost?


Re: DWT2 Windows building error

2009-03-24 Thread Frank Benoit
yidabu schrieb:
 snitppet147 
   with dmd 1.037 dwt-win, exe size is 2.47 MB
   with dmd 1.041 dwt2, exe size is 2.75 MB
 
 

oh, i thought the old one was bigger.


Re: The new DWT2

2009-03-24 Thread Frank Benoit
Saaa Wrote:

 dmd 2.026
 phobos
 newest ruby one-click :)
 
 What am I doing wrong ?

I started with making it phobos compatible, but it is not yet completed. You 
are welcome to help (see DWT2 D2+Phobos help needed). 



Re: DWT2 Windows building error

2009-03-23 Thread Frank Benoit
davidl schrieb:
 (in D:/digitalmars/dsource/dwt2)
 rake aborted!
 wrong number of arguments (2 for 1)
 D:/digitalmars/dsource/dwt2/rakefile:208:in `task'
 (See full trace by running task with --trace)
 
 seems your rake is more advancing?

I use rake version 0.8.3, ruby 1.9.1



No map file?

2009-03-23 Thread Frank Benoit
How can i make DMD (link/optlink) not to generate a map file?

-L/NOM or -LNOMAP

both seem not work.


Re: DWT2 Windows building error

2009-03-22 Thread Frank Benoit
yidabu schrieb:
 how to building lib file on Windows? 
 Run Rake, obj fiels generated, Should I to run lib a.obj b.obj  to 
 generated dwt2.lib?
 

Building libs and apps is not yet integrated. At the moment i just use
it to compile.


Re: DWT2 Windows building error

2009-03-22 Thread Frank Benoit
yidabu schrieb:
 how to building lib file on Windows? 
 Run Rake, obj fiels generated, Should I to run lib a.obj b.obj  to 
 generated dwt2.lib?
 

Building libs and apps is not yet integrated. At the moment i just use
it to compile.


The new DWT2

2009-03-21 Thread Frank Benoit
Now there is the new hg repository for DWT2.

DWT2 is like dwt-win/linux/addons, but the folders are organized in the
original directory structure of the Eclipse sources. This also means the
packages are again like the original.

DWT.CENTER =
SWT.CENTER

import dwt.widgets.Button; =
import org.eclipse.swt.widgets.Button;

This makes future porting of more files and versions much more easier.

I started to make dwt2 compilable also for D2+Phobos. Support for
D1+Tango will certainly stay.

The repositories dwt-win/linux/addons/samples will stay and i will
support them with bug fixes for a while. But I plan to do my future work
in DWT2.

Get it with Mercurial (hg) Version Control software:
First get:
hg clone http://hg.dsource.org/projects/dwt2
To get later changes from the server
hg pull -u

To build you need Rake, that is the Ruby make tool and is part of a
standard Ruby installation. Also DMD needs to be in the path environment
variable.


Re: The new DWT2

2009-03-21 Thread Frank Benoit
Saaa schrieb:
 I'll be trying it out for dmd 2.. how far along is it at the moment? 

At the moment the refactoring is complete for D1+Tango.
The 'base' tree compiles also for D2+Tango and i am working on the swt
tree. But compile means really just compile. There is implementation
work needed for Phobos.

Please see also my posting: DWT2 D2+Phobos help needed


Re: The new DWT2

2009-03-21 Thread Frank Benoit
Christopher Wright schrieb:
 It's well motivated from a development standpoint. I don't see what it
 contributes, otherwise.

there are existing naming conflicts of packages.
org.eclipse.swt = dwt
that was the start. Well then, rename all other swt to dwt also. So we have
SWT = DWT
SWTError = DWTError
SWTException = DWTException
SWTEventObject = DWTEventObject
SWTEventListener = DWTEventListener
then there are the packages from jface. Oh the first problem.
org.eclipse.jface where to map those. Ok, have all the future packages
from org.eclipse in dwtx, dwtx to be an abbreviation for org.eclipse
org.eclipse.jface = dwtx.jface
...
Oh, oh, now there is org.eclipse.osgi and org.osgi, now it gets a bit ugly.
You see, where this is going to?
All those renaming produce work in comparing versions and updates. A
porting project like this needs lots of comparing and merging.
It produces work for me, the developer. And I think my time is the most
valuable resource the dwt project has. And really, I see not what those
renaming contribute. Instead, when the original namings are used,
examples and snippets can be used without or less change, that is a
contribute for the user.



Re: DWT2 Windows building error

2009-03-21 Thread Frank Benoit
yidabu schrieb:
 Rake building error:
 
 dwt2Rake base --trace
 (in .../dwt2)
 ** Invoke base (first_time)
 ** Execute base
 Building base/src
 dmd @...dwt2\rsp
 dwt2\base\src\java\lang\wrappers.d(15): Error: identifier 'equals_t
 ' is not defined
 dwt2\base\src\java\lang\wrappers.d(15): Error: equals_t is used as
 a type
...

 Ruby Windows 1.91, Rake 0.83
 
 Tango 0.99.7, Revision:4052, last changed date:2008-10-30
 DMD 1.037

for dwt2 i use the tango 0.99.8 ( see svn tags/releases/0.99.8), there
the type equals_t is defined in object.di. For dmd i use 1.041.


Re: Response files

2009-03-21 Thread Frank Benoit
Jason House schrieb:
 Walter Bright Wrote:
 
 Frank Benoit wrote:
 DMD 1.041 on windows does support response files, that is a file
 containing arguments.
 On Linux dmd does not understand that.
 The windows response files date back to the problem DOS/Windows had with 
 only a very short command line length was allowed. So the arguments were 
 put into a file instead.

 It's probably a good idea to do it for Linux, too.
 
 Ick. Why? Command files are hacks for Window's shortcomings. Why spread such 
 hacks across all platforms? The linux command line is already well adapted to 
 handle this kind of thing.

Because, imagine you set up a build process for your application. Why
should i have to care about that difference in my 'makefile',
'rakefile', ... whatever ?


Re: Response files

2009-03-21 Thread Frank Benoit
Jason House schrieb:
 Walter Bright Wrote:
 
 Frank Benoit wrote:
 DMD 1.041 on windows does support response files, that is a file
 containing arguments.
 On Linux dmd does not understand that.
 The windows response files date back to the problem DOS/Windows had with 
 only a very short command line length was allowed. So the arguments were 
 put into a file instead.

 It's probably a good idea to do it for Linux, too.
 
 Ick. Why? Command files are hacks for Window's shortcomings. Why spread such 
 hacks across all platforms? The linux command line is already well adapted to 
 handle this kind of thing.

Even in cygwin, there seems to be a 32k limit on the command line.
On Linux you can find out that limit with
getconf ARG_MAX (=2097152 on my linux box)

This seems to be enough, however, 32k/64k are not.
There is a related bug, because the dmd response file workaround is not
working with 64k, see http://d.puremagic.com/issues/show_bug.cgi?id=2705




Re: Response files

2009-03-21 Thread Frank Benoit
Walter Bright schrieb:
 Frank Benoit wrote:
 Because, imagine you set up a build process for your application. Why
 should i have to care about that difference in my 'makefile',
 'rakefile', ... whatever ?
 
 I use different makefiles for Windows, Linux, and OSX. It's easier than
 tearing my few strands of hair out trying to figure out how to remove
 system differences.

Right, this is because of such stuff. With dmd acting the same, it would
be one step easier.

On the other hand, separated build scripts are against DRY.


Re: DWT2 Windows building error

2009-03-21 Thread Frank Benoit
yidabu schrieb:
 Rake building error:
 
 dwt2Rake base --trace
 (in .../dwt2)
 ** Invoke base (first_time)
 ** Execute base
 Building base/src
 dmd @...dwt2\rsp
 dwt2\base\src\java\lang\wrappers.d(15): Error: identifier 'equals_t
 ' is not defined
 dwt2\base\src\java\lang\wrappers.d(15): Error: equals_t is used as
 a type
...

 Ruby Windows 1.91, Rake 0.83
 
 Tango 0.99.7, Revision:4052, last changed date:2008-10-30
 DMD 1.037

for dwt2 i use the tango 0.99.8 ( see svn tags/releases/0.99.8), there
the type equals_t is defined in object.di. For dmd i use 1.041.


Response files

2009-03-20 Thread Frank Benoit
DMD 1.041 on windows does support response files, that is a file
containing arguments.
On Linux dmd does not understand that. Instead a build mechanism needs
to handle dmd in a special way on linux.
cat rsp | xargs dmd

Would be nice, if both can be used in the same way.


D2 std_array is a dead link

2009-03-18 Thread Frank Benoit
http://www.digitalmars.com/d/2.0/phobos/std_array.html

Not Found

The requested URL /d/2.0/phobos/std_array.html was not found on this server.


Re: Segfault (NullPointerException) in Linux

2009-03-18 Thread Frank Benoit
Qian Xu schrieb:
--- code 2 (current solution) --
 
 public test(MyObj obj)
 {
   if (obj !is null 
   obj.getObj2 !is null 
   obj.getObj2.getObj3 !is null)
   {
  obj.getObj2.getObj3.test();
   }
 }
 
 --

If you want to be able to return something like nothing, you can use
NullObject. That is, return an object that lets you navigate the
references and lets you test for it being a null object.

auto o = obj.getObj2.getObj3;
if( !o.isNull() ){
o.test();
}


Proposal for fixing import(file)

2009-03-14 Thread Frank Benoit
In Java there is the runtime possibility to access data files from the
same jar by getClass().getResourceAsStream(). This is used to
externalize data. With the D import(file), we have this feature at
compiletime, which is fine.

But the problem in D is, file is search in a global scope (-Jpath).
So having such resource files used only locally by the module is not
possible. It must be taken care about name conflicts.

A second problem, I see is, that the generated .di files still have the
'import(file)' statement in them. This means, that the user of a .di
still needs the resource file, taking care about more files in this -Jpath.

I want to suggest to make the imported file relative to the module by
default and if the path starts with a '/' search in the -Jpath.
import(file) // search file in the directory of this module
import(/file) // search file in -Jpath
import(sub/file) // search in the sub package sub for the file
For security reason, the .. might be forbidden.

And i want to suggest to replace the import statement with the imported
file data (as a literal) for the generated .di file. This makes using
the .di more easy and ensures that the compiled object file is using the
same data as the .di file.






Re: Proposal for fixing import(file)

2009-03-14 Thread Frank Benoit
Tim M schrieb:
 On Sun, 15 Mar 2009 02:22:05 +1300, Frank Benoit
 keinfarb...@googlemail.com wrote:
 
 In Java there is the runtime possibility to access data files from the
 same jar by getClass().getResourceAsStream(). This is used to
 externalize data. With the D import(file), we have this feature at
 compiletime, which is fine.

 But the problem in D is, file is search in a global scope (-Jpath).
 So having such resource files used only locally by the module is not
 possible. It must be taken care about name conflicts.

 A second problem, I see is, that the generated .di files still have the
 'import(file)' statement in them. This means, that the user of a .di
 still needs the resource file, taking care about more files in this
 -Jpath.

 I want to suggest to make the imported file relative to the module by
 default and if the path starts with a '/' search in the -Jpath.
 import(file) // search file in the directory of this module
 import(/file) // search file in -Jpath
 import(sub/file) // search in the sub package sub for the file
 For security reason, the .. might be forbidden.

 And i want to suggest to replace the import statement with the imported
 file data (as a literal) for the generated .di file. This makes using
 the .di more easy and ensures that the compiled object file is using the
 same data as the .di file.



 
 Doesn't it work with templates and __FILE__ ?

Sorry, i don't understand that question.
Can you explain?


Re: D compiler benchmarks

2009-03-08 Thread Frank Benoit
Robert Clipsham schrieb:
 Georg Wrede wrote:
 Robert Clipsham wrote:
 Hi all,

 I have set up some benchmarks for dmd, ldc and gdc at
 http://dbench.octarineparrot.com/.

 There are currently only 6 tests all from
 http://shootout.alioth.debian.org/gp4/d.php. My knowledge of phobos
 is not great enough to port the others to tango (I've chosen tango as
 ldc does not support phobos currently, so it make sense to choose
 tango as all compilers support it). If you would like to contribute
 new tests or improve on the current ones let me know and I'll include
 them next time I run them.

 All source code can be found at
 http://hg.octarineparrot.com/dbench/file/tip.

 Let me know if you have any ideas for how I can improve the
 benchmarks, I currently plan to add compile times, size of the final
 executable and memory usage (if anyone knows an easy way to get the
 memory usage of a process in D, let me know :D).

 The first run should not be included in the average.

 
 Could you explain your reasoning for this? I can't see why it shouldn't
 be included personally.

fill up of disk and memory caches. That is why the first run has a
different timing to the other runs.



Re: Compilation of .di needes the imported file and -J setup correctly

2009-03-04 Thread Frank Benoit
Frank Benoit schrieb:
 When doing incremental compilation .di shall help. As I understand it,
 it should be possible to compile the modules for a lib and provide the
 object files or a library and the .di files.
 
 When doing this, i encounter problems, because now, the user code also
 needs the files from the libs setup correctly in the -J path. This makes
 the build process more complex. naming conflicts can occur.
 
 To solve this, I want to suggest, that at .di generation the
 text-imported files are inserted into the generated .di as a literal. So
 the .di file can stand for there own, without the need for any -J option.

Another argument for replacing text-imports with a content-literal is:
The .di has to fulfill a contract, that is it matches to the object file.
If the text-import is done over again by every use of the .di, this
contract is no more guaranteed.


Re: Is implicit string literal concatenation a good thing?

2009-02-25 Thread Frank Benoit
Miles schrieb:
 Frank Benoit wrote:
 Find the bug:
 static string[] KEYWORDS = [ abstract, alias, align, asm,
 
 Out of curiosity, are you trying to create a D parser? Because
 private:, protected:, public: and ~this are not keywords.

Thats just a snippets I got from a dwt user.
After pasting that into a Java source file, i got an error for the
missing comma, and I found that interesting.


Is implicit string literal concatenation a good thing?

2009-02-22 Thread Frank Benoit
Find the bug:
static string[] KEYWORDS = [ abstract, alias, align, asm,
assert, auto, body, bool, break, byte, case,
cast, catch, cdouble, cent, cfloat, char, class,
const, continue, creal, dchar, debug, default,
delegate, delete, deprecated, do, double, else,
enum, export, extern, false, final, finally,
float, for, foreach, foreach_reverse, function,
goto, idouble, if, ifloat, import, in, inout,
int, interface, invariant, ireal, is, lazy, long,
mixin, module, new, null, out, override, package,
pragma, private, private:, protected, protected:,
public, public:, real, return, scope, short,
static, struct, super, switch, synchronized,
template, this, throw, true, try, typedef, typeid,
typeof, ubyte, ucent, uint ulong, union, unittest,
ushort, version, void, volatile, wchar, while,
with, ~this ];

There is a comma missing : uint ulong


Re: Compare two objects

2009-02-10 Thread Frank Benoit
(a  a == b)
is sufficient for his use case. Because he wants the way with the least
amount of typing.


Re: Compare two objects

2009-02-10 Thread Frank Benoit
Frank Benoit schrieb:
 (a  a == b)
 is sufficient for his use case. Because he wants the way with the least
 amount of typing.

hm, no :(


Re: Protection in BaseClassList: semantics undefined?

2009-01-22 Thread Frank Benoit
Jarrett Billingsley schrieb:
 As far as most people can tell, it's an artifact from very early on in
 D's development.  It was probably originally supposed to have MI but
 that was dropped.  The compiler accepts public/private/protected on
 the base class but it's useless as it breaks things.

http://d.puremagic.com/issues/show_bug.cgi?id=177



Re: Exception in (0): invalid utf8 input

2008-11-30 Thread Frank Benoit
I added a fix for dwt-win.
Please verify that it works for you.


Re: Exception in (0): invalid utf8 input

2008-11-30 Thread Frank Benoit
yidabu schrieb:
 On Sun, 30 Nov 2008 09:27:59 +0100
 Frank Benoit [EMAIL PROTECTED] wrote:
 
 I added a fix for dwt-win.
 Please verify that it works for you.
 
 I upated dwt-win, run jface sample ActionAndStatusbar causes Access Violation.
 

is there location where it happens?


  1   2   >