July 12, 2008
On Sat, 12 Jul 2008 09:09:41 +0400, Bill Baxter <dnewsgroup@billbaxter.com> wrote:

> Bill Baxter wrote:
>> Jarrett Billingsley wrote:
>>> "Walter Bright" <newshound1@digitalmars.com> wrote in message news:g591bf$j5j$2@digitalmars.com...
>>>> For Tango.
>>>>
>>>> http://www.digitalmars.com/d/1.0/changelog.html
>>>> http://ftp.digitalmars.com/dmd.1.033.zip
>>>>
>>>> http://www.digitalmars.com/d/2.0/changelog.html
>>>> http://ftp.digitalmars.com/dmd.2.017.zip
>>>
>>> Regression fixes _for the win_.  Let's see more of this ;)
>>  Maybe sooner than you were thinking:
>>  Is there any incantation I can use to make the code below work now?
>>  I saw that typeof(Type.member) is no longer considered valid, but it seems neither are any of the replacements I can think of.
>>   --------------
>> struct Thing(Scalar)
>> {
>>     Scalar x,y,z;
>> }
>>  alias typeof(Thing!(float).x) SC; /* This version used to work */
>> /+
>> bug.d(30): Error: this is not in a struct or class scope
>> bug.d(30): Error: 'this' is only allowed in non-static member functions, not main
>> bug.d(30): Error: this for x needs to be type Thing not type int
>> +/
>>  alias typeof(Thing!(float).init.x) SC2;
>> /+
>> bug.d(32): Error: undefined identifier struct Thing.init
>> bug.d(32): Error: no property 'x' for type 'void'
>> +/
>>  alias typeof((Thing!(float).init).x) SC2;
>> /+
>> bug.d(37): Error: Thing!(float).init is used as a type
>> bug.d(37): Error: no property 'x' for type 'void'
>> +/
>>  void main()
>> {
>> }
>>  --bb
>
>
> Looks like this works:
> alias typeof((Thing!(float)).init.x) SC2;
>
> But I think this is a bug.  The parentheses shouldn't be necessary there I don't think.
>
> I've also run into another case here where in a template struct
>
>    static if(typeof(*this).static_bool) { .. }
>
> fails, but with extra parens it works:
>
>    static if((typeof(*this)).static_bool) { .. }
>
> Also works if you define an extra alias
>
>    private alias typeof(*this) TypeofThis
>    static if(TypeofThis.static_bool) { .. }
>
>
> --bb

It's worth putting into bugzilla, I think.
July 12, 2008
"Don" <nospam@nospam.com.au> wrote in message news:g59vak$2mmu$1@digitalmars.com...
> Walter Bright wrote:
>> For Tango.
>>
>> http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.033.zip
>>
>> http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.017.zip
> Thanks, Walter.
> DMD1.032 smashes the record for number of bugs fixed in one release.
> It's particularly good to see some of those really old bugs get closed.
> These kind of releases do a lot for D's image, I think.

http://www.digitalmars.com/d/1.0/changelog2.html#new0175

I think that one has more ;)


July 12, 2008
Walter Bright wrote:
> For Tango.
> 
> http://www.digitalmars.com/d/1.0/changelog.html
> http://ftp.digitalmars.com/dmd.1.033.zip
> 
> http://www.digitalmars.com/d/2.0/changelog.html
> http://ftp.digitalmars.com/dmd.2.017.zip

Nice move :)
July 12, 2008
On Fri, 11 Jul 2008 18:28:17 -0700, Walter Bright wrote:

> For Tango.
> 
> http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.033.zip
> 
> http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.017.zip

Thanks :)
July 17, 2008
Walter Bright Wrote:

> For Tango.
> 
> http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.033.zip
> 

Walter,

     I've discovered a piece of my D 1.xxx source that's now broken since the dmd v1.033/v1.032 release...below is the test code to show the error(s).

// Test source typeofx.d to recreate the error
module typeofx;

private import sc = std.compiler;
private import std.stdio;
private import std.stdarg;

// Setup TypeoF const types
const uint  TF_UINT;
const ulong TF_ULONG;

template isIntConvertableP(T1, T2)
{
     private bool isIntConvertableP(in T1 v)
     {
	     if (typeid(T1) !is typeid(int))
	         return false;

         typeof(T2) v2;

         writefln("T1.typid=%s, T1.v=", typeid(T1), v,
                    " T1.tsize=%d, ", T1.sizeof,
                    "T2.typid=%s, T2.tsize=%d", typeid(T2), T2.sizeof);

         if (v >= v2.min && v <= v2.max)
             return true;
         else
             return false;
     }
}

bool isIntConvertable(...)
{
    if (_arguments.length < 2)
        return false;

    TypeInfo ti1 = _arguments[0];
    TypeInfo ti2 = _arguments[1];

    int i = (va_arg!(int)(_argptr));

    if (ti2 is typeid(ulong))
        return isIntConvertableP!(int, ulong)(i);

    if (ti2 is typeid(uint))
        return isIntConvertableP!(int, uint)(i);

    return false;
}

int main()
{
    // works for dmd v1.031,
    // doesn't work under v1.033/v1.032
    assert(isIntConvertableP!(int, ulong)(123) == true);

    // works for dmd v1.031,
    //doesn't work under v1.033/v1.032
    assert(isIntConvertable(123, TF_ULONG) == true);

    writefln();
    writefln("Compiled and tested with: \"%s v%d.%03d\"",
                 sc.name, sc.version_major, sc.version_minor);

    return 0;
}

/+ compile and run with dmd v1.031
C:\dmd>dmd typeofx.d
C:\dmd>typeofx
T1.typid=int, T1.v=123 T1.tsize=4, T2.typid=ulong, T2.tsize=8
T1.typid=int, T1.v=123 T1.tsize=4, T2.typid=ulong, T2.tsize=8
Compiled and tested with: "Digital Mars D v1.031"
C:\dmd>
+/

/+ dmd v1.033/1.032 gotten with the 1st assert
C:\dmd>dmd typeofx.d
typeofx.d(18): Error: argument ulong to typeof is not an expression
typeofx.d(42): template instance typeofx.isIntConvertableP!(int,ulong) error instantiating

C:\dmd>
+/

/+  dmd v1.033/1.032 gotten with the 2nd assert...1st assert commented in
C:\dmd>dmd typeofx.d
typeofx.d(18): Error: argument ulong to typeof is not an expression
typeofx.d(42): template instance typeofx.isIntConvertableP!(int,ulong)  error instantiating

C:\dmd>
+/

Thanks,
David L. Davis
July 17, 2008
On Thu, 17 Jul 2008 17:59:35 +0400, David L. Davis <SpottedTiger@yahoo.com> wrote:

> Walter Bright Wrote:
>
>> For Tango.
>>
>> http://www.digitalmars.com/d/1.0/changelog.html
>> http://ftp.digitalmars.com/dmd.1.033.zip
>>
>
> Walter,
>
>      I've discovered a piece of my D 1.xxx source that's now broken since the dmd v1.033/v1.032 release...below is the test code to show the error(s).
>
> // Test source typeofx.d to recreate the error
> module typeofx;
>
> private import sc = std.compiler;
> private import std.stdio;
> private import std.stdarg;
>
> // Setup TypeoF const types
> const uint  TF_UINT;
> const ulong TF_ULONG;
>
> template isIntConvertableP(T1, T2)
> {
>      private bool isIntConvertableP(in T1 v)
>      {
> 	     if (typeid(T1) !is typeid(int))
> 	         return false;
> 	
>          typeof(T2) v2;
>         writefln("T1.typid=%s, T1.v=", typeid(T1), v,
>                     " T1.tsize=%d, ", T1.sizeof,
>                     "T2.typid=%s, T2.tsize=%d", typeid(T2), T2.sizeof);
>
>          if (v >= v2.min && v <= v2.max)
>              return true;	
>          else
>              return false;
>      }
> }
>
> bool isIntConvertable(...)
> {
>     if (_arguments.length < 2)
>         return false;
>    TypeInfo ti1 = _arguments[0];
>     TypeInfo ti2 = _arguments[1];
>    int i = (va_arg!(int)(_argptr));
>    if (ti2 is typeid(ulong))
>         return isIntConvertableP!(int, ulong)(i);
>    if (ti2 is typeid(uint))
>         return isIntConvertableP!(int, uint)(i);
>    return false;
> }
>
> int main()
> {
>     // works for dmd v1.031,
>     // doesn't work under v1.033/v1.032
>     assert(isIntConvertableP!(int, ulong)(123) == true);
> 	
>     // works for dmd v1.031,
>     //doesn't work under v1.033/v1.032
>     assert(isIntConvertable(123, TF_ULONG) == true);
>
>     writefln();
>     writefln("Compiled and tested with: \"%s v%d.%03d\"",
>                  sc.name, sc.version_major, sc.version_minor);
> 	
>     return 0;
> }
>
> /+ compile and run with dmd v1.031
> C:\dmd>dmd typeofx.d
> C:\dmd>typeofx
> T1.typid=int, T1.v=123 T1.tsize=4, T2.typid=ulong, T2.tsize=8
> T1.typid=int, T1.v=123 T1.tsize=4, T2.typid=ulong, T2.tsize=8
> Compiled and tested with: "Digital Mars D v1.031"
> C:\dmd>
> +/
>
> /+ dmd v1.033/1.032 gotten with the 1st assert
> C:\dmd>dmd typeofx.d
> typeofx.d(18): Error: argument ulong to typeof is not an expression
> typeofx.d(42): template instance typeofx.isIntConvertableP!(int,ulong) error instantiating
>
> C:\dmd>
> +/
>
> /+  dmd v1.033/1.032 gotten with the 2nd assert...1st assert commented in
> C:\dmd>dmd typeofx.d
> typeofx.d(18): Error: argument ulong to typeof is not an expression
> typeofx.d(42): template instance typeofx.isIntConvertableP!(int,ulong)  error instantiating
>
> C:\dmd>
> +/
>
> Thanks,
> David L. Davis


typeof(T2) doesn't work anymore. Try replacing with T2.
BTW, error message is pretty clear and shows correct line number.

typeof(T2) v2; // Error: argument ulong to typeof is not an expression

Next time post to digitalmars.D or digitalmars.D.learn, please!
July 17, 2008
Koroskin Denis Wrote:
> typeof(T2) doesn't work anymore. Try replacing with T2.
> BTW, error message is pretty clear and shows correct line number.
> 
> typeof(T2) v2; // Error: argument ulong to typeof is not an expression
> 
> Next time post to digitalmars.D or digitalmars.D.learn, please!

Thxs for the reply...btw I'm not new here...I know all about noob questions must go to learn. This is an issue with the existing D v1.xxx compiler changing things, which is what I'm pointing out to Walter. Plus, maybe the message makes perfect sense to you...but it doesn't to me. Could you please reframe from hammering down on people in the future...to me you're the new kid on the block. :)

David L. Davis
July 17, 2008
On Thu, 17 Jul 2008 20:20:48 +0400, David L. Davis <SpottedTiger@yahoo.com> wrote:

> Koroskin Denis Wrote:
>> typeof(T2) doesn't work anymore. Try replacing with T2.
>> BTW, error message is pretty clear and shows correct line number.
>>
>> typeof(T2) v2; // Error: argument ulong to typeof is not an expression
>>
>> Next time post to digitalmars.D or digitalmars.D.learn, please!
>
> Thxs for the reply...btw I'm not new here...I know all about noob questions must go to learn. This is an issue with the existing D v1.xxx compiler changing things, which is what I'm pointing out to Walter. Plus, maybe the message makes perfect sense to you...but it doesn't to me. Could you please reframe from hammering down on people in the future...to me you're the new kid on the block. :)
>
> David L. Davis

Sorry for that, no offense was intended.
1 2
Next ›   Last »