Alias/Ref Tuples ?

2011-12-16 Thread Joshua Reusch
Hello, is there a way to say something like --- int a, b; AliasTuple!(a, b) = tuple(4,5); assert(a == 4 b == 5); --- without having to write an own AliasTuple template ? I want to use it for functions returning multiple values. Joshua Reusch

Re: Alias/Ref Tuples ?

2011-12-16 Thread Trass3r
I think something like this is implemented in a dmd pull request.

Re: Alias/Ref Tuples ?

2011-12-16 Thread Joshua Reusch
I found a way doing this with a simple function: --- void explode(R, T...)(R range, ref T values) { static if(hasLength!R) assert(range.length == T.length); foreach(i, value; range) values[i] = value; } --- but a more self-documenting version would be nice.

Re: -D option = Embedded documentation

2011-12-16 Thread Trass3r
Am 16.12.2011, 17:47 Uhr, schrieb dune do-...@email.com: Never tried this before: Tried (with D2.057) to use the embedded documentation option with: /** * documentation here */ and the html files are generated but they only contain a html skeleton and no documentation. This comment

Re: -D option = Embedded documentation

2011-12-16 Thread dune
What? Sorry but I don't understand... What I posted was an example, in reality there is tons of code inside the d file. Thanks

Re: -D option = Embedded documentation

2011-12-16 Thread Timon Gehr
On 12/16/2011 06:12 PM, dune wrote: What? Sorry but I don't understand... What I posted was an example, in reality there is tons of code inside the d file. Thanks That is not what you said. Obviously you should always give an example that actually fails, especially when you claim it does.

Re: -D option = Embedded documentation

2011-12-16 Thread Trass3r
What I posted was an example, in reality there is tons of code inside the d file. Show the file, or part of it.

Re: -D option = Embedded documentation

2011-12-16 Thread Trass3r
hrsmallPage generated by a href=http://www.digitalmars.com/d/2.0/ddoc.html;Ddoc/a. /small /body/html Ah looks like that must be updated to dlang.org too

Re: -D option = Embedded documentation

2011-12-16 Thread dune
I didn't realize that stuff like this will not work as expected: [code] /*** * Brief summary of what * myfunc does, forming the summary section. * * First paragraph of synopsis description. * * Second paragraph of * synopsis description. */ void myfunc() {

Re: Alias/Ref Tuples ?

2011-12-16 Thread Simen Kjærås
On Fri, 16 Dec 2011 14:00:11 +0100, Joshua Reusch yos...@arkandos.de wrote: Hello, is there a way to say something like --- int a, b; AliasTuple!(a, b) = tuple(4,5); assert(a == 4 b == 5); --- without having to write an own AliasTuple template ? I want to use it for functions returning

Re: Alias/Ref Tuples ?

2011-12-16 Thread Philippe Sigaud
There is one in dranges: http://dsource.org/projects/dranges It is not officially documented, and I don't know how good it actually is, but here's what documentation exists: http://svn.dsource.org/projects/dranges/trunk/dranges/docs/reftuple.html Hmm, thanks Simen, but no. It was a simple

Re: -D option = Embedded documentation

2011-12-16 Thread Trass3r
Am 16.12.2011, 19:45 Uhr, schrieb dune do-...@email.com: I didn't realize that stuff like this will not work as expected: [code] /*** * Brief summary of what * myfunc does, forming the summary section. * * First paragraph of synopsis description. * *

prettyprinter

2011-12-16 Thread Paul D. Anderson
Does anyone know of a prettyprint program for D code? I use a text editor rather than an IDE and it would be nice if I could standardize the format of my code. It's not onerous to do it by hand but it can be tedious. My text editor (Boxer) does pretty well on syntax highlighting (other than

Re: prettyprinter

2011-12-16 Thread Jesse Phillips
On Fri, 16 Dec 2011 23:59:58 +0100 Paul D. Anderson paul.d.removethis.ander...@comcast.andthis.net wrote: Does anyone know of a prettyprint program for D code? I use a text editor rather than an IDE and it would be nice if I could standardize the format of my code. It's not onerous to do

Re: Alias/Ref Tuples ?

2011-12-16 Thread Simen Kjærås
On Fri, 16 Dec 2011 14:00:11 +0100, Joshua Reusch yos...@arkandos.de wrote: Hello, is there a way to say something like --- int a, b; AliasTuple!(a, b) = tuple(4,5); assert(a == 4 b == 5); --- without having to write an own AliasTuple template ? I want to use it for functions returning

Array concat quiz

2011-12-16 Thread bearophile
A small quiz. This Python2 code: m1 = [[A', B']] print m1 m2 = m1 + [[]] print m2 Prints: [[A', B']] [[A', B'], []] What does this D2 program print? import std.stdio; void main() { string[][] m1 = [[A', B']]; writeln(m1); string[][] m2 = m1 ~ [[]]; writeln(m2); } Bye,

Re: Array concat quiz

2011-12-16 Thread Adam D. Ruppe
Don't forget that string is an alias for immutable(char)[]. The immutable isn't important here, but the fact that strings are arrays is. char[][][] is the real type here.

Re: Alias/Ref Tuples ?

2011-12-16 Thread Joshua Reusch
Am 17.12.2011 01:23, schrieb Simen Kjærås: On Fri, 16 Dec 2011 14:00:11 +0100, Joshua Reusch yos...@arkandos.de wrote: Hello, is there a way to say something like --- int a, b; AliasTuple!(a, b) = tuple(4,5); assert(a == 4 b == 5); --- without having to write an own AliasTuple template ? I

Re: prettyprinter

2011-12-16 Thread Andrej Mitrovic
Uncrustify + UniversalIndentGUI. The latter comes packaged with uncrustify, but it might not ship with the latest version which had some D-related bugfixes.