Re: OT - civility in a professional environment

2015-06-20 Thread Kagamin via Digitalmars-d-learn
Our management tries to apply best practices, it works most of 
the time.


Re: OT - civility in a professional environment

2015-06-20 Thread Laeeth Isharc via Digitalmars-d-learn

On Saturday, 20 June 2015 at 11:23:21 UTC, Kagamin wrote:
Our management tries to apply best practices, it works most of 
the time.


When you have sensitive, smart, and creative people, one should 
expect sometimes more sturm and drang - and the question is what 
one does with that energy once it has passed.  Actually, what the 
article didn't address is that there is sometimes a tradeoff 
between being 'nice' (a peculiarly Anglo thing, for which we have 
Cardinal Newman and his essay on the Gentleman to thank) and 
doing what's right for the situation - it's always much better, 
in my experience, to confront things.


I think the D community stands out for its civility and 
helpfulness (also for the fact that people have high standards 
and care about making sure things are up to scratch).


So I didn't intend by posting this to refer to anything recent on 
the forum.  It's just notably relevant to broader experience in 
many different office environments.


The newer title of the NYT article is better - this is more a 
symptom of distractedness, and less about bosses (who have a 
lonely, often verging on impossible job) - it applies to us all 
as human beings in 2015.


Re: best way to interface D code to Excel

2015-06-20 Thread Laeeth Isharc via Digitalmars-d-learn

On Friday, 19 June 2015 at 21:06:31 UTC, Jesse Phillips wrote:

On Wednesday, 17 June 2015 at 18:35:36 UTC, Laeeth Isharc wrote:

Hi.

I know D has support for COM - not sure of its status.  And 
there was a Microsoft chap who posted here a couple of years 
back - wonderful templated code that made it easy to write 
this kind of thing.  Unfortunately he wasn't able to share it 
publicly.


Laeeth.


I haven't ever done any real work with it, and certainly 
nothing with Excel. But Juno provides similarities for COM to 
what the Microsoft guy demonstrated.


I made some changes so it would compile in dmd 2.070, didn't 
test though so it is still it's own branch.


https://github.com/JesseKPhillips/Juno-Windows-Class-Library/tree/dmd6.070


Thanks Jesse - I did look at this, but I think I couldn't make it 
compile when I tried (or at least some of the unit tests fail, 
from what I recall).  But I appreciate your updating and will 
take a look now.


Somebody should write an article for the wiki on the various 
options needed for COM.  I know it's less in fashion, but it's 
still very useful.  I don't yet have the expertise, and I am only 
looking into this reluctantly for pragmatic reasons.  There is an 
empty placeholder linked from early in the Wiki here:


http://wiki.dlang.org/COM_Programming

Does it make sense to keep a register of all unfilled out such 
pages, so people who are looking for something to do can 
contribute?



Laeeth.


pass by value elide dtor + post-blit

2015-06-20 Thread Xiaoxi via Digitalmars-d-learn

When passing a struct by value:

Is there any way to trick the compiler to elide unnecessary 
post-blit  dtor pair?


Maybe using an union, somehow?



Re: Erroneous auto can only be used for template function parameters?

2015-06-20 Thread Adam D. Ruppe via Digitalmars-d-learn

On Saturday, 20 June 2015 at 01:50:11 UTC, Yuxuan Shui wrote:
auto ref R) is indeed a template function, so I don't 
understand.


But R is not a parameter on the function itself. It comes from 
the outside template.


Move it to the inside template, rewrite it as:

auto a(S, R)(auto ref R i) {
return cast(S)i*2;
}

and you should get further.


Re: Erroneous auto can only be used for template function parameters?

2015-06-20 Thread Yuxuan Shui via Digitalmars-d-learn

On Sunday, 21 June 2015 at 01:26:51 UTC, Adam D. Ruppe wrote:

On Saturday, 20 June 2015 at 01:50:11 UTC, Yuxuan Shui wrote:
auto ref R) is indeed a template function, so I don't 
understand.


But R is not a parameter on the function itself. It comes from 
the outside template.


Move it to the inside template, rewrite it as:

auto a(S, R)(auto ref R i) {
return cast(S)i*2;
}

and you should get further.


But surely nested template should be able to access outer 
template's parameter.


Re: Erroneous auto can only be used for template function parameters?

2015-06-20 Thread Yuxuan Shui via Digitalmars-d-learn

On Sunday, 21 June 2015 at 01:26:51 UTC, Adam D. Ruppe wrote:

On Saturday, 20 June 2015 at 01:50:11 UTC, Yuxuan Shui wrote:
auto ref R) is indeed a template function, so I don't 
understand.


But R is not a parameter on the function itself. It comes from 
the outside template.


Move it to the inside template, rewrite it as:

auto a(S, R)(auto ref R i) {
return cast(S)i*2;
}

and you should get further.


Also the same error persists even if I change 'a' to

auto a(S)(auto ref S i)


Re: pass by value elide dtor + post-blit

2015-06-20 Thread Ali Çehreli via Digitalmars-d-learn

On 06/20/2015 02:09 PM, Xiaoxi wrote:

When passing a struct by value:

Is there any way to trick the compiler to elide unnecessary post-blit 
dtor pair?

Maybe using an union, somehow?



Can you show with an example please. I don't see either of those called 
for the following program:


import std.stdio;

struct S
{
this(int)
{
writeln(__FUNCTION__);
}

this(this)
{
writeln(__FUNCTION__);
}

~this()
{
writeln(__FUNCTION__);
}
}

S foo()
{
auto s = S(42);
return s;
}

void main()
{
writeln(before);
auto s = foo();
writeln(after);
}

The output:

before
deneme.S.this
after
deneme.S.~this

Ali