Relative imports and separate compilation

2013-08-31 Thread Atila Neves
I've gone on TDPL and the language reference here but still don't get relative imports. I've isolated it to this: ./package1/package2/foo.d: import std.stdio; void doFoo() { writeln(Foo!); } ./main.d: import package1.package2.foo; void main() { doFoo(); } This works: dmd -c main.d dmd

Any trick for defining an operator overload in a different namespace?

2013-08-31 Thread Andrej Mitrovic
I'm trying to achieve the syntax opts[...] = 123, rather than using the more direct this[...] = 123. I can use this code: - class C { this() { opts = Opts(this); opts[foo] = 1; } struct Opts { C c; void opIndexAssign(T)(T value, string

Re: A little of coordination for Rosettacode

2013-08-31 Thread bearophile
Jos van Uden: It's an old task (from 2007). The task description was changed after the D entries were made. Yes, there are about 63 Rosettacode tasks that I have not yet updated: accumulator_factory.d address_of_a_variable.d animation.d boolean_values.d

Re: PyD status and tutorials

2013-08-31 Thread Larry
Ok python3-dev was missing. Now, it is a gdc problem: [code] def: hello wrap_struct: 'RangeWrapper' class.def: __iter__ class.def: next wrapped_struct_init, S is 'struct pyd.make_object.RangeWrapper' library_dirs: [] runtime_library_dirs: [] libraries: [] gdc -fPIC -nostartfiles -shared -fdebug

Re: Problem with rdmd

2013-08-31 Thread Jacob Carlborg
On 2013-08-30 09:39, eles wrote: On Linux 64 $chmod +x htest $cat ./htest #!/usr/bin/env rdmd import std.stdio; void main() { writeln(hello world!); } then: $./htest Error: cannot read file ./htest.d Failed: 'dmd' '-v' '-o-' './htest.d' '-I.' OTOH: $cp htest htest.d $./htest.d hello

Re: Problem with rdmd

2013-08-31 Thread Dicebot
On Friday, 30 August 2013 at 13:32:25 UTC, eles wrote: On Friday, 30 August 2013 at 11:34:59 UTC, Jacob Carlborg wrote: On 2013-08-30 09:39, eles wrote: I'm pretty sure it's DMD that is the problem. Yes. But that's, the least to say, limiting. This:

Re: Relative imports and separate compilation

2013-08-31 Thread Dicebot
On Saturday, 31 August 2013 at 09:29:16 UTC, Atila Neves wrote: How to relative imports actually work? Atila Actually for me it looks like it is a bug in automatic module name deduction. It should always use full qualified name built from directory path from closest import folder (set by -I

Re: PyD status and tutorials

2013-08-31 Thread Russel Winder
On Sat, 2013-08-31 at 12:56 +0200, Larry wrote: Ok python3-dev was missing. Are you using Python 3.3? Are you using SCons or Tup for the build? I just tried the SCons build OOTB and it fails to build PyD with DMD :-( -- Russel.

Re: Any trick for defining an operator overload in a different namespace?

2013-08-31 Thread Ali Çehreli
On 08/31/2013 03:07 AM, Andrej Mitrovic wrote: I'm trying to achieve the syntax opts[...] = 123, rather than using the more direct this[...] = 123. I can use this code: - class C { this() { opts = Opts(this); opts[foo] = 1; } struct Opts

Re: Any trick for defining an operator overload in a different namespace?

2013-08-31 Thread Andrej Mitrovic
On 9/1/13, Ali Çehreli acehr...@yahoo.com wrote: This is the limitation of inner structs' not having an 'outer' reference, right? Right, but this was just a workaround. Anyway I did just realize I can use opDispatch for this: - class C { this() { this.opts[foo] = 1; }

unserialize variants

2013-08-31 Thread gedaiu
Hi, i want to save data from an array of variants into a file. I saw that to!string format the array content in a nice way... There is a way of converting the resulted string back to an array of varianta? thanks, Bogdan