Re: Functional vs simple code

2012-10-03 Thread ixid
Stuff Actually now I realise what the conflict is between the two, a + b * b would give the wrong answer when applied to the whole array in the manner I was thinking by doing a + a * a for the first value.

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread Jacob Carlborg
On 2012-10-03 02:55, timotheecour wrote: How do I call std_stdio_static_this() in std.stdio from a dynamically loaded shared library (osx) ? I need to do this in my scenario: 1) main program is launched 2) dynamic library is created 3) dynamic library is loaded and a function from it is called

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread timotheecour
Thanks for the links. Ya, I did see those threads and I understand there are limitations with dynamic load shared libraries, however, your answer is not very helpful. We shouldn't have to wait until they get 100% support to start using them (who knows when that happens); some applications just

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread Jacob Carlborg
On 2012-10-03 08:56, timotheecour wrote: Thanks for the links. Ya, I did see those threads and I understand there are limitations with dynamic load shared libraries, however, your answer is not very helpful. We shouldn't have to wait until they get 100% support to start using them (who knows

Question about anonymous delegates.

2012-10-03 Thread Sharp
I found something what I don't understand. Here is a simplifed code with comments: http://dpaste.dzfl.pl/a914d11a I creating anonymous delegates, whose function is to modify their parameter. Their parameters are different class references. I pass these class references to anonymous delegates,

Re: Question about anonymous delegates.

2012-10-03 Thread Timon Gehr
On 10/03/2012 03:53 PM, Sharp wrote: I found something what I don't understand. Here is a simplifed code with comments: http://dpaste.dzfl.pl/a914d11a I creating anonymous delegates, whose function is to modify their parameter. Their parameters are different class references. I pass these

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread timotheecour
Module constructors if one of the things that don't work properly. I don't know exactly how this works in std.stdio I would need to study the code. If I recall correctly std.stdio uses some kind of hack to avoid circular dependencies that can otherwise occur if two modules, both having module

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread Jacob Carlborg
On 2012-10-03 20:23, timotheecour wrote: Yes, that hack consists in : 1) defining extern(C) void std_stdio_static_this() instead of static this() 2) defining an auxiliary module std.stdiobase who will call it at module construction: module std.stdiobase; extern(C) void std_stdio_static_this();

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread timotheecour
What happens if you just call std_stdio_static_this the first you do in your main function? In my case I can't: I don't have control over the main function (it could be written in C for example). @property File stdin () { if (!_stdin.p) _stdin.p = stdinImpl; return _stdin;

Re: Metaprogramming: check for ref

2012-10-03 Thread mist
On Sunday, 30 September 2012 at 21:34:36 UTC, Andrej Mitrovic wrote: On 9/30/12, jerro a...@a.com wrote: I think this should work: template returnsRef(alias f) { enum bool returnsRef = is(typeof( { ParameterTypeTuple!f param; auto ptr = f(param); })); } Yep.

Question about memoize

2012-10-03 Thread Richie
I've pasted a code sample here with a comment of what should be printed out: http://dpaste.dzfl.pl/02cfc280 memoize is taken straight from std.functional, I just added a writeln so I could see more about what was going on. slowFuncString should only be calculated twice with the input given: