Caching of Template Instantiations

2015-10-17 Thread Nordlöw via Digitalmars-d-learn
Does DMD cache template instantiations? That is, is it preferred to do, for instance, either static if (isIntegral!T && isUnsigned!(T)) {} else static if (isIntegral!T && isSigned!(T)) {} or enum integral = isIntegral!T; static if (integral && isUnsigned!(T)) {} e

Re: Caching of Template Instantiations

2015-10-17 Thread Marc Schütz via Digitalmars-d-learn
On Saturday, 17 October 2015 at 07:48:39 UTC, Nordlöw wrote: Does DMD cache template instantiations? Yes, and it's required by the spec: "Multiple instantiations of a TemplateDeclaration with the same TemplateArgumentList all will refer to the same instantiation." http://dlang.org/template.h

Re: LuaD: creating a flexible data filter system

2015-10-17 Thread Chris via Digitalmars-d-learn
On Saturday, 17 October 2015 at 02:02:16 UTC, Jakob Ovrum wrote: On Friday, 16 October 2015 at 10:45:52 UTC, Chris wrote: Later you call the function with the Lua C API like "lua_pcall(L, 0, 1, 0);". It's a bit tricky to move things around on the Lua stack, but you'll get there! ;) Or you cou

Re: LuaD: creating a flexible data filter system

2015-10-17 Thread yawniek via Digitalmars-d-learn
many thanks for the valuable insights. so far i made a simple prototype with LuaD and classes, works nicely for when my niput what so far is not 100% clear is if there is a way to have a parsed msgpack or json documents being exposed in my lua code in a way so it behaves like a lua object. I

what is wrong with this code??

2015-10-17 Thread steven kladitis via Digitalmars-d-learn
import std.string, std.typecons, std.exception, std.algorithm,std.stdio; import std.traits: hasIndirections; struct GrowableCircularQueue(T) { public size_t length; private size_t first, last; private T[] A = [T.init]; this(T[] items...) pure nothrow @safe { foreach (x;

Re: what is wrong with this code??

2015-10-17 Thread anonymous via Digitalmars-d-learn
On Saturday, October 17, 2015 04:17 PM, steven kladitis wrote: > // it thows a range exception On which line?

Re: what is wrong with this code??

2015-10-17 Thread steven kladitis via Digitalmars-d-learn
On Saturday, 17 October 2015 at 14:47:11 UTC, anonymous wrote: On Saturday, October 17, 2015 04:17 PM, steven kladitis wrote: // it thows a range exception On which line? core.exception.RangeError@sokuban.d(84): Range violation

Re: what is wrong with this code??

2015-10-17 Thread anonymous via Digitalmars-d-learn
On Saturday, October 17, 2015 04:50 PM, steven kladitis wrote: > core.exception.RangeError@sokuban.d(84): Range violation Line 84 being this: sDataBuild ~= sMap[ch]; Where sMap is: /*static*/ immutable sMap = [' ':' ', '.':'.', '@':' ', '#':'#', '$':' '];

Re: what is wrong with this code??

2015-10-17 Thread steven kladitis via Digitalmars-d-learn
On Saturday, 17 October 2015 at 14:59:41 UTC, anonymous wrote: On Saturday, October 17, 2015 04:50 PM, steven kladitis wrote: core.exception.RangeError@sokuban.d(84): Range violation Line 84 being this: sDataBuild ~= sMap[ch]; Where sMap is: /*static*/ immutable sMap =

Compiling a .d file both as library and executable

2015-10-17 Thread Shriramana Sharma via Digitalmars-d-learn
In Python there is: if __name__ == "__main__": to allow the same source file to be treated as both an importable library and as an executable script. In D is there any such mechanism to make a main() compiled selectively, i.e. by some compile-time flag or such? -- Shriramana Sharma, Penguin #

Re: Compiling a .d file both as library and executable

2015-10-17 Thread anonymous via Digitalmars-d-learn
On Saturday, October 17, 2015 05:36 PM, Shriramana Sharma wrote: > In Python there is: > > if __name__ == "__main__": > > to allow the same source file to be treated as both an importable library > and as an executable script. In D is there any such mechanism to make a > main() compiled selectiv

Re: LuaD: creating a flexible data filter system

2015-10-17 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 17 October 2015 at 13:15:17 UTC, yawniek wrote: many thanks for the valuable insights. so far i made a simple prototype with LuaD and classes, works nicely for when my niput what so far is not 100% clear is if there is a way to have a parsed msgpack or json documents being expose

Re: OT: why do people use python when it is slow?

2015-10-17 Thread Laeeth Isharc via Digitalmars-d-learn
On Wednesday, 14 October 2015 at 18:17:29 UTC, Russel Winder wrote: On Wed, 2015-10-14 at 14:48 +, John Colvin via Digitalmars-d-learn wrote: On Wednesday, 14 October 2015 at 14:32:00 UTC, jmh530 wrote: > On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc > wrote: > > https://www.q