April 17, 2009

Steven Schveighoffer wrote:
> On Fri, 17 Apr 2009 07:11:33 -0400, Daniel Keep <daniel.keep.lists@gmail.com> wrote:
> 
>>
>>
>> Steven Schveighoffer wrote:
>>> On Thu, 16 Apr 2009 21:37:29 -0400, Daniel Keep <daniel.keep.lists@gmail.com> wrote:
>>>
>>>> On a side note, I'm working on getting Tango's Layout to understand Variants and do the "proper" stringification.  Still trying to work out how to get the changes to compile without having to rebuild Tango... *grumble*
>>>
>>>
>>> Have you tried building your test app with your modified Tango file specifically?  That generally works for me:
>>>
>>> dmd variantTest.d ~/d/include/d/tango/core/Variant.d
>>>
>>> -Steve
>>
>> That works for Variant, but it doesn't seem to work with Layout.  It compiles and runs, but it doesn't seem to actually use the code I give it.
> 
> I think I ran into this before.  I think it's because Layout is a template, and is compiled when it is used, not when the module is compiled.  You have to recompile the user of Layout as well (i.e. Stdout.d, and probably Print.d).
> 
> -Steve

Ah, but I'm using it directly.  AND I've put my main function inside the modified Layout module.  What more does it want from me?  Cookies? Chocolates?!

  -- Daniel
April 17, 2009
On Fri, 17 Apr 2009 07:23:48 -0400, Daniel Keep <daniel.keep.lists@gmail.com> wrote:

>
>
> Steven Schveighoffer wrote:
>> On Fri, 17 Apr 2009 07:11:33 -0400, Daniel Keep
>> <daniel.keep.lists@gmail.com> wrote:
>>
>>>
>>>
>>> Steven Schveighoffer wrote:
>>>> On Thu, 16 Apr 2009 21:37:29 -0400, Daniel Keep
>>>> <daniel.keep.lists@gmail.com> wrote:
>>>>
>>>>> On a side note, I'm working on getting Tango's Layout to understand
>>>>> Variants and do the "proper" stringification.  Still trying to work out
>>>>> how to get the changes to compile without having to rebuild Tango...
>>>>> *grumble*
>>>>
>>>>
>>>> Have you tried building your test app with your modified Tango file
>>>> specifically?  That generally works for me:
>>>>
>>>> dmd variantTest.d ~/d/include/d/tango/core/Variant.d
>>>>
>>>> -Steve
>>>
>>> That works for Variant, but it doesn't seem to work with Layout.  It
>>> compiles and runs, but it doesn't seem to actually use the code I give
>>> it.
>>
>> I think I ran into this before.  I think it's because Layout is a
>> template, and is compiled when it is used, not when the module is
>> compiled.  You have to recompile the user of Layout as well (i.e.
>> Stdout.d, and probably Print.d).
>>
>> -Steve
>
> Ah, but I'm using it directly.  AND I've put my main function inside the
> modified Layout module.  What more does it want from me?  Cookies?
> Chocolates?!

You must be doing something wrong, it works for me:

[steves@localhost trunk]$ svn diff tango/text/convert/Layout.d
Index: tango/text/convert/Layout.d
===================================================================
--- tango/text/convert/Layout.d (revision 4435)
+++ tango/text/convert/Layout.d (working copy)
@@ -35,6 +35,8 @@

 private import  tango.io.model.IConduit : OutputStream;

+private import tango.stdc.stdio;
+
 /*******************************************************************************

         Platform issues ...
@@ -602,6 +604,7 @@
                             return integer (result, *cast(ushort*) p, format, ushort.max, "u");

                        case TypeCode.INT:
+                            printf("inside INT print!\n");
                             return integer (result, *cast(int*) p, format, uint.max);

                        case TypeCode.UINT:
[steves@localhost trunk]$ cd ~/dstuff/testing
[steves@localhost testing]$ cat teststuff.d
import tango.text.convert.Layout;

void main()
{
    auto layout = new Layout!(char);
    int x = 0;
    auto result = layout("{}", x);
}
[steves@localhost testing]$ dmd teststuff.d
[steves@localhost testing]$ ./teststuff
inside INT print!
[steves@localhost testing]$

-Steve
1 2
Next ›   Last »