Thread overview | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 12, 2013 Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
I started a small article series on D specific patterns & idioms on my blog. I'm going to add more over time and hope that there are at least some in there which are not already known to everyone. You can find them here: http://3d.benjamin-thaut.de/?cat=17 Currently there are two: 1) D implict conversion idiom: http://3d.benjamin-thaut.de/?p=90 2) D templated interface idiom: http://3d.benjamin-thaut.de/?p=94 Feedback is welcome. Kind Regards Benjamin Thaut |
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On 7/11/13 11:53 PM, Benjamin Thaut wrote:
> I started a small article series on D specific patterns & idioms on my
> blog. I'm going to add more over time and hope that there are at least
> some in there which are not already known to everyone.
>
> You can find them here: http://3d.benjamin-thaut.de/?cat=17
>
> Currently there are two:
>
> 1) D implict conversion idiom: http://3d.benjamin-thaut.de/?p=90
> 2) D templated interface idiom: http://3d.benjamin-thaut.de/?p=94
>
> Feedback is welcome.
>
> Kind Regards
> Benjamin Thaut
Well you have a typo in the first title...
Andrei
|
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | I think it's a nice blog and encourage you to do more!
On 7/12/2013 12:34 AM, Andrei Alexandrescu wrote:
>> 1) D implict conversion idiom: http://3d.benjamin-thaut.de/?p=90
> Well you have a typo in the first title...
The same misspelling occurs repeatedly in the article, so it's not a typo.
"implicit"
also,
buildin => builtin
"D strives to prevent implict conversion between user defined types at all costs."
I don't think this is true. Implicit conversions are very useful. What D prevents are implicit conversions that can result in data loss, such as integer truncation.
|
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | > > "D strives to prevent implict conversion between user defined types at > all costs." > > I don't think this is true. Implicit conversions are very useful. What D > prevents are implicit conversions that can result in data loss, such as > integer truncation. > I did talk about implict conversions between user defined types. D does not have implict construction, or implict casting like C++ does. I did not talk about builtin types. -- Kind Regards Benjamin Thaut |
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On 7/12/13 3:53 AM, Benjamin Thaut wrote:
> I started a small article series on D specific patterns & idioms on my
> blog. I'm going to add more over time and hope that there are at least
> some in there which are not already known to everyone.
>
> You can find them here: http://3d.benjamin-thaut.de/?cat=17
>
> Currently there are two:
>
> 1) D implict conversion idiom: http://3d.benjamin-thaut.de/?p=90
> 2) D templated interface idiom: http://3d.benjamin-thaut.de/?p=94
>
> Feedback is welcome.
>
> Kind Regards
> Benjamin Thaut
This sentence worries me a bit:
"The code shown above has been tested with dmd 2.063.2"
It seems like every minor release of D works different than previous ones. Is that true? Isn't it enough to say "D2"? Can something be done to prevent this?
|
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On Friday, 12 July 2013 at 09:42:28 UTC, Benjamin Thaut wrote:
>>
>> "D strives to prevent implict conversion between user defined types at
>> all costs."
>>
>> I don't think this is true. Implicit conversions are very useful. What D
>> prevents are implicit conversions that can result in data loss, such as
>> integer truncation.
>>
>
> I did talk about implict conversions between user defined types. D does not have implict construction, or implict casting like C++ does. I did not talk about builtin types.
What's about alias this?
|
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tobias Pankrath | Am 12.07.2013 17:12, schrieb Tobias Pankrath: > On Friday, 12 July 2013 at 09:42:28 UTC, Benjamin Thaut wrote: >>> >>> "D strives to prevent implict conversion between user defined types at >>> all costs." >>> >>> I don't think this is true. Implicit conversions are very useful. What D >>> prevents are implicit conversions that can result in data loss, such as >>> integer truncation. >>> >> >> I did talk about implict conversions between user defined types. D >> does not have implict construction, or implict casting like C++ does. >> I did not talk about builtin types. > > What's about alias this? Did you even read the article? -- Kind Regards Benjamin Thaut |
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | Am 12.07.2013 15:26, schrieb Ary Borenszweig: > On 7/12/13 3:53 AM, Benjamin Thaut wrote: >> I started a small article series on D specific patterns & idioms on my >> blog. I'm going to add more over time and hope that there are at least >> some in there which are not already known to everyone. >> >> You can find them here: http://3d.benjamin-thaut.de/?cat=17 >> >> Currently there are two: >> >> 1) D implict conversion idiom: http://3d.benjamin-thaut.de/?p=90 >> 2) D templated interface idiom: http://3d.benjamin-thaut.de/?p=94 >> >> Feedback is welcome. >> >> Kind Regards >> Benjamin Thaut > > This sentence worries me a bit: > > "The code shown above has been tested with dmd 2.063.2" > > It seems like every minor release of D works different than previous > ones. Is that true? Isn't it enough to say "D2"? Can something be done > to prevent this? The shown code should work all versions of D 2.0 since 2.053 (I'm using it since then). I only mentioned the version of the dmd compiler, because I previously had issues with some of my articles where someone would say "but that statement is not true, it works with the current version of dmd". Kind Regards Benjamin Thaut -- Kind Regards Benjamin Thaut |
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | On Friday, 12 July 2013 at 13:26:21 UTC, Ary Borenszweig wrote:
> This sentence worries me a bit:
>
> "The code shown above has been tested with dmd 2.063.2"
>
> It seems like every minor release of D works different than previous ones. Is that true? Isn't it enough to say "D2"? Can something be done to prevent this?
D is still in the alpha phase of development, so things are still likely to change and break regularly. There's not much that can be done other than what's already being done, i.e. just try to implement everything and fix the major bugs as fast as possible. There's no silver bullet.
|
July 12, 2013 Re: Article series about patterns & idioms in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On 7/12/2013 2:42 AM, Benjamin Thaut wrote: >> >> "D strives to prevent implict conversion between user defined types at >> all costs." >> >> I don't think this is true. Implicit conversions are very useful. What D >> prevents are implicit conversions that can result in data loss, such as >> integer truncation. >> > > I did talk about implict conversions between user defined types. D does not have > implict construction, or implict casting like C++ does. "alias this" is used for implicit casting. BTW, it's implicit. There's an 'i' there! > I did not talk about builtin types. Ok - but I think it would be clearer if the statement added "for user defined types". |
Copyright © 1999-2021 by the D Language Foundation