Re: How can I use heapify in @safe code?

2016-10-01 Thread klmp via Digitalmars-d-learn

On Saturday, 1 October 2016 at 16:59:18 UTC, Burt wrote:

Hi,
I'd like to use a binary heap from @safe code. I thought @safe 
is transitive


It tries too but "heapify" uses the struct "BinaryHeap" that is 
not safe at all.
(either not annotated or @safe not applicable because of what it 
uses in intern: @system stuff)



but the following example does not compile:

import std.container.binaryheap;
@safe // This makes things fail.
unittest
{
// Test range interface.
import std.algorithm.comparison : equal;
int[] a = [4, 1, 3, 2, 16, 9, 10, 14, 8, 7];
auto h = heapify(a);
assert(h.equal([16, 14, 10, 9, 8, 7, 4, 3, 2, 1]));
}

Is there a way to @safely call heapify? How?


No easy "good" way:
1. BinaryHeap is an old container
2. It would require to patch the standard library. So virtually 
not available before weeks (but after a quick look it doesn't 
seem possible)


There's an easy "bad" way:

import std.container.binaryheap;
@safe // This makes things fail.
unittest
{
void foo() @trusted
{
import std.algorithm.comparison : equal;
int[] a = [4, 1, 3, 2, 16, 9, 10, 14, 8, 7];
auto h = heapify(a);
assert(h.equal([16, 14, 10, 9, 8, 7, 4, 3, 2, 1]));
}
}

but "bad", don't forget ;)
It's a complete cheat to trust here.


Re: Critque of Rust's collection types

2016-09-14 Thread Klmp via Digitalmars-d

On Wednesday, 14 September 2016 at 03:49:35 UTC, Basile B. wrote:
On Wednesday, 14 September 2016 at 00:36:39 UTC, Walter Bright 
wrote:

On 9/13/2016 4:47 PM, Walter Bright wrote:

http://ticki.github.io/blog/horrible/

Some worthwhile insights into what makes a good collection 
type.


https://news.ycombinator.com/item?id=12488233

Of particular interest is the advocacy of collision attack 
resistance. Is anyone interested in exploring this w.r.t. D's 
builtin hashes?


https://www.reddit.com/r/rust/comments/52grcl/rusts_stdcollections_is_absolutely_horrible/

Of interest are the comments by the implementer of the hash.


There's a benchmark of languages builtin hashmaps here:

http://vaskir.blogspot.fr/2016/05/hash-maps-rust-vs-f.html

It includes D and Rust. The author found that D wins for the 
lookups but was a bit behind for the insertions (due to GC 
maybe ?).


Rust results didn't seem that bad, despite of the cryptographic 
hash function it uses.


just ignore...get on ignoring.
tea vs coffee...cough



Re: What is the most stable D compiler

2016-09-14 Thread Klmp via Digitalmars-d

On Wednesday, 14 September 2016 at 11:52:00 UTC, Klmp wrote:

On Wednesday, 14 September 2016 at 11:34:22 UTC, eugene wrote:

What is the most reliable D compiler: dmd, ldc, gdc?


because it's slightly before DMD the answer is: LDC.


I meant slightly "behind", "before" is not appropriated. i 
understand the misunderstanding in the following comments. I 
meant that for LDC being just one step behind is an asset because 
there's always a risk of regression in DMD.



GDC is too far behind
DMD is at the front
LDC has most of the DMD fixes but sometimes without the 
regressions coming from the front.





Re: What is the most stable D compiler

2016-09-14 Thread Klmp via Digitalmars-d

On Wednesday, 14 September 2016 at 11:34:22 UTC, eugene wrote:

What is the most reliable D compiler: dmd, ldc, gdc?


because it's slightly before DMD the answer is: LDC.
GDC is too far behind
DMD is at the front
LDC has most of the DMD fixes but sometimes without the 
regressions coming from the front.


Re: Beta D 2.071.0-b1

2016-03-24 Thread KlMp via Digitalmars-d-announce

On Friday, 25 March 2016 at 02:20:53 UTC, Anon wrote:

On Friday, 25 March 2016 at 00:55:53 UTC, deadalnix wrote:
Unrelated to what ? It is a type system breaking bug, I think 
it is worth merging.


Unrelated to D? Double check your link. I don't think Martin 
can do anything about that pull request.


I think he uses a NG client to post. He hasn't realized he's 
posted on dlang.org !

That's funny.


Re: DlangUI project update

2014-12-29 Thread klmp via Digitalmars-d-announce

On Friday, 26 December 2014 at 12:33:04 UTC, Vadim Lopatin wrote:

Hello!

DlangUI project is alive and under active development.

https://github.com/buggins/dlangui

Recent changes:
- new controls: ScrollWidget, TreeView, ComboBox, ...
- new dialogs: FileOpenDialog, MessageBox
- a lot of bugfixes
- performance improvements in software renderer
- killer app: new example - Tetris game :)

Try Demos:
# download sources
git clone https://github.com/buggins/dlangui.git
cd dlangui
# example 1 - demo for most of widgets
dub run dlangui:example1 --build=release
# tetris - demo for game development
dub run dlangui:tetris --build=release

DlangUI is cross-platform GUI library written in D.
Main features:
- cross platform: uses SDL for linux/macos, Win32 API or SDL 
for Windows
- hardware acceleration: uses OpenGL for drawing when built 
with version USE_OPENGL
- easy to extend: since it's native D library, you can add your 
own widgets and extend functionality

- Unicode and internationalization support
- easy to customize UI - look and feel can be changed using 
themes and styles

- API is a bit similar to Android - two phase layout, styles

Screenshots (a bit outdated): 
http://buggins.github.io/dlangui/screenshots.html


See project page for details.

I would like to get any feedback.
Will be glad to see advises, bug reports, feature requests.

Best regards,
 Vadim


Great work. I left the idea to make GUI apps with D since a while 
but your project almost conviced me to give another try. I don't 
like the other options (GtkD, the other based on java things, the 
one based on tcl). It looks like the native GUI framework a lot 
of people are expecting. DQuick had my interest too but it seems 
that it's dormant since a small year now.