Re: val.init

2013-10-01 Thread Jacob Carlborg
On 2013-10-02 04:10, Nick Sabalausky wrote: I thought variable.init was different from T.init and gave the value of the explicit initializer if one was used. Was I mistaken?: Yes. -- /Jacob Carlborg

Re: unsigned interger overflow

2013-10-01 Thread Jonathan M Davis
On Wednesday, October 02, 2013 12:32:24 Alexandr Druzhinin wrote: > Is it safe to replace code: > > uint index; > // do something > index++; > if(index == index.max) > index = index.init; > > by the following code > uint index; > // do something > index++; /// I use unsigned int so uint.max chang

unsigned interger overflow

2013-10-01 Thread Alexandr Druzhinin
Is it safe to replace code: uint index; // do something index++; if(index == index.max) index = index.init; by the following code uint index; // do something index++; /// I use unsigned int so uint.max changed to 0 automagically Thanks in advance

Re: Learning D - first steps and best practices

2013-10-01 Thread Jonathan M Davis
On Tuesday, October 01, 2013 21:32:05 qznc wrote: > On Sunday, 29 September 2013 at 07:49:21 UTC, Jonathan M Davis > > wrote: > > I confess that I don't understand why so many people are > > fixated on having a > > standard style, particularly when it's very, very clear that > > most everyone > >

Re: Learning D - first steps and best practices

2013-10-01 Thread Jonathan M Davis
On Wednesday, October 02, 2013 03:19:19 Jesse Phillips wrote: > On Tuesday, 1 October 2013 at 19:32:08 UTC, qznc wrote: > > On Sunday, 29 September 2013 at 07:49:21 UTC, Jonathan M Davis > > > > wrote: > >> I confess that I don't understand why so many people are > >> fixated on having a > >> stan

val.init

2013-10-01 Thread Nick Sabalausky
I thought variable.init was different from T.init and gave the value of the explicit initializer if one was used. Was I mistaken?: import std.stdio; void main() { int a = 5; writeln(a.init); // Outputs 0, not 5 }

Re: 'pp' for D?

2013-10-01 Thread Nick Sabalausky
On Sun, 29 Sep 2013 16:31:14 +0200 "linkrope" wrote: > I want to pretty-print the representation of a value of a generic > type T. > In Ruby, I would use 'pp': > > value = 'hello' > pp value # prints "hello" - with quotes! > value = 42 > pp value # prints 42 > > Now, valu

Re: Designing an API with D.

2013-10-01 Thread Jesse Phillips
On Tuesday, 1 October 2013 at 03:01:32 UTC, evilrat wrote: AFAIK people rarely use interface files this days, one reason is templates which needs instantiated in ur code but it won't be able to put them in interface files. (though i may be wrong on it) The interface file needs the entire temp

Re: Learning D - first steps and best practices

2013-10-01 Thread Jesse Phillips
On Tuesday, 1 October 2013 at 19:32:08 UTC, qznc wrote: On Sunday, 29 September 2013 at 07:49:21 UTC, Jonathan M Davis wrote: I confess that I don't understand why so many people are fixated on having a standard style, particularly when it's very, very clear that most everyone disagrees on what

Re: 'pp' for D?

2013-10-01 Thread bearophile
monarch_dodra: %r is already taken: It means "raw". It's used as a way to use formatting, even when writing in a binary file. You can even use "%+r" and "%-r" to specify the endian-ness you want to write in. It's fun. Makes writing file headers *real* easy. I didn't know that -.- Bye, bearo

Re: 'pp' for D?

2013-10-01 Thread monarch_dodra
On Tuesday, 1 October 2013 at 19:47:16 UTC, linkrope wrote: On Tuesday, 1 October 2013 at 07:30:06 UTC, Jacob Carlborg wrote: On 2013-09-30 23:56, bearophile wrote: Surely Phobos should add a prettyPrinting() function, like the function of Python standard library. I would rather have functi

Re: 'pp' for D?

2013-10-01 Thread linkrope
On Tuesday, 1 October 2013 at 07:30:06 UTC, Jacob Carlborg wrote: On 2013-09-30 23:56, bearophile wrote: Surely Phobos should add a prettyPrinting() function, like the function of Python standard library. I would rather have function that generates a pretty representation of a given value.

Re: RosettaCode proposal: RFC diagram converter

2013-10-01 Thread qznc
On Monday, 30 September 2013 at 23:27:48 UTC, bearophile wrote: Inspired by a talk by Eden in the StrangeLoop 2013 conference, I'd like to create a new small Rosettacode Task. Perhaps someone here is able to review this task description a little, or even to implement the D solution: - - - -

Re: Learning D - first steps and best practices

2013-10-01 Thread qznc
On Sunday, 29 September 2013 at 07:49:21 UTC, Jonathan M Davis wrote: I confess that I don't understand why so many people are fixated on having a standard style, particularly when it's very, very clear that most everyone disagrees on what counts as good style. What little we have in terms of o

Re: CommonType and non-built-in types

2013-10-01 Thread Artur Skawina
On 10/01/13 19:56, Dicebot wrote: > Definition of common type is pretty simple - it is a type both types can be > implicitly converted to. It's a bit more complicated, even for the simple cases - for example two types that implicitly convert to a narrower type can (and usually should) have a diff

Re: Is there any plans to allow rdmd to emit object files?

2013-10-01 Thread Gary Willoughby
On Tuesday, 1 October 2013 at 17:58:58 UTC, Jacob Carlborg wrote: On 2013-10-01 18:03, Gary Willoughby wrote: Are there any plans to allow rdmd to emit object files? I ask because i have a debugger id like to use that uses object files and my project is of sufficient complexity that rdmd is ne

Re: CommonType and non-built-in types

2013-10-01 Thread ilya-stromberg
On Tuesday, 1 October 2013 at 17:56:17 UTC, Dicebot wrote: Definition of common type is pretty simple - it is a type both types can be implicitly converted to. For `int` and `BigInt` common type should be `BigInt` if it was possible to define that implicit conversion. AFAIK it is not possible a

Re: 'pp' for D?

2013-10-01 Thread qznc
On Tuesday, 1 October 2013 at 09:21:44 UTC, John Colvin wrote: On Monday, 30 September 2013 at 21:24:28 UTC, linkrope wrote: But putting quotes around a string value is obviously not enough. What if the string contains a quote? "hell\"o" would become `"hell"o"`! Would would you want it be bec

Re: Is there any plans to allow rdmd to emit object files?

2013-10-01 Thread Jacob Carlborg
On 2013-10-01 18:03, Gary Willoughby wrote: Are there any plans to allow rdmd to emit object files? I ask because i have a debugger id like to use that uses object files and my project is of sufficient complexity that rdmd is needed to correctly compile the dependencies. What happens if you pa

Re: CommonType and non-built-in types

2013-10-01 Thread Dicebot
Definition of common type is pretty simple - it is a type both types can be implicitly converted to. For `int` and `BigInt` common type should be `BigInt` if it was possible to define that implicit conversion. AFAIK it is not possible and thus they can't have common type.

Re: possible nested class/struct alias this bug

2013-10-01 Thread Artur Skawina
On 09/28/13 17:34, Eberhard wrote: > I came across this unexpected error in the first example, so I tested similar > scenarios, but couldn't make any sense of it. The symbols are looked up in parent scope first, the implicit conversion happens later. I'm not sure what the right order /should/ be;

Re: CommonType and non-built-in types

2013-10-01 Thread Artur Skawina
On 10/01/13 12:50, Joseph Rushton Wakeling wrote: > (4) Is there a good reason why there _shouldn't_ be a CommonType of (say) int > and BigInt? Define "CommonType". Ie it's a question of definition, and the language does not have sufficient means to easily enough express that concept ("interface

Is there any plans to allow rdmd to emit object files?

2013-10-01 Thread Gary Willoughby
Are there any plans to allow rdmd to emit object files? I ask because i have a debugger id like to use that uses object files and my project is of sufficient complexity that rdmd is needed to correctly compile the dependencies.

Re: Problem with rdmd

2013-10-01 Thread eles
On Saturday, 31 August 2013 at 12:01:48 UTC, Dicebot wrote: 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: This is an ancient dmd misfeature - it treats `dmd test` as `dmd test.d`, adding

Re: Derelict Assimp RemoveComponent

2013-10-01 Thread Lemonfiend
On Thursday, 26 September 2013 at 23:08:15 UTC, David Nadlinger wrote: On Wednesday, 25 September 2013 at 15:32:08 UTC, Lemonfiend wrote: The docs only mention http://assimp.sourceforge.net/lib_html/config_8h.html#afc0a4c00fb90c345eb38fe3f7d7c8637 which is less than helpful.. I'm not sure wha

Re: CommonType and non-built-in types

2013-10-01 Thread Dicebot
P.S. adding implicit conversion other way around is possible via `alias this` but I don't think it is a valid behavior. (as common type of (`long`, `int`, `short`) is `long`)

Re: CommonType and non-built-in types

2013-10-01 Thread monarch_dodra
On Tuesday, 1 October 2013 at 10:50:39 UTC, Joseph Rushton Wakeling wrote: Hello all, In the course of examining std.rational I've had to take a look inside std.traits.CommonType, and I'm hoping people can help me to understand some fine details which I'm currently unsure of. The essence of

Re: CommonType and non-built-in types

2013-10-01 Thread John Colvin
On Tuesday, 1 October 2013 at 10:50:39 UTC, Joseph Rushton Wakeling wrote: (1) Can someone please explain to me _in detail_ the mechanics of the code which identifies whether the first 2 template arguments have a common type? I understand what it does, but not why/how it does it, if you get m

Re: CommonType and non-built-in types

2013-10-01 Thread Dicebot
On Tuesday, 1 October 2013 at 10:50:39 UTC, Joseph Rushton Wakeling wrote: (1) Can someone please explain to me _in detail_ the mechanics of the code which identifies whether the first 2 template arguments have a common type? I understand what it does, but not why/how it does it, if you get m

CommonType and non-built-in types

2013-10-01 Thread Joseph Rushton Wakeling
Hello all, In the course of examining std.rational I've had to take a look inside std.traits.CommonType, and I'm hoping people can help me to understand some fine details which I'm currently unsure of. The essence of the CommonType template is simple: * If it is passed no arguments, the

Re: 'pp' for D?

2013-10-01 Thread monarch_dodra
On Tuesday, 1 October 2013 at 09:21:44 UTC, John Colvin wrote: On Monday, 30 September 2013 at 21:24:28 UTC, linkrope wrote: But putting quotes around a string value is obviously not enough. What if the string contains a quote? "hell\"o" would become `"hell"o"`! Would would you want it be bec

Re: 'pp' for D?

2013-10-01 Thread John Colvin
On Monday, 30 September 2013 at 21:24:28 UTC, linkrope wrote: But putting quotes around a string value is obviously not enough. What if the string contains a quote? "hell\"o" would become `"hell"o"`! Would would you want it be become?

Re: 'pp' for D?

2013-10-01 Thread bearophile
Jacob Carlborg: I would rather have function that generates a pretty representation of a given value. Then it either can be used to print the representation or something else. That's the point of the Python pprint() (pretty print) function :-) Bye, bearophile

Re: 'pp' for D?

2013-10-01 Thread Jacob Carlborg
On 2013-09-30 23:56, bearophile wrote: Surely Phobos should add a prettyPrinting() function, like the function of Python standard library. I would rather have function that generates a pretty representation of a given value. Then it either can be used to print the representation or something