GSOC 2018 - no slots for D

2018-02-12 Thread Jakub Łabaj via Digitalmars-d

https://summerofcode.withgoogle.com/organizations/
Seems like we didn't make it this year :(

Is there any feedback from Google when they don't accept an 
organisation? Do you think that maybe they don't perceive D as a 
viable option or just the projects could have been defined better?


Re: !Alert! dlang.org SSL Error

2018-02-06 Thread Jakub Łabaj via Digitalmars-d

On Tuesday, 6 February 2018 at 14:05:46 UTC, Seb wrote:


Vladimir already did so an hour ago.
Though his web presence is blank for me at the moment:

https://www.janknepper.com


Works for me again.



Re: !Alert! dlang.org SSL Error

2018-02-06 Thread Jakub Łabaj via Digitalmars-d
On Tuesday, 6 February 2018 at 10:05:52 UTC, Martin Tschierschke 
wrote:

Chromium: ERR_SSL_PROTOCOL_ERROR

With Firefox and Chomium and with different Ubuntu Versions 
(17.10 and 16.04.)


Firefox - Google translated:

Error: Secure connection failed

An error occurred while connecting to dlang.org. SSL has 
received an entry that has exceeded the maximum allowed length. 
Error code: SSL_ERROR_RX_RECORD_TOO_LONG


 The website can not be displayed because the authenticity 
of the received data could not be verified.
 Please contact the owner of the website to inform him of 
this issue.


Same for me.


Re: BitArray shift left/right confusion.

2018-02-01 Thread Jakub Łabaj via Digitalmars-d-learn
I was looking at the issues you reported and was pretty surprised 
how some of the features work. So I'm going to revive this thread 
with an explanation.


On Wednesday, 27 December 2017 at 20:45:49 UTC, Biotronic wrote:
On Wednesday, 27 December 2017 at 18:08:19 UTC, Bastiaan Veelo 
wrote:

I suppose the following is not a bug, but confusing it is:

```
void main()
{
import std.stdio;
import std.bitmanip;
BitArray ba = [1, 1, 1, 1, 1, 1, 1, 1];
writeln(ba);// [1, 1, 1, 1, 1, 1, 1, 1]
ba >>= 4; // right shift
writeln(ba);// [1, 1, 1, 1, 0, 0, 0, 0] bits shifted left
}```

I suppose this is because the array is printed left-to-right, 
whereas the bits in a byte are typically ordered right-to-left.


BitArray stores its data in a `size_t[]` array - on 64-bit it 
consists of 8-byte units, each unit having its beginning at the 
least significant bit. So it works as you would probably expect:


bool[128] bits;
auto ba = BitArray(bits); // one bool corresponds to one bit in 
this constructor

ba[0] = 1;
ba[127] = 1;

Now, the exact representation of the array in this BitArray is as 
follows:

index:  | 0  | 1  |
bit no: | 64 ... 1 0 | 63 ... 1 0 |
values: | 0  ... 0 1 | 1  ... 0 0 |

You can get this array using cast:
size_t[] exact = cast(size_t[]) ba;
assert(exact[0] == 1);
assert(exact[1] == size_t(1) << 63);

Printing works in the human, i.e. logical, way:
writeln(ba); // [1, 0, ..., 0, ..., 0, 1]

BitArray has also a constructor taking a raw representation of 
the underlying array:

size_t val = 0b_;
auto ba2 = BitArray([val], 8);
writeln(ba2); // [0, 0, 0, 0, 1, 1, 1, 1]

It may be surprising, as it's opposite order of the binary 
literal. But this works as intended because it's supposed to be 
the inversion of casting:

assert(cast(size_t[]) ba2 == [val]);
It also works like that e.g. in Java's BitSet and C++'s bitset.

On the other hand, shifting operators are equally confusing for 
me, as they are for you - they really work in the other way 
around! I thought this is a very weird bug, but I found this pull 
request: https://github.com/dlang/phobos/pull/2844, which states 
this is the intended behaviour.


I don't know if there is anybody that would expect this - it's 
inconsistent with any other bitset implementation I know from 
other languages, as well as with what logic suggests. I'm curious 
if the authors changed their minds in this regard and there is 
any chance for that to be rewritten?


And besides, it's pretty bugged, indeed.




Re: Inline code in the docs - the correct way

2018-02-01 Thread Jakub Łabaj via Digitalmars-d

I can see that ddoc is a pretty hot topic here ;)

On Thursday, 1 February 2018 at 01:27:43 UTC, Adam D. Ruppe wrote:
To give you a quick answer, the tide is going toward ``. You 
should probably just use it in most cases as long as the code 
fits on a single line. If it is a multi-line sample, use ddoc's 
`---` brackets or a documented unittest instead.


Thank you for the answer and very thorough explanation. Seems 
like the Wiki contains up-to-date information then.


Inline code in the docs - the correct way

2018-01-31 Thread Jakub Łabaj via Digitalmars-d
What is the current state of the art of writing inline code in 
the documentation?


Wiki says "use `...` instead of $(D ...)": 
https://wiki.dlang.org/Contributing_to_Phobos#Documentation_style.


Some arguments made here: 
https://github.com/dlang/phobos/pull/5183#issuecomment-281895450 
suggest that backticks, among others, may not work well with 
cross-references as they may contain a code of a different 
language than D.


Still, pretty recent PRs suggest that backticks should be used, 
but only for single words:

- https://github.com/dlang/phobos/pull/5801
- https://github.com/dlang/phobos/pull/5970

I thought of updating the wiki to match the apparent consensus in 
this regard but wanted to make sure if it's really the way to go.