Re: mixin template

2014-01-27 Thread Dan Killebrew
Found this: http://forum.dlang.org/thread/ntuysfcivhbphnhnn...@forum.dlang.org#post-mailman.1409.1339356130.24740.digitalmars-d-learn:40puremagic.com If what Jonathan says is true, then http://dlang.org/template-mixin.html should be updated: s/mixin template/template/

Re: std.json tree navigation help

2014-01-27 Thread Dan Killebrew
Check out the json module in vibe.d. Maybe copy it into your own application (since it can't be used as a library, yet). http://vibed.org/api/vibe.data.json/ https://github.com/rejectedsoftware/vibe.d

mixin template

2014-01-27 Thread Dan Killebrew
What is the difference between: A --- template Foo() { int x = 5; } B - mixin template Foo() { int x = 5; } The full example is from the first code sample on http://dlang.org/template-mixin.html Both A and B compile and when run, have the exact same output. So how is '

Re: std.json tree navigation help

2014-01-27 Thread dennis
On Monday, 27 January 2014 at 23:26:44 UTC, cal wrote: I usually end up doing something like this when dealing with std.json: http://dpaste.dzfl.pl/bcb14d6a; Cool, thank you. Your example really helps clear this up for me. Plus I liked the use of the popBackN() method call on the string, I

Linux dll struct class etc

2014-01-27 Thread Mineko
I can't remember whether or not I've asked this.. But either way, is it possible to "export" a class or a struct or something like you do with a windows dll with a linux shared library (dll)?

Re: std.json tree navigation help

2014-01-27 Thread cal
On Monday, 27 January 2014 at 06:51:57 UTC, dennis wrote: I am having trouble understanding how to navigate the tree returned by std.json. I am new to D programming, I have tried reading the std.json source code but I am still stumped. I usually end up doing something like this when dealing w

Re: Why CTFE is context-sensitive?

2014-01-27 Thread Brad Roberts
On 1/27/14 10:40 AM, Pierre Talbot wrote: On Monday, 27 January 2014 at 01:39:47 UTC, Simen Kjærås wrote: On 2014-01-26 09:59, Pierre Talbot wrote:> Hi, > > I was wondering why CTFE is context sensitive, why don't we check > every expressions and run the CTFE if it applies? Mostly because it's

Re: std.copy (to multiple output ranges),

2014-01-27 Thread Robert Schadek
On 01/27/2014 07:59 PM, Justin Whear wrote: > On Mon, 27 Jan 2014 15:44:43 +0100, Robert Schadek wrote: > >> I'm searching the docs for something similar to: >> copy(someInputRange, firstOutputRange, secondOutputRange, ); >> I know how to write it by hand, but I'm suspecting that something like

Re: std.copy (to multiple output ranges),

2014-01-27 Thread Robert Schadek
On 01/27/2014 07:36 PM, Ilya Yaroshenko wrote: > On Monday, 27 January 2014 at 17:26:35 UTC, Robert Schadek wrote: >> I'm searching the docs for something similar to: >> copy(someInputRange, firstOutputRange, secondOutputRange, ); >> I know how to write it by hand, but I'm suspecting that somet

Re: std.copy (to multiple output ranges),

2014-01-27 Thread Ilya Yaroshenko
On Monday, 27 January 2014 at 18:36:32 UTC, Ilya Yaroshenko wrote: On Monday, 27 January 2014 at 17:26:35 UTC, Robert Schadek wrote: I'm searching the docs for something similar to: copy(someInputRange, firstOutputRange, secondOutputRange, ); I know how to write it by hand, but I'm suspecti

Re: Using a delegate stored as a member of a destroyed struct?

2014-01-27 Thread Nicolas Sicard
On Monday, 27 January 2014 at 14:47:21 UTC, Steven Schveighoffer wrote: On Mon, 27 Jan 2014 03:17:51 -0500, Nicolas Sicard wrote: Actually I used a struct because the code is more complex, and it builds an array of delegates, which are returned from global functions, like: --- struct Transf

A small question default values in tmplate-functions

2014-01-27 Thread Uplink_Coder
Hello, Suppose I have the following function auto veryStableAPI(string parameter,VaraiadicParams...)() { // do something very slow and stable; } auto experimentalReplacement(string parameter,VaraidcParams ...)() { // do the same thing very fast and dangerous } is the following au

Re: std.copy (to multiple output ranges),

2014-01-27 Thread Justin Whear
On Mon, 27 Jan 2014 15:44:43 +0100, Robert Schadek wrote: > I'm searching the docs for something similar to: > copy(someInputRange, firstOutputRange, secondOutputRange, ); > I know how to write it by hand, but I'm suspecting that something like > this is already in phobos. > > And secondly, i

Re: std.copy (to multiple output ranges),

2014-01-27 Thread Ilya Yaroshenko
On Monday, 27 January 2014 at 17:26:35 UTC, Robert Schadek wrote: I'm searching the docs for something similar to: copy(someInputRange, firstOutputRange, secondOutputRange, ); I know how to write it by hand, but I'm suspecting that something like this is already in phobos. Hi, I think you

Re: Why CTFE is context-sensitive?

2014-01-27 Thread Pierre Talbot
On Monday, 27 January 2014 at 01:39:47 UTC, Simen Kjærås wrote: On 2014-01-26 09:59, Pierre Talbot wrote:> Hi, > > I was wondering why CTFE is context sensitive, why don't we check > every expressions and run the CTFE if it applies? Mostly because it's not necessary, and takes more time than si

std.copy (to multiple output ranges),

2014-01-27 Thread Robert Schadek
I'm searching the docs for something similar to: copy(someInputRange, firstOutputRange, secondOutputRange, ); I know how to write it by hand, but I'm suspecting that something like this is already in phobos. And secondly, is there some function that gives me a forward range to some input range

Re: Creating an array of C structs

2014-01-27 Thread Francesco Cattoglio
On Monday, 27 January 2014 at 13:08:28 UTC, Colin Grogan wrote: In my defense, I believe C initializes arrays with the curly brackets Can I keep making excuses? Yes you can... And don't worry, I mess up initialization too. Lots of time. Especially when I tried initializing an array of st

Re: Using a delegate stored as a member of a destroyed struct?

2014-01-27 Thread Steven Schveighoffer
On Mon, 27 Jan 2014 03:17:51 -0500, Nicolas Sicard wrote: Actually I used a struct because the code is more complex, and it builds an array of delegates, which are returned from global functions, like: --- struct Transformer { real delegate(real)[] funs; addFun(real x)

Re: ODBC SQLBindParameter for string array

2014-01-27 Thread Regan Heath
On Sat, 25 Jan 2014 11:05:11 -, Andre wrote: // CREATE TABLE demo(name VARCHAR(1)) // INSERT INTO demo (name) VALUES (?) string[] stringArr = ["A","B","C"]; SQLSetStmtAttr(hStmt, SQL_ATTR_PARAMSET_SIZE, cast(SQLPOINTER) stringArr.length, 0); SQLSetStmtAttr(hStmt, SQL_ATTR_PARAM_BIND_TY

Re: Completly static Laurent's polynomials

2014-01-27 Thread matovitch
I just clone phobos so we could agree about the line numbers : /usr/include/dmd/phobos/std/conv.d(3889): Error: memcpy cannot be interpreted at compile time, because it has no available source code /usr/include/dmd/phobos/std/range.d(4769):called from here: emplace(addr, front(this._ra

Re: Completly static Laurent's polynomials

2014-01-27 Thread matovitch
On Monday, 27 January 2014 at 13:18:06 UTC, Meta wrote: On Monday, 27 January 2014 at 11:15:36 UTC, matovitch wrote: Hello ! Yesterday, I started a project to implement completly static Laurent's polynomials (i.e. polynomials formed by z^n and z^-n monomials). I thought I could represent thes

Re: automatic type creation

2014-01-27 Thread Frustrated
Here is something I just did that essentially demonstrates what I am talking about(bugs withstanding): http://dpaste.dzfl.pl/d82b6274 It is not exactly how I should be going about it as it is somewhat generic but not properly designed to allow the concrete implementations needed void main() {

Re: Completly static Laurent's polynomials

2014-01-27 Thread Meta
On Monday, 27 January 2014 at 11:15:36 UTC, matovitch wrote: Hello ! Yesterday, I started a project to implement completly static Laurent's polynomials (i.e. polynomials formed by z^n and z^-n monomials). I thought I could represent these polynomials with an immutable range of Tuple!(numeric_

Re: Creating an array of C structs

2014-01-27 Thread Colin Grogan
On Monday, 27 January 2014 at 10:39:28 UTC, Francesco Cattoglio wrote: On Monday, 27 January 2014 at 10:13:08 UTC, Colin Grogan wrote: On Monday, 27 January 2014 at 09:34:04 UTC, Namespace wrote: Arrays are enclosed in [] ;) I'm an idiot. Can I delete this thread to save further embarrassment

Completly static Laurent's polynomials

2014-01-27 Thread matovitch
Hello ! Yesterday, I started a project to implement completly static Laurent's polynomials (i.e. polynomials formed by z^n and z^-n monomials). I thought I could represent these polynomials with an immutable range of Tuple!(numeric_type, int). I've tried (and failed) to implement the additio

Re: Creating an array of C structs

2014-01-27 Thread Francesco Cattoglio
On Monday, 27 January 2014 at 10:13:08 UTC, Colin Grogan wrote: On Monday, 27 January 2014 at 09:34:04 UTC, Namespace wrote: Arrays are enclosed in [] ;) I'm an idiot. Can I delete this thread to save further embarrassment? :) HA-HA! (read it with Nelson voice, ofc)

Re: Creating an array of C structs

2014-01-27 Thread Stanislav Blinov
On Monday, 27 January 2014 at 10:13:08 UTC, Colin Grogan wrote: Arrays are enclosed in [] ;) I'm an idiot. Can I delete this thread to save further embarrassment? :) No! Evenryone will see this! >:E~

Re: Creating an array of C structs

2014-01-27 Thread Colin Grogan
On Monday, 27 January 2014 at 09:34:04 UTC, Namespace wrote: On Monday, 27 January 2014 at 09:06:17 UTC, Colin Grogan wrote: Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct myStruc

Memory leak in hello world

2014-01-27 Thread Thejaswi Puthraya
I have a simple "Hello World" program (file named "tmp.d") written in D import std.stdio; void main() { printf("Hello World\n"); } I successfully compiled the above program with the DMD64 D compiler v2.064 on linux x86_64 (libc 2.18 just in case required). But valgrind reports memory leaks

Re: Creating an array of C structs

2014-01-27 Thread Namespace
On Monday, 27 January 2014 at 09:06:17 UTC, Colin Grogan wrote: Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct myStruct{ int x; float y; } } It fails with

Creating an array of C structs

2014-01-27 Thread Colin Grogan
Why wont the following code compile? import std.stdio; void main() { myStruct[] mystructs = { {1, 1.1f}, {2, 2.2f} }; } extern(C){ struct myStruct{ int x; float y; } } It fails with the (unhelpful imo) error message: source/app.d(7): Error: a str

Re: Using a delegate stored as a member of a destroyed struct?

2014-01-27 Thread Nicolas Sicard
On Monday, 27 January 2014 at 02:27:08 UTC, Steven Schveighoffer wrote: On Sun, 26 Jan 2014 18:41:00 -0500, Nicolas Sicard wrote: Running a piece of code that can be reduced to: --- import std.stdio; void main() { import std.range; foreach(item; iota(0, 10).transform(2))