Re: Can I use dub to generate docs?

2020-12-14 Thread Basile B. via Digitalmars-d-learn
On Monday, 14 December 2020 at 02:54:12 UTC, Jack wrote: like dmd's -D flag? you can try $ dub run harbored-mod -- $(find -iname *.d) That will generate doc for all d source in the current working directory.

closures + struct: Error: forward reference to inferred return type of function call

2020-12-14 Thread ddcovery via Digitalmars-d-learn
In this example, I try to use D Voldemore (fantastic) functionallity to implement a pattern usually used in javascript. Basically, a function closure represents the state, and the methods to access this state are returned in the form of union (union has not state itself). void main(){

Re: Is there a standard function that combines take() and popFrontExactly()

2020-12-14 Thread Dukc via Digitalmars-d-learn
On Friday, 11 December 2020 at 19:07:23 UTC, realhet wrote: I've just made this unicode wordreplacer function working, but It seems not too nice and functional-ish. Are there ways to make it more simple? To answer the title, yes there is: ``` foreach(isWord, len; str.map!fun.group){ auto

Re: Hex constant method starts from ".a": 0xCCCCCC.argb

2020-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
On Monday, 14 December 2020 at 05:51:28 UTC, Виталий Фадеев wrote: It's parsing the `.a` in `.argb` as part of the number: auto color = 0x00AABBCC.a rgb; // what the compiler sees You can fix it with parentheses: auto color = (0x00AABBCC).argb; Thanks! It is not perfect, but also beauty!

Re: closures + struct: Error: forward reference to inferred return type of function call

2020-12-14 Thread ddcovery via Digitalmars-d-learn
On Monday, 14 December 2020 at 12:22:26 UTC, ddcovery wrote: int opCmp(Number other){ return _value - other.value; }; Correction: bool opEquals(Number other){ return _value == other.value; };

Re: Is there a standard function that combines take() and popFrontExactly()

2020-12-14 Thread realhet via Digitalmars-d-learn
On Monday, 14 December 2020 at 14:16:41 UTC, Dukc wrote: On Friday, 11 December 2020 at 19:07:23 UTC, realhet wrote: I've just made this unicode wordreplacer function working, but It seems not too nice and functional-ish. Are there ways to make it more simple? To answer the title, yes there

Re: Hex constant method starts from ".a": 0xCCCCCC.argb

2020-12-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 December 2020 at 16:11:16 UTC, Jacob Carlborg wrote: Or you can call it `rgba`. It seems to be what Wikipedia prefers [1]. The ordering here tends to reflect the bytes. So argb puts the alpha byte first in the array whereas rgba puts red first. But there's other ways here

Re: How to check that function gets ref parameter?

2020-12-14 Thread Andrey Zherikov via Digitalmars-d-learn
On Sunday, 13 December 2020 at 19:49:35 UTC, Basile B. wrote: On Sunday, 13 December 2020 at 16:41:06 UTC, Andrey Zherikov wrote: You use the wrong traits, try ParameterStorageClassTuple instead: void f(int) {} void g(ref int) {} import std.traits : ParameterStorageClass,

Re: Hex constant method starts from ".a": 0xCCCCCC.argb

2020-12-14 Thread Виталий Фадеев via Digitalmars-d-learn
On Tuesday, 15 December 2020 at 05:04:46 UTC, Виталий Фадеев wrote: On Monday, 14 December 2020 at 16:19:18 UTC, Adam D. Ruppe wrote: On Monday, 14 December 2020 at 16:11:16 UTC, Jacob Carlborg wrote: Or you can call it `rgba`. It seems to be what Wikipedia prefers [1]. The ordering here

Re: Hex constant method starts from ".a": 0xCCCCCC.argb

2020-12-14 Thread Виталий Фадеев via Digitalmars-d-learn
On Tuesday, 15 December 2020 at 05:10:27 UTC, Виталий Фадеев wrote: On Tuesday, 15 December 2020 at 05:04:46 UTC, Виталий Фадеев wrote: On Monday, 14 December 2020 at 16:19:18 UTC, Adam D. Ruppe wrote: On Monday, 14 December 2020 at 16:11:16 UTC, Jacob Carlborg wrote: Or you can call it

Re: Hex constant method starts from ".a": 0xCCCCCC.argb

2020-12-14 Thread Виталий Фадеев via Digitalmars-d-learn
On Monday, 14 December 2020 at 16:19:18 UTC, Adam D. Ruppe wrote: On Monday, 14 December 2020 at 16:11:16 UTC, Jacob Carlborg wrote: Or you can call it `rgba`. It seems to be what Wikipedia prefers [1]. The ordering here tends to reflect the bytes. So argb puts the alpha byte first in the

Re: Can I use dub to generate docs?

2020-12-14 Thread Jack via Digitalmars-d-learn
Thank you guys, worked like a charm

Can ddocs link functions automatically?

2020-12-14 Thread Jack via Digitalmars-d-learn
let's say I have a comment like this: / call foo.baa() to validate operation / where foo is the module and baa the function, can ddocs generate a link to the html file where is this defined automatically or do I have to hard-code those links like this? / call