www.digitalmars.com         C & C++   DMDScript  

D - Problems and bugs in 0.76. - 0.76.zip

reply one_mad_alien hotmail.com writes:
I have returned to D (as I have some apps that would take a long time to port to
a different lang) 
I like the changes to phobos (and I'll update my DFC/win32 com libs hopefully
over the weekend) for those who are using them.

however, it seems that 0.76 still has a few issues ...

I've given up ranting about semantics over implementation 
instead here's some basics that don't work!

this archive contains the following scripts.

newtest.d : unable to 'new' a 2d array of object
newtest.d(3): Integer constant expression expected instead of w
the following code causes the error .... 
int[][] create_2d( int w, int h ) {
return new int[w][h];
}

platetest.d : template forward reference problems.
instance UserControl(MyApp ) does not match any template declaration
it does only MyApp is a forward ref.

twintest.d : more template importing tests.
instance MyControl(MyApp2 ) cannot resolve forward reference
same again, unfortunatly I can not re produce the actual error I was tracking
which was due to an typo in an included template causing the same error but not
warning that the included template contained an error.
it would be good if errors showed the included files (like gcc does)
i.e. error in foo.d(99) included from bar.d(4) included from main.d(9)


imptest.d : unable to always use fully qualified names.
imptest.d(15): undefined identifier std
I have been unable to actually repro the error but there are issues with using 
fully qualified names without an import
i.e 'std.c.stdio.printf( ..... );' 

noret.d : no return assert is NOT an Exception or Error!!
also the import is 'import std.asserterror;'
but the module is  'module std.assertexception;'
Why is AssertError NOT and Error!, and why is Error and Exception
would it not be better to follow the Java model ?
Throwable;
Error : Throwable;
Exception : Throwable;
and throw can only throw a Throwable (rather than an Object (throwables have
space for stack trace etc)
am I the only one driven to dispare 'cos A AssertError is not and Exception
and B no warning/error is given that a function has a missing return or missing
default in a switch.

inttest.d : more 'C' style cast problems (again due to forward refs etc).
inttest.d(8): can only * a pointer, not a 'int'
MORE problems with 'C' style casts, they can NEVER work in D as unlike C the
nature of statment segment '(id)' can not be determined at parse time (C/C++
knows if 'id' is a typedef of var etc at the time it is parsed).
how many times must ppl request the removal of 'C' casts 

gctest.d : phobos errors (unable to 'import internal.gc.gc;')
Attempting to compile gctest.d
Error: Error reading file 'gcx.d'
it seems that 'internal.*' are not importable.

innertest.d : an attempt to use operator new to create 'Java(tm)' style inner
classes
this was an experiment in attempting to use the 'operator new' to create Java
Style inner classes
Foo f = new( parent ) Foo( params );
however it imposible to effect the classinfo.init of the Foo or set memebers
within the new.
I think if 'new' is called then it should be able to operate in two modes
mode 1 ... it just allocates the memory D runtime does all the setup
mode 2 ... it calls into D (or D gives it the memory) and pre inits values
so D does the following:
if there is a static new with the right params
p = call operator new ( size, new params );
else
p = _d_newclass;

d initialisation of memory for class

if there is a non static new
call p.operator new ( new params )

call construction with construction params;


matchtest.d : static and instance functions with same names (different params)
matchtest.d(16): need 'this' to access member func

I have two functions both with the same name, only different params and one is
static and one is a member function, the above error implies that an explicit
'this' is required, but when it put in the error implies that D is now matching
with the static version!

matchtest2.d : static and instance functions with same names (different params)
this used but the error is about the static form
matchtest2.d(15): Error: expected 4 arguments, not 3
matchtest2.d(15): cannot implicitly convert char[3] to int
Dec 04 2003
next sibling parent reply J C Calvarese <jcc7 cox.net> writes:
one_mad_alien hotmail.com wrote:
 I have returned to D (as I have some apps that would take a long time to port
to
 a different lang) 

Welcome back.
 I like the changes to phobos (and I'll update my DFC/win32 com libs hopefully
 over the weekend) for those who are using them.

I've already spent some time working on getting your libs to compile with DMD 0.76. I don't know if it helps you any, but you can find my efforts at: http://jcc_7.tripod.com/d/ I didn't keep track of where I made changes but I've found a free program that helps compare two similar text files called WinMerge: http://winmerge.sourceforge.net/ Scroll down to see my suggestions for how fix some of you problems...
 
 however, it seems that 0.76 still has a few issues ...
 
 I've given up ranting about semantics over implementation 
 instead here's some basics that don't work!
 
 this archive contains the following scripts.
 
 newtest.d : unable to 'new' a 2d array of object
 newtest.d(3): Integer constant expression expected instead of w
 the following code causes the error .... 
 int[][] create_2d( int w, int h ) {
 return new int[w][h];
 }

I think you might want something like this (at least it compiles)... int[][] create_2d( int w, int h ) { int[][] dummy; dummy.length = h; for (int i = 0; i < h; i++) dummy[i].length = w; return dummy; }
 
 platetest.d : template forward reference problems.
 instance UserControl(MyApp ) does not match any template declaration
 it does only MyApp is a forward ref.
 
 twintest.d : more template importing tests.
 instance MyControl(MyApp2 ) cannot resolve forward reference
 same again, unfortunatly I can not re produce the actual error I was tracking
 which was due to an typo in an included template causing the same error but not
 warning that the included template contained an error.
 it would be good if errors showed the included files (like gcc does)
 i.e. error in foo.d(99) included from bar.d(4) included from main.d(9)
 
 
 imptest.d : unable to always use fully qualified names.
 imptest.d(15): undefined identifier std
 I have been unable to actually repro the error but there are issues with using 
 fully qualified names without an import
 i.e 'std.c.stdio.printf( ..... );' 

Add this line before main in imptest (compiles for me now): import std.c.stdio; /* added by JCC */
 
 noret.d : no return assert is NOT an Exception or Error!!
 also the import is 'import std.asserterror;'
 but the module is  'module std.assertexception;'
 Why is AssertError NOT and Error!, and why is Error and Exception
 would it not be better to follow the Java model ?
 Throwable;
 Error : Throwable;
 Exception : Throwable;
 and throw can only throw a Throwable (rather than an Object (throwables have
 space for stack trace etc)
 am I the only one driven to dispare 'cos A AssertError is not and Exception
 and B no warning/error is given that a function has a missing return or missing
 default in a switch.
 
 inttest.d : more 'C' style cast problems (again due to forward refs etc).
 inttest.d(8): can only * a pointer, not a 'int'
 MORE problems with 'C' style casts, they can NEVER work in D as unlike C the
 nature of statment segment '(id)' can not be determined at parse time (C/C++
 knows if 'id' is a typedef of var etc at the time it is parsed).
 how many times must ppl request the removal of 'C' casts 
 
 gctest.d : phobos errors (unable to 'import internal.gc.gc;')
 Attempting to compile gctest.d
 Error: Error reading file 'gcx.d'
 it seems that 'internal.*' are not importable.

Try replacing import internal.gc.gc; with import std.gc; The compiler seems to like the change. Good luck with these problems. Justin
 
 innertest.d : an attempt to use operator new to create 'Java(tm)' style inner
 classes
 this was an experiment in attempting to use the 'operator new' to create Java
 Style inner classes
 Foo f = new( parent ) Foo( params );
 however it imposible to effect the classinfo.init of the Foo or set memebers
 within the new.
 I think if 'new' is called then it should be able to operate in two modes
 mode 1 ... it just allocates the memory D runtime does all the setup
 mode 2 ... it calls into D (or D gives it the memory) and pre inits values
 so D does the following:
 if there is a static new with the right params
 p = call operator new ( size, new params );
 else
 p = _d_newclass;
 
 d initialisation of memory for class
 
 if there is a non static new
 call p.operator new ( new params )
 
 call construction with construction params;
 
 
 matchtest.d : static and instance functions with same names (different params)
 matchtest.d(16): need 'this' to access member func
 
 I have two functions both with the same name, only different params and one is
 static and one is a member function, the above error implies that an explicit
 'this' is required, but when it put in the error implies that D is now matching
 with the static version!
 
 matchtest2.d : static and instance functions with same names (different params)
 this used but the error is about the static form
 matchtest2.d(15): Error: expected 4 arguments, not 3
 matchtest2.d(15): cannot implicitly convert char[3] to int
 

Dec 04 2003
parent one_mad_alien hotmail.com writes:
In article <bqo6dj$1it0$1 digitaldaemon.com>, J C Calvarese says...
one_mad_alien hotmail.com wrote:
 I have returned to D (as I have some apps that would take a long time to port
to
 a different lang) 

Welcome back.

cheers :)
I've already spent some time working on getting your libs to compile 
with DMD 0.76.  I don't know if it helps you any, but you can find my 
efforts at: http://jcc_7.tripod.com/d/

good stuff,
I didn't keep track of where I made changes but I've found a free 
program that helps compare two similar text files called WinMerge:
http://winmerge.sourceforge.net/

I'll check it out, currently I use Araxis Merge (bought it a couple of years ago, as it works well with perforce)
 newtest.d : unable to 'new' a 2d array of object
 newtest.d(3): Integer constant expression expected instead of w
 the following code causes the error .... 
 int[][] create_2d( int w, int h ) {
 return new int[w][h];
 }

I think you might want something like this (at least it compiles)... int[][] create_2d( int w, int h ) { int[][] dummy; dummy.length = h; for (int i = 0; i < h; i++) dummy[i].length = w; return dummy; }

template Array( T ) { T[][] create_2D( int w, int h ) { T[][] rv = new T[][h];//new T[w][h]; for( int i = 0; i < h; i++ ) { rv[i] = new T[w]; } return rv; } } // to use int[][] twod = instance Array(int).create_2D( a,b );
 imptest.d : unable to always use fully qualified names.
 imptest.d(15): undefined identifier std
 I have been unable to actually repro the error but there are issues with using 
 fully qualified names without an import
 i.e 'std.c.stdio.printf( ..... );' 

Add this line before main in imptest (compiles for me now): import std.c.stdio; /* added by JCC */

qualified names, but either way they should either work or not work (rather than half work).
 gctest.d : phobos errors (unable to 'import internal.gc.gc;')
 Attempting to compile gctest.d
 Error: Error reading file 'gcx.d'
 it seems that 'internal.*' are not importable.

Try replacing import internal.gc.gc; with import std.gc;

std.gc does not import gc.malloc (well, not on my machine!) Mike.
Dec 06 2003
prev sibling next sibling parent "Matthew Wilson" <matthew.hat stlsoft.dot.org> writes:
 noret.d : no return assert is NOT an Exception or Error!!
 also the import is 'import std.asserterror;'
 but the module is  'module std.assertexception;'
 Why is AssertError NOT and Error!, and why is Error and Exception
 would it not be better to follow the Java model ?
 Throwable;
 Error : Throwable;
 Exception : Throwable;
 and throw can only throw a Throwable (rather than an Object (throwables

 space for stack trace etc)
 am I the only one driven to dispare 'cos A AssertError is not and

 and B no warning/error is given that a function has a missing return or

 default in a switch.

You're not. Several people are currently campaigning to incline Walter to remove such shocking warts
Dec 04 2003
prev sibling parent reply "Charles Sanders" <sanders-consulting comcast.net> writes:
Glad your back mike!

I have modified DFC a bit and added some stuff, renamed it Windy, ill put it
up shortly.
Let me know when you get the COM stuff updated id like to take a gander at
it.

C

<one_mad_alien hotmail.com> wrote in message
news:bqo23h$1cp3$1 digitaldaemon.com...
 I have returned to D (as I have some apps that would take a long time to

 a different lang)
 I like the changes to phobos (and I'll update my DFC/win32 com libs

 over the weekend) for those who are using them.

 however, it seems that 0.76 still has a few issues ...

 I've given up ranting about semantics over implementation
 instead here's some basics that don't work!

 this archive contains the following scripts.

 newtest.d : unable to 'new' a 2d array of object
 newtest.d(3): Integer constant expression expected instead of w
 the following code causes the error ....
 int[][] create_2d( int w, int h ) {
 return new int[w][h];
 }

 platetest.d : template forward reference problems.
 instance UserControl(MyApp ) does not match any template declaration
 it does only MyApp is a forward ref.

 twintest.d : more template importing tests.
 instance MyControl(MyApp2 ) cannot resolve forward reference
 same again, unfortunatly I can not re produce the actual error I was

 which was due to an typo in an included template causing the same error

 warning that the included template contained an error.
 it would be good if errors showed the included files (like gcc does)
 i.e. error in foo.d(99) included from bar.d(4) included from main.d(9)


 imptest.d : unable to always use fully qualified names.
 imptest.d(15): undefined identifier std
 I have been unable to actually repro the error but there are issues with

 fully qualified names without an import
 i.e 'std.c.stdio.printf( ..... );'

 noret.d : no return assert is NOT an Exception or Error!!
 also the import is 'import std.asserterror;'
 but the module is  'module std.assertexception;'
 Why is AssertError NOT and Error!, and why is Error and Exception
 would it not be better to follow the Java model ?
 Throwable;
 Error : Throwable;
 Exception : Throwable;
 and throw can only throw a Throwable (rather than an Object (throwables

 space for stack trace etc)
 am I the only one driven to dispare 'cos A AssertError is not and

 and B no warning/error is given that a function has a missing return or

 default in a switch.

 inttest.d : more 'C' style cast problems (again due to forward refs etc).
 inttest.d(8): can only * a pointer, not a 'int'
 MORE problems with 'C' style casts, they can NEVER work in D as unlike C

 nature of statment segment '(id)' can not be determined at parse time

 knows if 'id' is a typedef of var etc at the time it is parsed).
 how many times must ppl request the removal of 'C' casts

 gctest.d : phobos errors (unable to 'import internal.gc.gc;')
 Attempting to compile gctest.d
 Error: Error reading file 'gcx.d'
 it seems that 'internal.*' are not importable.

 innertest.d : an attempt to use operator new to create 'Java(tm)' style

 classes
 this was an experiment in attempting to use the 'operator new' to create

 Style inner classes
 Foo f = new( parent ) Foo( params );
 however it imposible to effect the classinfo.init of the Foo or set

 within the new.
 I think if 'new' is called then it should be able to operate in two modes
 mode 1 ... it just allocates the memory D runtime does all the setup
 mode 2 ... it calls into D (or D gives it the memory) and pre inits values
 so D does the following:
 if there is a static new with the right params
 p = call operator new ( size, new params );
 else
 p = _d_newclass;

 d initialisation of memory for class

 if there is a non static new
 call p.operator new ( new params )

 call construction with construction params;


 matchtest.d : static and instance functions with same names (different

 matchtest.d(16): need 'this' to access member func

 I have two functions both with the same name, only different params and

 static and one is a member function, the above error implies that an

 'this' is required, but when it put in the error implies that D is now

 with the static version!

 matchtest2.d : static and instance functions with same names (different

 this used but the error is about the static form
 matchtest2.d(15): Error: expected 4 arguments, not 3
 matchtest2.d(15): cannot implicitly convert char[3] to int

Dec 05 2003
parent one_mad_alien hotmail.com writes:
In article <bqqqqr$2edb$1 digitaldaemon.com>, Charles Sanders says...
Glad your back mike!

cheers,
I have modified DFC a bit and added some stuff, renamed it Windy, ill put it
up shortly.
Let me know when you get the COM stuff updated id like to take a gander at
it.

hopefully it will be online later (6 hours after this was posted) just got to re-tests the imbedded MSIE code. Mike.
Dec 06 2003