Constructor is not callable using argument types

2017-08-07 Thread Nrgyzer via Digitalmars-d-learn
Hi guys, I've the following code: abstract class a {} class b : a { this(a* myAttr = null) {} } class c : a { this(a* myAttr = null) {} } void main() { auto myb = new b(); auto myc = new c(&myb); } DMD says "Constructor c.this(a* myAttr = null) is not callable using argument types (b*

goto skips declaration of variable

2014-08-18 Thread nrgyzer via Digitalmars-d-learn
Hi all, I've the following code snipped: import std.bigint; void main(string[] args) { BigInt i = "12345"; if (args.length > 1) { goto Exit; } i = BigInt("67890"); Exit: return; } When I try to compile this sample a

Re: goto skips declaration of variable

2014-08-19 Thread nrgyzer via Digitalmars-d-learn
On Monday, 18 August 2014 at 17:47:21 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 18 Aug 2014 13:51:12 + nrgyzer via Digitalmars-d-learn wrote: When I try to compile this sample application I'm getting the following error: sample.d(7): Error: goto skips declaration of var

Re: goto skips declaration of variable

2014-08-21 Thread nrgyzer via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 20:33:00 UTC, monarch_dodra wrote: On Monday, 18 August 2014 at 13:51:14 UTC, nrgyzer wrote: Hi all, I've the following code snipped: import std.bigint; void main(string[] args) { BigInt i = "12345"; if (args.length > 1) { g

Re: goto skips declaration of variable

2014-08-21 Thread nrgyzer via Digitalmars-d-learn
On Thursday, 21 August 2014 at 17:39:16 UTC, Ali Çehreli wrote: On 08/21/2014 04:12 AM, nrgyzer wrote: > I'm using the goto-command to exit my function > if an error (not necessarily an exception) occured. Sorry to repeat myself but if an exception occurs in code before the goto, the exit code

Value of floating in JSONValue

2014-08-21 Thread nrgyzer via Digitalmars-d-learn
Hi everyone, I'm facing a problem with the JSON functions. I've to communicate with another PC using JSON. Here's a simple snipped which shows my problem: import std.json; import std.stdio; void main() { double d = 1.23456789; JSONValue j = d; sendToRemote(toJSON(&j)); }

Re: Value of floating in JSONValue

2014-08-21 Thread nrgyzer via Digitalmars-d-learn
On Thursday, 21 August 2014 at 23:29:56 UTC, Idan Arye wrote: On Thursday, 21 August 2014 at 23:05:48 UTC, Ali Çehreli wrote: I don't think it is a concern as JSON does not encode types. It is up to the receiver how to interpret the data. Here is the output of the program above: {"value":"1.2

Using TreeSet and __gshared values

2014-09-03 Thread nrgyzer via Digitalmars-d-learn
Hi guys, I'm having some trouble using the treeset implementation of Steven (dcollections) in conjunction with __gshared. When I do the following: class Entry { int value; this(int v) { value = v; } int opCmp(Object o) {

Using __traits to find functions in sub-modules

2014-10-16 Thread nrgyzer via Digitalmars-d-learn
Hi, I'm using structs to describe my functions: struct example { string name; uint someValue; } module mod.example1; @example("example1", 1) void myFunction() { // do something } module mod.example2; @example("example2", 2) void myFunction() { // do something } I'm using the struct to

Re: Using __traits to find functions in sub-modules

2014-10-17 Thread nrgyzer via Digitalmars-d-learn
On Thursday, 16 October 2014 at 19:19:21 UTC, John Colvin wrote: On Thursday, 16 October 2014 at 18:39:50 UTC, nrgyzer wrote: Hi, I'm using structs to describe my functions: struct example { string name; uint someValue; } module mod.example1; @example("example1", 1) void myFunction() { //

"Error: Undefined identifier" when moving import to another module

2014-10-19 Thread nrgyzer via Digitalmars-d-learn
Hi guys, when I do the following: module myMain; import example; import std.traits; import my.static.library.binding; static this() { foreach ( m; __traits(allMembers, example) ) { static if ( isCallable!(mixing(m) ) { // ... do something here } } } void ma

Re: "Error: Undefined identifier" when moving import to another module

2014-10-19 Thread nrgyzer via Digitalmars-d-learn
On Sunday, 19 October 2014 at 14:48:18 UTC, monarch_dodra wrote: On Sunday, 19 October 2014 at 09:39:05 UTC, nrgyzer wrote: Hi guys, when I do the following: static if ( isCallable!(mixing(m) ) "mixing" ? void main() { /* do something here */ } What exactly are you doing here? ...

Re: "Error: Undefined identifier" when moving import to another module

2014-10-19 Thread nrgyzer via Digitalmars-d-learn
On Sunday, 19 October 2014 at 17:14:14 UTC, monarch_dodra wrote: On Sunday, 19 October 2014 at 16:09:41 UTC, nrgyzer wrote: "mixing" should be replaced with "mixin": static if ( isCallable!(mixin(m) ) My main is empty in both cases. So nothing done in my main (currently). Posting full code

Re: "Error: Undefined identifier" when moving import to another module

2014-10-20 Thread nrgyzer via Digitalmars-d-learn
On Sunday, 19 October 2014 at 22:22:05 UTC, Joakim wrote: On Sunday, 19 October 2014 at 09:39:05 UTC, nrgyzer wrote: Hi guys, when I do the following: module myMain; import example; import std.traits; import my.static.library.binding; static this() { foreach ( m; __traits(allMembers, examp

Re: "Error: Undefined identifier" when moving import to another module

2014-10-20 Thread nrgyzer via Digitalmars-d-learn
On Monday, 20 October 2014 at 16:05:14 UTC, nrgyzer wrote: On Sunday, 19 October 2014 at 22:22:05 UTC, Joakim wrote: On Sunday, 19 October 2014 at 09:39:05 UTC, nrgyzer wrote: Hi guys, when I do the following: module myMain; import example; import std.traits; import my.static.library.binding

Re: "Error: Undefined identifier" when moving import to another module

2014-10-20 Thread nrgyzer via Digitalmars-d-learn
This solved the problem for the first time, BUT - I don't know if it's a bug or a feature - I ran into another problem. I'm having the following few lines: module example; private { string[string] myPrivateArray; } static this() { foreach ( m; __traits(allMembers, example) ) {

Re: "Error: Undefined identifier" when moving import to another module

2014-10-20 Thread nrgyzer via Digitalmars-d-learn
On Monday, 20 October 2014 at 17:37:34 UTC, nrgyzer wrote: This solved the problem for the first time, BUT - I don't know if it's a bug or a feature - I ran into another problem. I'm having the following few lines: module example; private { string[string] myPrivateArray; } static this() {

std.array.split - Template instantiating error

2015-04-18 Thread nrgyzer via Digitalmars-d-learn
Hi, I've the following source: import std.array : split; import std.stdio : writeln; void main() { string myString = "Hello World"; string[] splitted = myString.split(" "); } But when I compile the code above, I'm getting the following error: Error: template instance std.array.split!(

Re: std.array.split - Template instantiating error

2015-04-18 Thread nrgyzer via Digitalmars-d-learn
On Saturday, 18 April 2015 at 08:13:00 UTC, Rikki Cattermole wrote: On 18/04/2015 8:08 p.m., nrgyzer wrote: Hi, I've the following source: import std.array : split; import std.stdio : writeln; void main() { string myString = "Hello World"; string[] splitted = myString.split(" "); } But

Re: std.array.split - Template instantiating error

2015-04-18 Thread nrgyzer via Digitalmars-d-learn
On Saturday, 18 April 2015 at 13:00:59 UTC, Steven Schveighoffer wrote: On 4/18/15 4:18 AM, nrgyzer wrote: array.d(1510): Error not a property splitter(range, sep).array sample.d(6): Error template instance std.array.split!(string, char) error instantiating Are you using -property switch?

Convert hex to binary

2015-04-24 Thread nrgyzer via Digitalmars-d-learn
Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = "123456789ABCDEF" myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks for suggestions!

Re: Convert hex to binary

2015-04-24 Thread nrgyzer via Digitalmars-d-learn
On Friday, 24 April 2015 at 18:45:55 UTC, Jesse Phillips wrote: On Friday, 24 April 2015 at 18:14:07 UTC, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = "123456789ABCDEF" myBin = myHex.decode('hex