Thread overview | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 07, 2016 color lib | ||||
---|---|---|---|---|
| ||||
I've done another pass incorporating prior feedback, mostly focusing on documentation. http://dtest.thecybershadow.net/artifact/website-b6e2e44dd40dd7c70eb45829c02060b99ae3937b-57272ccdf902fa3f0c050d522129f2be/web/library-prerelease/std/experimental/color.html Can interested parties please give it another once-over and add further comments? How can I get this to a point where people would like to see it in phobos? Repo: https://github.com/TurkeyMan/color PR: https://github.com/dlang/phobos/pull/2845 |
October 06, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | On Thursday, 6 October 2016 at 14:53:52 UTC, Manu wrote:
> I've done another pass incorporating prior feedback, mostly focusing on documentation.
>
> http://dtest.thecybershadow.net/artifact/website-b6e2e44dd40dd7c70eb45829c02060b99ae3937b-57272ccdf902fa3f0c050d522129f2be/web/library-prerelease/std/experimental/color.html
>
> Can interested parties please give it another once-over and add
> further comments?
> How can I get this to a point where people would like to see it in phobos?
>
> Repo: https://github.com/TurkeyMan/color
> PR: https://github.com/dlang/phobos/pull/2845
Could you please make `colorFromString` nothrow @nogc? Or make `nothrow @nogc` analog. -- Ilya
|
October 06, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | On Thursday, 6 October 2016 at 14:53:52 UTC, Manu wrote:
> I've done another pass incorporating prior feedback, mostly focusing on documentation.
Just a quick minor comment on:
A8 RGB!("a",ubyte,false,0) 8 bit alpha-only color type.
-->
Reads like, "False what ???". Also "What is 0 ???".
-->
How about RGB!("a", ubyte, Linear.No, Colorspace.sRGB) or something like that,
since there's going to be a list of these in the docs.
What does colorspace 0 mean actually? (AdobeRGB??? i.e. first from colorspace enum according the docs).
|
October 07, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Yaroshenko | On 7 October 2016 at 03:03, Ilya Yaroshenko via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Thursday, 6 October 2016 at 14:53:52 UTC, Manu wrote:
>>
>> I've done another pass incorporating prior feedback, mostly focusing on documentation.
>>
>>
>> http://dtest.thecybershadow.net/artifact/website-b6e2e44dd40dd7c70eb45829c02060b99ae3937b-57272ccdf902fa3f0c050d522129f2be/web/library-prerelease/std/experimental/color.html
>>
>> Can interested parties please give it another once-over and add
>> further comments?
>> How can I get this to a point where people would like to see it in phobos?
>>
>> Repo: https://github.com/TurkeyMan/color
>> PR: https://github.com/dlang/phobos/pull/2845
>
>
> Could you please make `colorFromString` nothrow @nogc? Or make `nothrow @nogc` analog. -- Ilya
I think throwing is the precedented action in that failure case...
what would you suggest?
I could have an overload that returns an error or something...?
I wonder how the work towards throwing RC things is going?
|
October 07, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Random D user | On 7 October 2016 at 04:48, Random D user via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Thursday, 6 October 2016 at 14:53:52 UTC, Manu wrote:
>>
>> I've done another pass incorporating prior feedback, mostly focusing on documentation.
>
>
> Just a quick minor comment on:
> A8 RGB!("a",ubyte,false,0) 8 bit alpha-only color type.
> -->
> Reads like, "False what ???". Also "What is 0 ???".
> -->
> How about RGB!("a", ubyte, Linear.No, Colorspace.sRGB) or something like
> that,
> since there's going to be a list of these in the docs.
>
> What does colorspace 0 mean actually? (AdobeRGB??? i.e. first from colorspace enum according the docs).
It's kind of upsetting that the docs don't show the default arg as the
enum it is...
The struct is defined:
struct RGB(string components_, ComponentType_, bool linear_ = false,
RGBColorSpace colorSpace_ = RGBColorSpace.sRGB)
I don't know why the docs translate that to be '0'? Why not just omit
the default args from the docs as they are in the code:
alias A8 = RGB!("a", ubyte);
??
It also seems the docs have rearranged the order of the enum... seriously? Why wouldn't that retain the order the programmer specified?
Regarding 'Linear.No'... yeah... I dunno. I've had this argument before.
I really hate that pattern. If it's required, I'll do it, otherwise
I'm really not enthusiastic about it personally.
It just seems like pointless bloat in symbol names to me, is if they
weren't already bloated enough.
|
October 07, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | On Fri, 07 Oct 2016 11:42:08 +1000, Manu via Digitalmars-d wrote:
> I think throwing is the precedented action in that failure case... what would you suggest?
In C# 1.0, the standard pattern was to throw on errors. Later, they revised their preferred mechanism and started offering methods like:
static bool TryParse(string str, out DateTime dt) {...}
|
October 07, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
On 7 October 2016 at 11:42, Manu <turkeyman@gmail.com> wrote:
> On 7 October 2016 at 03:03, Ilya Yaroshenko via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>> On Thursday, 6 October 2016 at 14:53:52 UTC, Manu wrote:
>>>
>>> I've done another pass incorporating prior feedback, mostly focusing on documentation.
>>>
>>>
>>> http://dtest.thecybershadow.net/artifact/website-b6e2e44dd40dd7c70eb45829c02060b99ae3937b-57272ccdf902fa3f0c050d522129f2be/web/library-prerelease/std/experimental/color.html
>>>
>>> Can interested parties please give it another once-over and add
>>> further comments?
>>> How can I get this to a point where people would like to see it in phobos?
>>>
>>> Repo: https://github.com/TurkeyMan/color
>>> PR: https://github.com/dlang/phobos/pull/2845
>>
>>
>> Could you please make `colorFromString` nothrow @nogc? Or make `nothrow @nogc` analog. -- Ilya
>
> I think throwing is the precedented action in that failure case...
> what would you suggest?
> I could have an overload that returns an error or something...?
Problem with overloading is that the function type only differs by return type... is there a phobos convention for function naming where a parallel nothrow @nogc version is also supplied?
|
October 07, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris Wright | On 7 October 2016 at 12:25, Chris Wright via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Fri, 07 Oct 2016 11:42:08 +1000, Manu via Digitalmars-d wrote:
>> I think throwing is the precedented action in that failure case... what would you suggest?
>
> In C# 1.0, the standard pattern was to throw on errors. Later, they revised their preferred mechanism and started offering methods like:
>
> static bool TryParse(string str, out DateTime dt) {...}
Indeed, but what should WE do?
|
October 07, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
On 7 October 2016 at 12:38, Manu <turkeyman@gmail.com> wrote:
> On 7 October 2016 at 12:25, Chris Wright via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>> On Fri, 07 Oct 2016 11:42:08 +1000, Manu via Digitalmars-d wrote:
>>> I think throwing is the precedented action in that failure case... what would you suggest?
>>
>> In C# 1.0, the standard pattern was to throw on errors. Later, they revised their preferred mechanism and started offering methods like:
>>
>> static bool TryParse(string str, out DateTime dt) {...}
>
> Indeed, but what should WE do?
I've rolled with:
bool colorFromString(Color = RGB8)(scope const(char)[] str, out
Color color) pure nothrow @safe @nogc
|
October 07, 2016 Re: color lib | ||||
---|---|---|---|---|
| ||||
On 7 October 2016 at 12:55, Manu <turkeyman@gmail.com> wrote:
> On 7 October 2016 at 12:38, Manu <turkeyman@gmail.com> wrote:
>> On 7 October 2016 at 12:25, Chris Wright via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>>> On Fri, 07 Oct 2016 11:42:08 +1000, Manu via Digitalmars-d wrote:
>>>> I think throwing is the precedented action in that failure case... what would you suggest?
>>>
>>> In C# 1.0, the standard pattern was to throw on errors. Later, they revised their preferred mechanism and started offering methods like:
>>>
>>> static bool TryParse(string str, out DateTime dt) {...}
>>
>> Indeed, but what should WE do?
>
> I've rolled with:
> bool colorFromString(Color = RGB8)(scope const(char)[] str, out
> Color color) pure nothrow @safe @nogc
More updates and doco tweaks pushed.
|
Copyright © 1999-2021 by the D Language Foundation