Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 29, 2013 Phobos - pure, const, safe, nothrow | ||||
---|---|---|---|---|
| ||||
What is the status of adding these annotations to phobos? It's difficult to use these until phobos gets them. E.g. to! and format is not pure. |
September 29, 2013 Re: Phobos - pure, const, safe, nothrow | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | On Sunday, 29 September 2013 at 09:00:56 UTC, simendsjo wrote: > What is the status of adding these annotations to phobos? It's difficult to use these until phobos gets them. E.g. to! and format is not pure. Most of phobos is templated, meaning it relies on inference. These functions are pure/nothrow/safe, if their implementations are. Also, since they are templates, more often then not, they depend on their parameters, making them *conditionally* pure/nothrow/safe. Under such circumstances, there is simply no way to *mark* them as such (even if they are). Efforts have been made recently for more "base" functions to be pure/nothrow (and ctfe btw), especially in std.string and std.array. *If* they can be marked as such, then (right now), we are tending to mark them as such. As for to!: it really depends on the parameters. Plus, to! is very complicated. If there are specific conversion types you think should be safe, but aren't, then please file a report, (or just quickly say what you had in mind here). I have an open pull that makes string transcoding "to!SomeStringType(someOtherStringInstance)" safe and pure. It still needs to get reviewed though. It can't be nothrow due to UTF though. |
October 02, 2013 Re: Phobos - pure, const, safe, nothrow | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | On 29/09/13 11:37, monarch_dodra wrote:
> On Sunday, 29 September 2013 at 09:00:56 UTC, simendsjo wrote:
>> What is the status of adding these annotations to phobos? It's difficult to
>> use these until phobos gets them. E.g. to! and format is not pure.
>
> Most of phobos is templated, meaning it relies on inference.
In various recent template-related explorations I have often wished it was possible to infer function attributes from template arguments .... :-(
See e.g. Proxy, which loses all the corresponding attributes of the underlying type's methods.
|
October 02, 2013 Re: Phobos - pure, const, safe, nothrow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On Wednesday, 2 October 2013 at 13:31:04 UTC, Joseph Rushton Wakeling wrote:
> On 29/09/13 11:37, monarch_dodra wrote:
>> On Sunday, 29 September 2013 at 09:00:56 UTC, simendsjo wrote:
>>> What is the status of adding these annotations to phobos? It's difficult to
>>> use these until phobos gets them. E.g. to! and format is not pure.
>>
>> Most of phobos is templated, meaning it relies on inference.
>
> In various recent template-related explorations I have often wished it was possible to infer function attributes from template arguments .... :-(
>
> See e.g. Proxy, which loses all the corresponding attributes of the underlying type's methods.
std.typecons.Proxy is designed to work transparently for the underlying method qualifiers. But I also agree that the implementation is still insufficient.
Could you show us the "not working" case? It would be much help.
Kenji Hara
|
Copyright © 1999-2021 by the D Language Foundation