Thread overview
std.boxer problem
Apr 29, 2006
Tydr Schnubbis
Apr 29, 2006
Alexander Panek
Apr 29, 2006
Tydr Schnubbis
Apr 29, 2006
John Demme
Apr 29, 2006
Tydr Schnubbis
Apr 29, 2006
Daniel Keep
Apr 29, 2006
Sean Kelly
April 29, 2006
Why can't I cast from Object to Box?  That seems to defeat the purpose of boxing.  I get this error:

serverlist.d(185): e2ir: cannot cast from object.Object to Box
Internal error: e2ir.c 267
April 29, 2006
Tydr Schnubbis wrote:
> Why can't I cast from Object to Box?  That seems to defeat the purpose of boxing.  I get this error:
> 
> serverlist.d(185): e2ir: cannot cast from object.Object to Box
> Internal error: e2ir.c 267

Object o = new Object();
Box b = box(o);

foo bar = unbox!(foo)(b);

Regards,
Alexander Panek
April 29, 2006
Alexander Panek wrote:
> Tydr Schnubbis wrote:
>> Why can't I cast from Object to Box?  That seems to defeat the purpose of boxing.  I get this error:
>> 
>> serverlist.d(185): e2ir: cannot cast from object.Object to Box
>> Internal error: e2ir.c 267
> 
> Object o = new Object();
> Box b = box(o);
> 
> foo bar = unbox!(foo)(b);
> 
No luck.


import std.boxer;

void main()
{
    Object o = new Object();
    Box b = box(o);

    int bar = unbox!(int)(b);
}

c:\prog\test\D>dmd boxing2.d
c:\prog\dmd\bin\..\..\dm\bin\link.exe boxing2,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

boxing2.obj(boxing2)
 Error 42: Symbol Undefined _assert_3std5boxer
--- errorlevel 1


--------
Maybe it's just a configuration problem?  I've got dmd 0.155.
April 29, 2006
Tydr Schnubbis wrote:

> Alexander Panek wrote:
>> Tydr Schnubbis wrote:
>>> Why can't I cast from Object to Box?  That seems to defeat the purpose of boxing.  I get this error:
>>> 
>>> serverlist.d(185): e2ir: cannot cast from object.Object to Box
>>> Internal error: e2ir.c 267
>> 
>> Object o = new Object();
>> Box b = box(o);
>> 
>> foo bar = unbox!(foo)(b);
>> 
> No luck.
> 
> 
> import std.boxer;
> 
> void main()
> {
>      Object o = new Object();
>      Box b = box(o);
> 
>      int bar = unbox!(int)(b);
> }
> 
> c:\prog\test\D>dmd boxing2.d
> c:\prog\dmd\bin\..\..\dm\bin\link.exe boxing2,,,user32+kernel32/noi;
> OPTLINK (R) for Win32  Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> 
> boxing2.obj(boxing2)
>   Error 42: Symbol Undefined _assert_3std5boxer
> --- errorlevel 1
> 
> 
> --------
> Maybe it's just a configuration problem?  I've got dmd 0.155.

That one's a bug with templating code inside of libraries.  You need to compile your code with -release.

~John Demme
April 29, 2006
John Demme wrote:
> Tydr Schnubbis wrote:
> 
>> Alexander Panek wrote:
>>> Tydr Schnubbis wrote:
>>>> Why can't I cast from Object to Box?  That seems to defeat the purpose
>>>> of boxing.  I get this error:
>>>> 
>>>> serverlist.d(185): e2ir: cannot cast from object.Object to Box
>>>> Internal error: e2ir.c 267
>>> 
>>> Object o = new Object();
>>> Box b = box(o);
>>> 
>>> foo bar = unbox!(foo)(b);
>>> 
>> No luck.
>> 
>> 
>> import std.boxer;
>> 
>> void main()
>> {
>>      Object o = new Object();
>>      Box b = box(o);
>> 
>>      int bar = unbox!(int)(b);
>> }
>> 
>> c:\prog\test\D>dmd boxing2.d
>> c:\prog\dmd\bin\..\..\dm\bin\link.exe boxing2,,,user32+kernel32/noi;
>> OPTLINK (R) for Win32  Release 7.50B1
>> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>> 
>> boxing2.obj(boxing2)
>>   Error 42: Symbol Undefined _assert_3std5boxer
>> --- errorlevel 1
>> 
>> 
>> --------
>> Maybe it's just a configuration problem?  I've got dmd 0.155.
> 
> That one's a bug with templating code inside of libraries.  You need to
> compile your code with -release.

Ah, so I guess it's currently unusable for real projects, then.  I solved my original problem without using boxing.  So I'm okay for now. :)
April 29, 2006
Tydr Schnubbis wrote:
> Why can't I cast from Object to Box?  That seems to defeat the purpose of boxing.  I get this error:
> 
> serverlist.d(185): e2ir: cannot cast from object.Object to Box
> Internal error: e2ir.c 267

A compiler crash is never a good thing.  Please file a bug report for this :-)


Sean
April 29, 2006

Tydr Schnubbis wrote:
> John Demme wrote:
>> Tydr Schnubbis wrote:
>>
>>> Alexander Panek wrote:
>>>> Tydr Schnubbis wrote:
>>>>> Why can't I cast from Object to Box?  That seems to defeat the purpose of boxing.  I get this error:
>>>>>
>>>>> serverlist.d(185): e2ir: cannot cast from object.Object to Box
>>>>> Internal error: e2ir.c 267
>>>>
>>>> Object o = new Object();
>>>> Box b = box(o);
>>>>
>>>> foo bar = unbox!(foo)(b);
>>>>
>>> No luck.
>>>
>>>
>>> import std.boxer;
>>>
>>> void main()
>>> {
>>>      Object o = new Object();
>>>      Box b = box(o);
>>>
>>>      int bar = unbox!(int)(b);
>>> }
>>>
>>> c:\prog\test\D>dmd boxing2.d
>>> c:\prog\dmd\bin\..\..\dm\bin\link.exe boxing2,,,user32+kernel32/noi;
>>> OPTLINK (R) for Win32  Release 7.50B1
>>> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>>>
>>> boxing2.obj(boxing2)
>>>   Error 42: Symbol Undefined _assert_3std5boxer
>>> --- errorlevel 1
>>>
>>>
>>> --------
>>> Maybe it's just a configuration problem?  I've got dmd 0.155.
>>
>> That one's a bug with templating code inside of libraries.  You need to compile your code with -release.
> 
> Ah, so I guess it's currently unusable for real projects, then.  I solved my original problem without using boxing.  So I'm okay for now. :)

If I remember correctly, it's because we don't have a debug build of Phobos.  You can build one yourself (ie: rebuild phobos with debug stuff in).  Or, you can do what I did and "provide" the function that it's missing:

// Burton Radons <burton-radons[at]smocky[dot]com>
// This entry allows -unittest for testing, and/or no need
// for the -release switch
private extern (C) void assert_3std5boxer() {}

I personally just stuck that in a file called "dmdbug_std_boxer_assert.d", so that I can just remove the import when it gets fixed :)

	-- Daniel

-- 

v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP    http://hackerkey.com/