Re: shared interfaces

2015-02-15 Thread anonymous via Digitalmars-d-learn
On Sunday, 15 February 2015 at 10:43:46 UTC, Andrey Derzhavin wrote: what is wrong in declarations, if I need to declare shared classes D and C? `shared` on a class/interface makes all members shared. And that's all it does. So this: interface IA { void fnA(); } shared class C :

Re: shared interfaces

2015-02-15 Thread Andrey Derzhavin via Digitalmars-d-learn
On Sunday, 15 February 2015 at 14:59:20 UTC, anonymous wrote: Hm? Works for me. What error do you get, or what doesn't work? Which compiler are you using, which version? The error Error: function main.C.fnA does not override any function, did you mean to override 'main.IA.fnA'? has occured

Re: shared interfaces

2015-02-15 Thread Andrey Derzhavin via Digitalmars-d-learn
On Sunday, 15 February 2015 at 14:59:20 UTC, anonymous wrote: Sorry everything is OK. It's my fault. Thanks))

Re: shared interfaces

2015-02-15 Thread Andrey Derzhavin via Digitalmars-d-learn
On Sunday, 15 February 2015 at 11:30:46 UTC, anonymous wrote: On Sunday, 15 February 2015 at 10:43:46 UTC, Andrey Derzhavin wrote: what is wrong in declarations, if I need to declare shared classes D and C? `shared` on a class/interface makes all members shared. And that's all it does. So

Re: shared interfaces

2015-02-15 Thread anonymous via Digitalmars-d-learn
On Sunday, 15 February 2015 at 12:34:50 UTC, Andrey Derzhavin wrote: On Sunday, 15 February 2015 at 11:30:46 UTC, anonymous wrote: [...] interface IA { void fnA(); } shared interface IC : IA { void fnC(); } class D : IC { override void fnC() shared {} override void fnA() {} }

ranges reading garbage

2015-02-15 Thread John Colvin via Digitalmars-d-learn
Simplified from something bigger: import std.range, std.algorithm, std.stdio; void foo(float[] data, float[] xs, float[] ys) { auto indices = iota(0, data.length, ys.length) .map!(xBase = iota(xBase, xBase + ys.length - 1) .map!(y =

Wrong overload resolution

2015-02-15 Thread rumbu via Digitalmars-d-learn
This problem appears only if one of the parameters is an interface. Without it or using any other type as a second parameter instead of the interface, it compiles. Also it compiles if the passed interface is null. The example below uses short/ushort, but I found the same behaviour for any

Re: Wrong overload resolution

2015-02-15 Thread Baz via Digitalmars-d-learn
On Sunday, 15 February 2015 at 23:48:50 UTC, rumbu wrote: This problem appears only if one of the parameters is an interface. Without it or using any other type as a second parameter instead of the interface, it compiles. Also it compiles if the passed interface is null. The example below

Re: ranges reading garbage

2015-02-15 Thread anonymous via Digitalmars-d-learn
On Sunday, 15 February 2015 at 18:13:44 UTC, John Colvin wrote: Simplified from something bigger: import std.range, std.algorithm, std.stdio; void foo(float[] data, float[] xs, float[] ys) { auto indices = iota(0, data.length, ys.length) .map!(xBase = iota(xBase,

Re: ranges reading garbage

2015-02-15 Thread bearophile via Digitalmars-d-learn
John Colvin: prints things like [0, 4, 5, 1, 1, 1459971595, 1459971596, 2, 2, 1459971596, 1459971597, 3, 4, 8, 9, 5, 5, 4441427819, 4441427820, 6, 6, 4441427820, 4441427821, 7] but the output isn't consistent, the big numbers change on each run. Try to replace the only() with: [y,

Re: ranges reading garbage

2015-02-15 Thread FG via Digitalmars-d-learn
On 2015-02-15 at 19:43, bearophile wrote: void foo(in float[] data, in float[] xs, in float[] ys) @safe { iota(0, data.length, ys.length) .map!(xBase = iota(xBase, xBase + ys.length - 1) .map!(y = [y, y+ys.length, y+ys.length+1, y+1]) .joiner)

Re: ranges reading garbage

2015-02-15 Thread John Colvin via Digitalmars-d-learn
On Sunday, 15 February 2015 at 18:43:35 UTC, bearophile wrote: John Colvin: prints things like [0, 4, 5, 1, 1, 1459971595, 1459971596, 2, 2, 1459971596, 1459971597, 3, 4, 8, 9, 5, 5, 4441427819, 4441427820, 6, 6, 4441427820, 4441427821, 7] but the output isn't consistent, the big numbers

Re: ranges reading garbage

2015-02-15 Thread bearophile via Digitalmars-d-learn
FG: Odd... Still something is wrong. It prints: [0, 4, 5, 1, 1, 5, 6, 2, 2, 6, 7, 3, 4, 8, 9, 5, 5, 5, 6, 6, 6, 6, 7, 7] instead of this: [0, 4, 5, 1, 1, 5, 6, 2, 2, 6, 7, 3, 4, 8, 9, 5, 5, 9, 10, 6, 6, 10, 11, 7] This is less lazy and gives another result: import std.range,

shared interfaces

2015-02-15 Thread Andrey Derzhavin via Digitalmars-d-learn
interface IA { void fnA(); } interface IB { void fnB(); } shared interface IC : IA, IB { void fnC(); } shared class C : IA, IB { override void fnA() // Error: function main.C.fnA does not override any function, did you mean to override 'main.IA.fnA'? {

Re: ranges reading garbage

2015-02-15 Thread anonymous via Digitalmars-d-learn
On Sunday, 15 February 2015 at 19:54:45 UTC, anonymous wrote: Reduced some more: import std.algorithm, std.stdio; void main() { int ys_length = 4; auto indices = [0] .map!(xBase = [0].map!(y = ys_length)) .joiner(); writeln(indices); } And more: import std.stdio;

Lazily Partially Sorted

2015-02-15 Thread Nordlöw
I would like to implement a variant of Sorted at https://github.com/D-Programming-Language/phobos/pull/2793 that does completeSort of _store lazily instead of eagerly. I guess this is a bit more complex to implement as all accessors of LazySorted, such as opIndex, opSlice, etc (to the

Re: How to make a Currency class from std.BigInt?

2015-02-15 Thread Jay Norwood via Digitalmars-d-learn
This library allow to specify the internal base of the arbitrary precision numbers( default is decimal), as well as allows specification of the precision of floating point values. Each floating point number precision can be read with .precision(). Also supports specification of rounding

Re: D1: Error: function ... cannot have an in contract when overriden function

2015-02-15 Thread jicman via Digitalmars-d-learn
On Saturday, 8 November 2014 at 01:59:56 UTC, Adam D. Ruppe wrote: If it is just that one error, you could always just comment out the in contract and recompile. Sorry it took so long. Extremely busy, but anyway, this is the piece of the code that is causin the problem: code override void

Re: D1: Error: function ... cannot have an in contract when overriden function

2015-02-15 Thread Kagamin via Digitalmars-d-learn
It checks that you don't set both text and image, because the button doesn't support it.