June 14, 2011
On 6/13/2011 8:48 PM, Andrej Mitrovic wrote:
> I'm guessing this is what you're after:
> 
> http://codepad.org/TCtG68Fw
> http://codepad.org/65GBDjPS
> 
> rdmd main.d
> shared ctor!
> ctor!
> foo.test
> dtor!
> shared dtor!

Actually, not what I was thinking.  I was thinking something like this:

file 1:
import std.stdio; // or inside this, not what I'm testing.
static this()
{
    writeln("foo");
}

file 2:
void main()
{
    import file1;
}


June 14, 2011
Well it seems to work fine. :)
June 17, 2011
On 2011-06-12 23:15, Walter Bright wrote:
> Nobody seems to have noticed yet, but yesterday I removed the
> restriction preventing import declarations from being used in functions.
> These now work:
>
> void test1()
> {
> import std.c.stdio;
> printf("hello world\n");
> }
>
> void test2()
> {
> static import std.c.stdio;
> std.c.stdio.printf("hello world\n");
> }
>
> https://github.com/D-Programming-Language/dmd/commit/d5fbd53aa8d8452dce2514944575e654d387477a
>
>
> I believe this can lead to better encapsulation of code, especially when
> using mixins, versioning and other conditional compilation constructs.

This is awesome.

-- 
/Jacob Carlborg
June 18, 2011
This is such a great debugging tool. I mean ddbg is great on its own. But being able to quickly import std.stdio and do a few debug writes in some library function is fantastic.
June 20, 2011
On 6/19/11 5:20 AM, Andrej Mitrovic wrote:
> This is such a great debugging tool. I mean ddbg is great on its own.
> But being able to quickly import std.stdio and do a few debug writes
> in some library function is fantastic.

print-debugging is so common... in Ruby you always have "puts" available, no need to require anything. Why not do the same for D?
June 20, 2011
I think I've just found the first bug:

module test;
void main()
{
}

void foo()
{
    import std.utf;
    "bla".toUTF16z;
}

Error: undefined identifier module test.toUTF16z

UFCS doesn't work with function imports. This is a bug, right?
June 20, 2011
On 2011-06-20 05:18, Ary Manzana wrote:
> On 6/19/11 5:20 AM, Andrej Mitrovic wrote:
>> This is such a great debugging tool. I mean ddbg is great on its own.
>> But being able to quickly import std.stdio and do a few debug writes
>> in some library function is fantastic.
>
> print-debugging is so common... in Ruby you always have "puts"
> available, no need to require anything. Why not do the same for D?

"puts", don't you use "p"? Shorter and prints better information.

-- 
/Jacob Carlborg
June 20, 2011
On 6/20/11 3:04 PM, Jacob Carlborg wrote:
> On 2011-06-20 05:18, Ary Manzana wrote:
>> On 6/19/11 5:20 AM, Andrej Mitrovic wrote:
>>> This is such a great debugging tool. I mean ddbg is great on its own.
>>> But being able to quickly import std.stdio and do a few debug writes
>>> in some library function is fantastic.
>>
>> print-debugging is so common... in Ruby you always have "puts"
>> available, no need to require anything. Why not do the same for D?
>
> "puts", don't you use "p"? Shorter and prints better information.
>

Ah, yes, you are right. I use it. p "!" is my battle horse.
June 20, 2011
"Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message news:mailman.1030.1308543325.14074.digitalmars-d@puremagic.com...
>I think I've just found the first bug:
>
> module test;
> void main()
> {
> }
>
> void foo()
> {
>    import std.utf;
>    "bla".toUTF16z;
> }
>
> Error: undefined identifier module test.toUTF16z
>
> UFCS doesn't work with function imports. This is a bug, right?

UFCS barely works at all in D2. Another example:

Regression(2.020) Array member call syntax can't find matches in current
class
http://d.puremagic.com/issues/show_bug.cgi?id=4525



June 20, 2011
On 6/21/11, Nick Sabalausky <a@a.a> wrote:
> UFCS barely works at all in D2. Another example:

Couple that with the classically buggy 'with' statement and you've got yourself a party! \o/