Re: core.checkedint added to druntime

2014-06-18 Thread bearophile via Digitalmars-d-announce

Walter Bright:


https://github.com/D-Programming-Language/druntime/pull/839


Why aren't functions with ubyte/byte/short/ushort arguments 
included?


--

Here Lionello Lunesu has suggested a __traits(valueRange, 
) for built-in values:

http://forum.dlang.org/thread/lnrc8l$1254$1...@digitalmars.com

Once such trait is working on checkedint values, can this help 
the compiler remove some useless tests and increase the 
performance of checked ints?



it can be used to implement multi-precision integer arithmetic 
types.


It looks very useful for the "small value optimization" for 
BigIntegers, to not allocate on the heap when the numbers are 
small, and switch to the heap allocation when they grow.


If you use such improved bigintegers to write code that is not 
supposed to overflow the range of normal integers, you obtain 
code that is only moderately slower than using checkedints, but 
it also gives the correct results if some overflow has occurred 
:-)


Bye,
bearophile


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-18 Thread Kapps via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 22:00:42 UTC, Tofu Ninja wrote:

On Tuesday, 17 June 2014 at 17:10:16 UTC, Mengu wrote:
and also the genius idea to post each talk seperately instead 
of having a nice talks page on dconf.org and providing a link 
for that. i'd understand the keynotes but for the rest of the 
talks this is / was not a good idea.


I think the hope was that it would attract more views overall. 
I think what was not taken into account was the way Reddit post 
get viewed, having their up votes spread out among the 
different posts is much worse than pooling them as the reddit 
posts are far less likely to be viewed with low up vote counts. 
Also its annoying for us who just want to watch the talks.


A much better strategy would have been a full release of all 
the talks followed with a reddit post of all of them to get the 
large burst up front, then after wards have individual posts 
for each video to get the staggering as well. It would 
effectively doubled each videos exposure(reddit is all reposts 
any ways so its all the better :P).


According to Andrei's talk, it worked quite effectively last year 
based off the increased number of compiler downloads per month 
immediately following DConf. And I do think that it does work 
better as well, though have no evidence for that besides the 
number of downloads that Andrei said.


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-18 Thread Jacob Carlborg via Digitalmars-d-announce

On 2014-06-17 05:38, Adam D. Ruppe wrote:

On Monday, 16 June 2014 at 22:23:31 UTC, Dicebot wrote:

I have found many of talks this year incredibly interesting for actual
D users but not as "catchy" for something that passes by. Also lot of
stuff has been discussed live in #d and ustream chat room.


Yeah.


Or r/programming is just so saturated with links that something that
does not fit into "tl; dr" paragraph does not get any attention :)


It could be that it isn't on the youtube right off too. I posted there
saying I tried the ogv and it was awful and the mp4 was too big... so
maybe other people aren't inclined to bother with the downloads either.


I don't really like archive.org, it's incredibly slow compared to 
youtube. I prefer to download instead of streaming. Downloading from 
youtube takes around a minute (HD quality). Downloading from archive.org 
takes at least half an hour.


I don't see why it's not uploaded to youtube directly.

--
/Jacob Carlborg


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-18 Thread John via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 22:09:06 UTC, Joakim wrote:
Nobody paid attention to ruby for a decade, until David Hansson 
built rails with it.




I am hoping the vibe.d will do that magic to D.
I need support for MS SQL Server to use it in production though.


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-18 Thread Adam D. Ruppe via Digitalmars-d-announce

On Wednesday, 18 June 2014 at 18:50:40 UTC, Jacob Carlborg wrote:

Downloading from youtube takes around a minute (HD quality).


Your internet must be a lot faster than mine :P I only get about 
2 Mbps down so I like to get a lower quality file that downloads 
faster but still plays reliably... youtube seems to handle it 
well automatically.



I don't see why it's not uploaded to youtube directly.


yeah idk



Re: core.checkedint added to druntime

2014-06-18 Thread Walter Bright via Digitalmars-d-announce

On 6/18/2014 2:43 AM, bearophile wrote:

Walter Bright:


https://github.com/D-Programming-Language/druntime/pull/839


Why aren't functions with ubyte/byte/short/ushort arguments included?


Because there is no ubyte/byte/short/ushort math in C, C++ or D. There is only 
int/long math.




Re: core.checkedint added to druntime

2014-06-18 Thread bearophile via Digitalmars-d-announce

Walter Bright:

Because there is no ubyte/byte/short/ushort math in C, C++ or 
D. There is only int/long math.


A little of ubyte math is present, perhaps for this you add 
"uinc", "sinc", "udec", "sdec" functions to core.checkedint that 
support ubyte/byte/short/ushort types too:


void main() {
ubyte x = 100;
x++;
}


But you are right, in D if you sum two ubytes you get an int:

void main() {
ubyte x = 100;
ubyte y = 200;
pragma(msg, typeof(x + y)); // Prints "int"
}


Yet sometimes you want to perform safe math operations on 
ubytes/bytes/shorts/ushorts, and keep the same type for the 
results. So I presume a future Phobos Safe math based on 
core.checkedint will need to check the ranges by itself, to allow 
checked assignments back to the same types:


void main() {
Safe!ubyte x = 100;
Safe!ubyte y = 200;
Safe!ubyte z = x + y;
}

Bye,
bearophile


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-18 Thread Saurabh Das via Digitalmars-d-announce
I find it impossible to even find the posts on HN. Within a few 
hours of them being posted by Andrei, they are buried 4-5 pages 
deep in the 'new' section with very few upvotes.


Last year I saw most of the talks (DConf13) on HN and 
r/programming. This year I find them only on this forum because 
the talks are not staying up on HN or r/p front pages for much 
time.


Saurabh

On Tuesday, 17 June 2014 at 17:10:16 UTC, Mengu wrote:

On Monday, 16 June 2014 at 22:14:01 UTC, Adam D. Ruppe wrote:
The reddit response this year hasn't been particularly 
impressive it seems to me compared to last year :(


r/programming and hn is all about rust and go. on hn many d 
posts are invisible after some time. i believe mods are taking 
action there. if we want their attention, we should compare d 
with others; we should benchmark d and brag about the results 
etc. other than that, people are not paying attention to D and 
it's beautiful features.


and also the genius idea to post each talk seperately instead 
of having a nice talks page on dconf.org and providing a link 
for that. i'd understand the keynotes but for the rest of the 
talks this is / was not a good idea.




Re: core.checkedint added to druntime

2014-06-18 Thread David Bregman via Digitalmars-d-announce

On Wednesday, 18 June 2014 at 01:26:16 UTC, Walter Bright wrote:

https://github.com/D-Programming-Language/druntime/pull/839


I think the mulu implementation is incorrect. There can be an 
overflow even when r = 0. For example consider the int version 
with x = y = 1<<16.