August 28, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to dsimcha | On 08/28/2011 04:31 PM, dsimcha wrote:
> On 8/28/2011 5:18 PM, Mafi wrote:
>>> dynamicCast: Cast a class to another. This should throw something
>>> derived from Error (not Exception) on failure instead of just returning
>>> null. If you want null, just use the cast operator. Maybe we should
>>> change its name, though. How about checkedCast or downCast?
>>
>> I think, to!someClass(x) works like you want dynamic cast to work.
>
> (Slaps self in forehead.) You're right, I forgot about that. Never mind.
I think such an addition would be worthwhile. We'd only need std.conv.reinterpretCast as that's a distinct way to convert types than to!T. The function would only work if the source and target types have the same size. Some overloads of it would be @safe (e.g. integral or floating point target) whereas others won't (e.g. those that forge pointers or references). Note that reinterpretCast would support conversions not covered by cast, e.g. converting a chunk of memory to a class object or one struct to another struct.
Andrei
| |||
August 28, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On 08/27/2011 12:14 PM, Benjamin Thaut wrote: > After having used the D 2.0 programming language for a year now and > having completed 3 projects with it, I wrote a small article about the > problems I had with the D 2.0 programming language and what suggestions > I have to improve it. > > http://3d.benjamin-thaut.de/?p=18 > > Comments and criticism welcome Reddit discussion has turned to tuples: http://www.reddit.com/r/programming/comments/jwkvx/suggestions_for_the_d_20_programming_language/ Andrei | |||
August 28, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 8/28/11 10:52 PM, Andrei Alexandrescu wrote:
> It is quite easy to define C++-like cast operators as D functions. If
> there's enough demand for that, we may include such in the standard
> library.
I hope this finally goes through, there still seem to be some – hurricane-related, probably – stability issues with the server. Anyway, a library solution is definitely what I am thinking about, especially since it's just a matter of a template with a fitting constraint. But as said in my other post (that also took quite a few attempts to post), I think such casting templates would make most sense if standardized, i.e. included with Phobos.
David
| |||
August 28, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | Andrei Alexandrescu: > Reddit discussion has turned to tuples: boost::tuples::tie is ugly compared to the syntax proposed in that pull request. > They work well except when expanding to multiple variables, There are two more places where it's handy to expand tuples: function signatures and foreach :-) But I don't know what good syntax to use yet, suggestions welcome. Is Kenji Hara interested? Bye, bearophile | |||
August 28, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 8/28/2011 3:56 PM, David Nadlinger wrote:
> I hope this finally goes through, there still seem to be some –
> hurricane-related, probably – stability issues with the server.
The only stability issue was the massive power outage. Jan got it back up running using a generator.
Jan has always done an excellent job taking care of the server, and I am very satisfied.
| |||
August 28, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 8/29/11 1:27 AM, Walter Bright wrote:
> On 8/28/2011 3:56 PM, David Nadlinger wrote:
>> I hope this finally goes through, there still seem to be some –
>> hurricane-related, probably – stability issues with the server.
>
> The only stability issue was the massive power outage. Jan got it back
> up running using a generator.
>
> Jan has always done an excellent job taking care of the server, and I am
> very satisfied.
Yes – I didn't mean to discredit anyone, but I were definitely having problems reaching the server during the last few hours. I didn't look at a traceroute though, it could well be that some carrier was at fault.
David
| |||
August 29, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 8/28/2011 4:34 PM, David Nadlinger wrote:
> On 8/29/11 1:27 AM, Walter Bright wrote:
>> On 8/28/2011 3:56 PM, David Nadlinger wrote:
>>> I hope this finally goes through, there still seem to be some –
>>> hurricane-related, probably – stability issues with the server.
>>
>> The only stability issue was the massive power outage. Jan got it back
>> up running using a generator.
>>
>> Jan has always done an excellent job taking care of the server, and I am
>> very satisfied.
>
> Yes – I didn't mean to discredit anyone, but I were definitely having problems
> reaching the server during the last few hours. I didn't look at a traceroute
> though, it could well be that some carrier was at fault.
It was down for 4 hours. Jan told me that he didn't care to try to get the generator engaged in total darkness in the middle of a hurricane. I don't blame him, I wouldn't either. Messing with generators can be dangerous, and getting hit with flying debris even worse.
| |||
August 29, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On 8/27/11 12:14 PM, Benjamin Thaut wrote: > After having used the D 2.0 programming language for a year now and > having completed 3 projects with it, I wrote a small article about the > problems I had with the D 2.0 programming language and what suggestions > I have to improve it. > > http://3d.benjamin-thaut.de/?p=18 On reddit: http://www.reddit.com/r/programming/comments/jwkvx/suggestions_for_the_d_20_programming_language/ Andrei | |||
August 29, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> wrote: > On 8/27/11 12:14 PM, Benjamin Thaut wrote: >> After having used the D 2.0 programming language for a year now and having completed 3 projects with it, I wrote a small article about the problems I had with the D 2.0 programming language and what suggestions I have to improve it. >> >> http://3d.benjamin-thaut.de/?p=18 > > On reddit: > > http://www.reddit.com/r/programming/comments/jwkvx/suggestions_for_the_d_20_programming_language/ > > > Andrei On the pattern matching syntax for templates in the comments -- Sigh, the spec gotta advertise this valid syntax in the operator overloading page more: Foo opBinary(string op:"+")(...) { ... } | |||
August 29, 2011 Re: Article about problems & suggestions for D 2.0 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to kennytm | Am 29.08.2011, 05:44 Uhr, schrieb kennytm <kennytm@gmail.com>:
> On the pattern matching syntax for templates in the comments -- Sigh, the
> spec gotta advertise this valid syntax in the operator overloading page
> more:
>
> Foo opBinary(string op:"+")(...) { ... }
Is 'more' an euphemism? ;) Good to know this syntax is possible, thx for clarifying.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply