[Issue 14264] Destructor not called when struct is returned from a parenthesis-less function call

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14264

--- Comment #9 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/753d6c9a19cf342d59ebae1c98eaa225d7c5f1ad
fix Issue 14264 - Destructor not called when struct is returned from a
parenthesis-less function call

https://github.com/D-Programming-Language/dmd/commit/f5ca6cfc53e5c7a189bf05b06b4129fefa3bf617
Merge pull request #4474 from 9rnsr/fix14264

Issue 14264 - Destructor not called when struct is returned from a
parenthesis-less function call

--


[Issue 14264] Destructor not called when struct is returned from a parenthesis-less function call

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14264

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


Re: Is there websocket client implementation for D

2015-03-25 Thread thedeemon via Digitalmars-d-learn

On Tuesday, 24 March 2015 at 17:55:38 UTC, Ilya Korobitsyn wrote:

Hello!

Is there any websocket client implementation in D?


There's some WebSocket stuff here:
https://github.com/adamdruppe/arsd/blob/master/cgi.d
It's for server side, but probably contains stuff you need for 
client too.


[Issue 14314] 2.067-rc1: ICE compiling project which has compiled fine for years

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14314

--- Comment #6 from Manu turkey...@gmail.com ---
(In reply to Vladimir Panteleev from comment #3)
 Was Dustmite unsuitable in reducing this problem?

Dunno. I've heard people murmur about this dustmite thing. I need to check it
out some time.
It's quite a large project... how does it work?

--


[Issue 14268] Win64: debug info for associative arrays have no type information

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14268

--- Comment #2 from github-bugzi...@puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a6157cbc64716e8c6c9b13d410bde467b7afd009
Merge pull request #4473 from rainers/cv8_aa_typeinfo

Fix Issue 14268 - Win64: debug info for associative arrays have no type
information

--


Re: Where's This week in D?

2015-03-25 Thread Jacob Carlborg via Digitalmars-d

On 2015-03-24 19:40, Adam D. Ruppe wrote:


I forgot to post it online this Sunday.


If you just forgot to post it I would recommend automating the process 
or add a weekly reminder to your calendar.


--
/Jacob Carlborg


Re: Release D 2.067.0

2015-03-25 Thread Martin Nowak via Digitalmars-d-announce
On Wednesday, 25 March 2015 at 02:53:02 UTC, Rikki Cattermole 
wrote:

a) A global variable that is only read before init of runtime
b) CLI args
c) CLI variables

So, wheres d? Configure by function call. I think I should get 
more involved with druntime development..


You need to configure the runtime before starting it, hence it's 
not possible to do this as function call from your program.


Re: Release D 2.067.0

2015-03-25 Thread thedeemon via Digitalmars-d-announce

On Tuesday, 24 March 2015 at 17:08:03 UTC, Martin Nowak wrote:

Glad to announce D 2.067.0.

See the changelog for more details.
http://dlang.org/changelog.html


I don't see any mention of DIP25 here (Sealed references - return 
ref arguments etc.). Was it implemented and included in this 
release?


[Issue 12799] Forward reference to nested enum with struct.sizeof

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12799

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


Re: uniform tuple syntax

2015-03-25 Thread via Digitalmars-d

On Tuesday, 24 March 2015 at 23:07:29 UTC, Vlad Levenfeld wrote:
You'd also have to rename opDollar to opHash or, maybe less 
confusingly, opPound.


opLength?

Also, $ is already a common idiom (at least in Unix) for the 
end. It would be better to just name


No, in Unix $ is used in /bin/sh for the prompt and to denote a 
variable, but $# is used for the number of parameters and 
${#variable} is used for length. What you are thinking about is 
that $ is used for pattern matching of the conceptual 
EOL-symbol (character) in regular expressions, but that's not 
length.
So in the Unix world $ is either used for variables or pattern 
matching, and # is used for length.


In perl $# is used to denote last item in list? In Lua # is 
the length operator? Using $ for length is just confusing if 
you know other languages.




Re: Release D 2.067.0

2015-03-25 Thread Robert burner Schadek via Digitalmars-d-announce

On Wednesday, 25 March 2015 at 02:02:50 UTC, Paul O'Neil wrote:
I have been eagerly awaiting this release for a while - 
especially for

std.experimental.logger!


let me know how you like it! I always need feedback on it



[Issue 13388] accept '@' before 'nothrow' and 'pure'

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13388

Sobirari Muhomori dfj1es...@sneakemail.com changed:

   What|Removed |Added

   Keywords||spec

--


Re: I like D

2015-03-25 Thread Sönke Ludwig via Digitalmars-d

Am 24.03.2015 um 21:19 schrieb Steven Schveighoffer:

On 3/24/15 4:11 PM, Andrei Alexandrescu wrote:

On 3/24/15 11:56 AM, Jacques =?UTF-8?B?TcO8bGxlciI=?=
jacques.muel...@gmx.de wrote:

On Tuesday, 24 March 2015 at 13:09:21 UTC, Steven Schveighoffer wrote:

New code:

immutable nfields = header.count('\t');
...
output.writeln(cycle(\t-).take(2 * nfields));


output.writeln(\t-.repeat(nfields).join);


output.writeln(\t-.repeat(nfields).joiner);



Yeah, I looked at repeat first, but it didn't do what I wanted (would
only repeat a single element).

For some reason, this seems more complex to me. However, it does have
the benefit of not needing the '2 *'. But I did not think of using
joiner, nice solution!

-Steve


Also, the shortest solution:

import std.array;
output.writeln(\t-.replicate(nfields));


Re: D's type classes pattern ?

2015-03-25 Thread matovitch via Digitalmars-d-learn

Thanks for the precisions on template constraint and template
specialization...Indeed wath I want to do look like isInputRange
constraint. Haskell have something like :

//(Pseudo D-Haskell)

void foo(InputRange R)(R r);

//D equivalent

void foo(R)(R r) if (isInputRange(R));

Except they call them type classes instead of template constraint
and it is check at runtime instead of compile time for D.

I am curious to know how isInputRange is implemented since I
wanted to do kind of the same but I am afraid it's full of (ugly)
traits and template trickeries where haskell type classes are
quite neat and essentially a declaration of an interface.

Let say I want to be able to add the type my algo deal with...I
could do an isAddable wich looks if a+b compiles with traits...I
wondered if you could check statically that the type could
implement an interface *if it wanted to* that is, without
inheriting it...





[Issue 13388] accept '@' before 'nothrow' and 'pure'

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13388

Sobirari Muhomori dfj1es...@sneakemail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #34 from Sobirari Muhomori dfj1es...@sneakemail.com ---
https://github.com/D-Programming-Language/dmd/pull/4349
The discussion was inconclusive?

--


[Issue 14333] New: dmd2/windows/bin/README.TXT is woefully out of date

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14333

  Issue ID: 14333
   Summary: dmd2/windows/bin/README.TXT is woefully out of date
   Product: D
   Version: D2
  Hardware: All
OS: Windows
Status: NEW
  Severity: minor
  Priority: P1
 Component: tools
  Assignee: nob...@puremagic.com
  Reporter: bugzi...@digitalmars.com

It's supposed to be a brief description of the files in the directory. It is
missing information on several of the files, and the links to man pages are
mostly out of date.

--


Re: D's type classes pattern ?

2015-03-25 Thread bearophile via Digitalmars-d-learn

matovitch:


I am curious to know how isInputRange is implemented since I
wanted to do kind of the same but I am afraid it's full of 
(ugly)

traits and template trickeries where haskell type classes are
quite neat and essentially a declaration of an interface.


Take a look at the sources and learn. They are sometimes tricky 
to get right, but it's not a problem of ugly syntax.




I wondered if you could check statically that the type could
implement an interface *if it wanted to* that is, without
inheriting it...


Template constraints don't require inheritance.

Bye,
bearophile


[Issue 12799] Forward reference to nested enum with struct.sizeof

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12799

--- Comment #4 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/945b754bd1084b77f09da55f5cc9c1f2ea5e89ca
fix Issue 12799 - Forward reference to nested enum with struct.sizeof

https://github.com/D-Programming-Language/dmd/commit/0358a7d216fd75eabea5782b682f6807ce1dde0b
Merge pull request #4467 from 9rnsr/fix12799

Issue 12799 - Forward reference to nested enum with struct.sizeof

--


[Issue 340] [Tracker] Forward reference bugs and other order-of-declaration issues

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=340
Issue 340 depends on issue 12799, which changed state.

Issue 12799 Summary: Forward reference to nested enum with struct.sizeof
https://issues.dlang.org/show_bug.cgi?id=12799

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 14321] Unnecessary destructor call with and AA's

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14321

--- Comment #4 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/751155f005db896546909e738ad4b576b17078d7
fix Issue 14321 - Unnecessary destructor call with and AA's

https://github.com/D-Programming-Language/dmd/commit/48086f7479f0e1101c490ba8e3f33fc932da962f
Merge pull request #4512 from 9rnsr/fix14321

Issue 14321 - Unnecessary destructor call with and AA's

--


Re: D's type classes pattern ?

2015-03-25 Thread matovitch via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 08:55:14 UTC, bearophile wrote:

matovitch:


I am curious to know how isInputRange is implemented since I
wanted to do kind of the same but I am afraid it's full of 
(ugly)

traits and template trickeries where haskell type classes are
quite neat and essentially a declaration of an interface.


Take a look at the sources and learn. They are sometimes tricky 
to get right, but it's not a problem of ugly syntax.




I wondered if you could check statically that the type could
implement an interface *if it wanted to* that is, without
inheriting it...


Template constraints don't require inheritance.

Bye,
bearophile


Yes I know that you don't need to inherit some InputRange 
interface to be able to check a user defined type is an input 
range. And template constraints are more powerful/general than 
type classes but it's harder to get right for the beginner. I 
will definetly look at the code anyway.


I was looking at :

interface IInputRange(InputRange) {...}

class TypeClass(T,I) : I!T
{
alias t this;
T t;
}

void foo(InputRange) (InputRange inputRange) if 
(isInstanciable(TypeClass!(InputRange, IInputRange)));


old download link broken

2015-03-25 Thread extrawurst via Digitalmars-d
the changelog on our main page links the releases to the download 
- this does not work for 2.065 anymore.


clicking on 2.065 links to:
http://downloads.dlang.org/releases/2.x/2.065

which is a 404 right now. that looks kinda unprofessional


Re: old download link broken

2015-03-25 Thread extrawurst via Digitalmars-d

On Wednesday, 25 March 2015 at 10:12:01 UTC, extrawurst wrote:
the changelog on our main page links the releases to the 
download - this does not work for 2.065 anymore.


clicking on 2.065 links to:
http://downloads.dlang.org/releases/2.x/2.065

which is a 404 right now. that looks kinda unprofessional


it seems the link needs to be:
http://downloads.dlang.org/releases/2.x/2.065.0/
which works..


[Issue 14290] is-expression accepts instantiation of already instantiated template

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14290

--- Comment #3 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4a90c005c971f40bced70257b343419436174e14
fix Issue 14290 - is-expression accepts instantiation of already instantiated
template

https://github.com/D-Programming-Language/dmd/commit/5c1fedca8a9c7b8b85013f03cb2607469292bbe7
Merge pull request #4499 from 9rnsr/fix14290

Issue 14290 - is-expression accepts instantiation of already instantiated
template

--


Novel list

2015-03-25 Thread Russel Winder via Digitalmars-d

http://hammerprinciple.com/therighttool/statements/this-language-is-best-for-very-large-projects

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


signature.asc
Description: This is a digitally signed message part


Re: A reason to choose D over Go

2015-03-25 Thread Bienlein via Digitalmars-d
I recently made a pull request for a go tool and spent about 
half an
hour trying to find some function to test whether an array 
contains a

particular element.


There are libraries for this like gen: 
http://clipperhouse.github.io/gen. But it also suffers from the 
absence of generics.



trust me, from an undecided but experienced developer's
perspective there are so many reasons to choose D over Go. on the
otherhand same person has a lot more reasons to choose Go over D.


I earn my pay with Java development. In my spare time I learn 
some Scala hoping there might be some work for me with Scala in 
the future. Then I need to become familiar with all kinds of new 
frameworks, tools, libraries and systems that continue to pop up 
every year in the JVM eco system.


In the end there is not much time left for playing with a 
systems language. As Go is very effortless it could be a good 
compromise here. I have thrown it away and refetched it due to 
lack of alternatives several times. I would like to play with D, 
but it has as step a learning curve as Scala. If you don't have a 
background in C or C++ the learning curve is even steeper. So it 
depends a lot from where you are coming.



i'm writing a very long blog post about this. if anyone's
interested, i can happily share the draft with them.


Please drop a comment in this thread or somewhere when it is 
published.


Cheers, Bienlein


[Issue 14290] is-expression accepts instantiation of already instantiated template

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14290

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


Re: Novel list

2015-03-25 Thread Rikki Cattermole via Digitalmars-d

On 25/03/2015 10:29 p.m., Russel Winder via Digitalmars-d wrote:


http://hammerprinciple.com/therighttool/statements/this-language-is-best-for-very-large-projects


Huh, we come off pretty good. Makes me kinda question their research 
techniques.




Re: Novel list

2015-03-25 Thread Kagamin via Digitalmars-d
or 
http://hammerprinciple.com/therighttool/statements/when-i-write-code-in-this-language-i-can-be-very-s


Re: Garbage collector collects live objects

2015-03-25 Thread Ali Çehreli via Digitalmars-d-learn

On 12/09/2014 08:53 AM, Steven Schveighoffer wrote:

 On 12/9/14 11:17 AM, ketmar via Digitalmars-d-learn wrote:

 that file can be already finalized. please remember that `~this()` is
 more a finalizer than destructor, and it's called on *dead* object.

Agreed: D has a terminology issue here, what we call a class 
destructor is a class finalizer. I have added D to the Wikipedia article:


  http://en.wikipedia.org/wiki/Finalizer

Now I want to improve some of my chapters.

 here this means that any other object in your object (including
 structs) can be already finalized at the time GC decides to call your
 finalizer.

Although I know the fact above, I think ketmar makes a distinction (that 
is new to me) that a finalizer is a function that does not reference 
class members but a destructor does (or safely can).


 File is specially designed (although it's not perfect) to be able to
 close in the GC. Its ref-counted payload is placed on the C heap to
 allow access during finalization.

 That being said, you actually don't need to write the above in the class
 finalizer, _file's destructor will automatically be called.

 just avoid destructors unless you *really* need that. in your case
 simply let GC finalize your File, don't try to help GC. this is not C++
 (or any other language without GC) and destructors aren't destructing
 anything at all. destructors must clean up the things that GC cannot
 (malloc()'ed memory, for example), and nothing else.


 Good advice ;)

 I would say other than library writers, nobody should ever write a class
 dtor.

 -Steve

Can somebody elaborate on that guideline please. Given a case where 
runtime polymorphism is needed, so that we have to use classes, does the 
guideline simply mean that arrange for manual cleanup or is there more 
in that guideline? I am confused about the library writers part. :)


Thank you,
Ali



Re: 2nd London D Programmers Meetup - Robot Tank Battle Tournament

2015-03-25 Thread Russel Winder via Digitalmars-d-announce
On Wed, 2015-03-25 at 11:25 +, wobbles via Digitalmars-d-announce wrote:
 On Tuesday, 24 March 2015 at 23:32:38 UTC, Kingsley wrote:
Here are the details - spread the word:

http://www.meetup.com/London-D-Programmers/events/220610394/

thanks

--Kingsley
  
  Thanks for all who came to the D meetup. The champion tank of 
  the evening goes to runaway.d by Justin  Priya which defeated 
  all challengers swiftly and in style :)
  
  Looking forward to the next meetup.
 
 Any videos of the fights? (Or were they all robot fights?)

The activity was captured by the good folk of Skills Matter.

It is worth noting the name of the winning tank exemplified it's 
strategy. It can be characterized by a quote from Monty Python and the 
Holy Grail:  run away, run away.

Whilst there, I didn't get around to writing a tank strategy, I spent 
too long looking at, and analysing, Kingsley's little framework – oh 
and chatting with Laeeth about D, Go, computational finance, etc.

Kingsley's code is (mostly) great; hopefully I and others can help 
evolve this via pull requests, to be something we can put before CAS 
and others for inclusion in Key Stage 3 and 4 educational materials. 
Long explanation of new UK computing education system elided. This 
would be a great way of getting young people interested in native code 
after Scratch and Python. D and Java would be a good combination.

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


signature.asc
Description: This is a digitally signed message part


The DMD Download page looks strange

2015-03-25 Thread wobbles via Digitalmars-d

http://dlang.org/download.html

Each of the download links are semi-overlaid on each other.

Tested on the latest Chrome and Firefox on Ubuntu 14.04.

With a new release out, I suspect these pages will be used a lot!


Re: DlangUI

2015-03-25 Thread Vadim Lopatin via Digitalmars-d-announce

On Tuesday, 20 May 2014 at 18:13:36 UTC, Vadim Lopatin wrote:

Hello!

I would like to announce my project, DlangUI library - 
cross-platform GUI for D.

https://github.com/buggins/dlangui
License: Boost License 1.0

Native library written in D (not a wrapper to other GUI 
library) - easy to extend.
As a backend, uses SDL2 on any platform, Win32 API on Windows, 
XCB on Linux. Other backends can be added easy.

Tested on Windows and Linux.
Supports hardware acceleration - drawing using OpenGL when 
built with version=USE_OPENGL.

Unicode support.
Internationalization support.
Uses Win32 API fonts on Windows, and FreeType on other 
platforms.

Same look and feel can be achieved on all platforms.
Flexible look and feel - themes and styles.
API is a bit similar to Android UI.
Flexible layout, support of different screen DPI, scaling.
Uses two phase layout like in Android.
Supports drawable resources in .png and .jpeg, nine-patch pngs 
and state drawables like in Android.

Single threaded. Use other threads for performing slow tasks.
Mouse oriented.


DlangUI review and small tutorial is published on Habrahabr - 
popular russian IT resource (in Russian)


http://habrahabr.ru/post/253923/



Re: Berlin D Meetup March 2015

2015-03-25 Thread Dicebot via Digitalmars-d-announce
Quick report : it has happened and it was pretty intense :) 
Martin Nowak has given a great talk explaining D garbage 
collector and recent improvements to it. I presume some of that 
material will be present in his DConf talk too - looking forward 
to hearing it again. Getting everything right straight after the 
work day wasn't easy :)


[Issue 8234] symbols used in CTFE affect the function literal type

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8234

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull

--- Comment #2 from Kenji Hara k.hara...@gmail.com ---
https://github.com/D-Programming-Language/dmd/pull/4517

--


Re: The DMD Download page looks strange

2015-03-25 Thread CraigDillabaugh via Digitalmars-d

On Wednesday, 25 March 2015 at 12:14:46 UTC, wobbles wrote:

http://dlang.org/download.html

Each of the download links are semi-overlaid on each other.

Tested on the latest Chrome and Firefox on Ubuntu 14.04.

With a new release out, I suspect these pages will be used a 
lot!


I see the same thing on Firefox 36.0.1 on Windows 7.  Looks fine 
with Explorer on Windows and Firefox on Linux.


[Issue 14334] (D1 only) Forward reference error with method returning template instance equal to typeof(this)

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14334

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

Version|D1  D2 |D1
Summary|Forward reference error |(D1 only) Forward reference
   |with method returning   |error with method returning
   |template instance equal to  |template instance equal to
   |typeof(this)|typeof(this)

--- Comment #1 from Kenji Hara k.hara...@gmail.com ---
(In reply to Andrej Mitrovic from comment #0)
  Error: alias test.SInt recursive alias declaration

This is a dup of 13204, and it's fixed from 2.066.1.

--


[Issue 1759] Closures and With Statements

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1759

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull
   Hardware|x86 |All
 OS|Windows |All

--- Comment #4 from Kenji Hara k.hara...@gmail.com ---
https://github.com/D-Programming-Language/dmd/pull/4518

--


Re: The DMD Download page looks strange

2015-03-25 Thread extrawurst via Digitalmars-d

On Wednesday, 25 March 2015 at 12:14:46 UTC, wobbles wrote:

http://dlang.org/download.html

Each of the download links are semi-overlaid on each other.

Tested on the latest Chrome and Firefox on Ubuntu 14.04.

With a new release out, I suspect these pages will be used a 
lot!


maybe you should upload a screenshot. on my end with chrome on 
osx it looks fine


Re: Novel list

2015-03-25 Thread Martin Krejcirik via Digitalmars-d

On Wednesday, 25 March 2015 at 12:01:15 UTC, wobbles wrote:
The DOES POORLY AT... column is good reading here for how D 
could improve ( though some of the comments are stupid. D has 
an annoying syntax!?)


doeas poorly at annoying syntax = not annoying syntax


Keep Track of the Best N Nodes in a Graph Traversal Algorithm

2015-03-25 Thread via Digitalmars-d-learn
I have graph traversal algorithm that needs to keep track of the 
N best node visit. Every time a visit a new node I get its 
goodness along with a ref to it. I then want to compare it to 
every currently best node in this list and replace it with the 
worst one if its better than the worst. How do I most easily do 
this with regards to minimizing GC-usage.


For N = 3 I mean something like this:

(A,1) = [(A,1)]
(B,2) = [(A,1), (B,2)]
(C,3) = [(A,1), (B,2), (C,3)]
(X,0) = [(X,0), (A,1), (B,2)]
(Y,1) = [(X,0), (Y,1), (A,1)]
...

(A,1) means we just visited node with goodness (distance) 1


Re: Novel list

2015-03-25 Thread Dave S via Digitalmars-d
On Wednesday, 25 March 2015 at 12:21:32 UTC, Martin Krejcirik 
wrote:

On Wednesday, 25 March 2015 at 12:01:15 UTC, wobbles wrote:
The DOES POORLY AT... column is good reading here for how D 
could improve ( though some of the comments are stupid. D has 
an annoying syntax!?)


doeas poorly at annoying syntax = not annoying syntax


Good catch. I was about to complain about the The thought that I 
may still be using this language in twenty years time fills me 
with dread until I realized that being under 'Does poorly' means 
that people DON'T think that. Actually, I'd like to think they 
think the opposite of that.


Re: The DMD Download page looks strange

2015-03-25 Thread Jacob Carlborg via Digitalmars-d

On 2015-03-25 13:14, wobbles wrote:

http://dlang.org/download.html

Each of the download links are semi-overlaid on each other.

Tested on the latest Chrome and Firefox on Ubuntu 14.04.

With a new release out, I suspect these pages will be used a lot!


Looks fine to me. Although this page [1] is broken.

[1] http://downloads.dlang.org

--
/Jacob Carlborg


Re: Keep Track of the Best N Nodes in a Graph Traversal Algorithm

2015-03-25 Thread bearophile via Digitalmars-d-learn

Nordlöw:

I have graph traversal algorithm that needs to keep track of 
the N best node visit.


std.algorithm.topNCopy?

Bye,
bearophile


[Issue 14187] Wrong overload resolution when one of the parameters to a function is an interface

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14187

yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com

--- Comment #1 from yebblies yebbl...@gmail.com ---
I'm not really sure if this is a bug, or just an unpleasant side effect of the
way overloading is worked out.

IIRC the worst conversion out of all the args is taken as the match level for
each function, and for both of those overloads the C - I conversion is the
worst, so they have the same match level and are ambiguous.  It might be
possible to tweak the match levels to fix this, I don't know.

There are probably other similar cases with other conversions that have the
same match level as C - I.

--


[Issue 14186] Silent syntax change from C and C++

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14186

yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com

--- Comment #7 from yebblies yebbl...@gmail.com ---
A better option might be to make it a parse error, like we did with a  b  c.

--


Re: The DMD Download page looks strange

2015-03-25 Thread Vladimir Panteleev via Digitalmars-d
On Wednesday, 25 March 2015 at 12:45:08 UTC, CraigDillabaugh 
wrote:

On Wednesday, 25 March 2015 at 12:14:46 UTC, wobbles wrote:

http://dlang.org/download.html

Each of the download links are semi-overlaid on each other.

Tested on the latest Chrome and Firefox on Ubuntu 14.04.

With a new release out, I suspect these pages will be used a 
lot!


I see the same thing on Firefox 36.0.1 on Windows 7.  Looks 
fine with Explorer on Windows and Firefox on Linux.


The stylesheet has been updated, so you'll need to reload the 
page (press F5).


Re: The DMD Download page looks strange

2015-03-25 Thread wobbles via Digitalmars-d
On Wednesday, 25 March 2015 at 12:51:02 UTC, Vladimir Panteleev 
wrote:
On Wednesday, 25 March 2015 at 12:45:08 UTC, CraigDillabaugh 
wrote:

On Wednesday, 25 March 2015 at 12:14:46 UTC, wobbles wrote:

http://dlang.org/download.html

Each of the download links are semi-overlaid on each other.

Tested on the latest Chrome and Firefox on Ubuntu 14.04.

With a new release out, I suspect these pages will be used a 
lot!


I see the same thing on Firefox 36.0.1 on Windows 7.  Looks 
fine with Explorer on Windows and Firefox on Linux.


The stylesheet has been updated, so you'll need to reload the 
page (press F5).


Yep, fixed now!

Thanks


Re: 2nd London D Programmers Meetup - Robot Tank Battle Tournament

2015-03-25 Thread Iain Buclaw via Digitalmars-d-announce
On 25 Mar 2015 12:15, Russel Winder via Digitalmars-d-announce 
digitalmars-d-announce@puremagic.com wrote:

 On Wed, 2015-03-25 at 11:25 +, wobbles via Digitalmars-d-announce
wrote:
  On Tuesday, 24 March 2015 at 23:32:38 UTC, Kingsley wrote:
 Here are the details - spread the word:

 http://www.meetup.com/London-D-Programmers/events/220610394/

 thanks

 --Kingsley
  
   Thanks for all who came to the D meetup. The champion tank of
   the evening goes to runaway.d by Justin  Priya which defeated
   all challengers swiftly and in style :)
  
   Looking forward to the next meetup.
 
  Any videos of the fights? (Or were they all robot fights?)

 The activity was captured by the good folk of Skills Matter.

 It is worth noting the name of the winning tank exemplified it's
 strategy. It can be characterized by a quote from Monty Python and the
 Holy Grail:  run away, run away.

 Whilst there, I didn't get around to writing a tank strategy, I spent
 too long looking at, and analysing, Kingsley's little framework – oh
 and chatting with Laeeth about D, Go, computational finance, etc.

 Kingsley's code is (mostly) great; hopefully I and others can help
 evolve this via pull requests, to be something we can put before CAS
 and others for inclusion in Key Stage 3 and 4 educational materials.
 Long explanation of new UK computing education system elided. This
 would be a great way of getting young people interested in native code
 after Scratch and Python. D and Java would be a good combination.


Great stuff. I would have tried to come up, but with moving home and all...
Vacated the flat this morning. :-o

Iain


Re: Keep Track of the Best N Nodes in a Graph Traversal Algorithm

2015-03-25 Thread via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 13:55:29 UTC, bearophile wrote:

Nordlöw:

I have graph traversal algorithm that needs to keep track of 
the N best node visit.


std.algorithm.topNCopy?

Bye,
bearophile


Could you please elaborate a bit how you mean this should be 
used. Notice that the number of visited nodes are in the millions 
or perhaps even tens of millions. And N is typically 100-1000.


Re: Novel list

2015-03-25 Thread Dejan Lekic via Digitalmars-d

On Wednesday, 25 March 2015 at 09:29:40 UTC, Russel Winder wrote:


http://hammerprinciple.com/therighttool/statements/this-language-is-best-for-very-large-projects


Nice one - I wonder what people answered to PROGRAMS WRITTEN IN 
THIS LANGUAGE WILL USUALLY WORK IN FUTURE VERSIONS OF THE 
LANGUAGE ??? :)


We all know the answer to that question regarding the D 
programming language. :D


Re: Novel list

2015-03-25 Thread via Digitalmars-d
Ugh, I haven't looked too closely at this, but they apparently 
also ignore those that are undecided? Meaning that numbers like 
90% meant X actually could be 9% meant X and 90% are undecided.


Looks like entertainment.


problems with std.bitmanip.append

2015-03-25 Thread Hugo via Digitalmars-d-learn

Hi,

I need to append an uint as an array of ubytes (in little endian) 
to an existing array of ubytes. I tried to compile this code 
(with dmd 2.066.1 under Windows 7 x86-64):


void main() {
   ubyte[] buffer = [0x1f, 0x8b, 0x08, 0x00];
   import std.system;
   import std.datetime : Clock, stdTimeToUnixTime;
   import std.bitmanip : append;
   
buffer.append!ubyte(cast(uint)stdTimeToUnixTime(Clock.currStdTime), 
Endian.littleEndian);

}

But it gives me this error: template std.bitmanip.append cannot 
deduce function from argument types !(ubyte)(ubyte[], uint, 
Endian)


Supposedly append Takes an integral value, converts it to the 
given endianness, and appends it to the given range of ubytes 
(using put) as a sequence of T.sizeof ubytes, so I thought I 
could use it, but after reading the documentation page for the 
function and the examples, I honestly can't understand where is 
the problem is.


Please, help!

Regards, Hugo


Re: Release D 2.067.0

2015-03-25 Thread Vladimir Panteleev via Digitalmars-d-announce

On Tuesday, 24 March 2015 at 23:00:56 UTC, Mathias Lang wrote:

Congrats to everyone involved !
A special thanks to Martin, that helped a lot to get Vibe.d 
ready for 2.067, and reverted the problematic changes when we 
realize it wasn't gonna cut it.


What were the reverted changes?


Re: Keep Track of the Best N Nodes in a Graph Traversal Algorithm

2015-03-25 Thread via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 13:55:29 UTC, bearophile wrote:

Nordlöw:

I have graph traversal algorithm that needs to keep track of 
the N best node visit.


std.algorithm.topNCopy?

Bye,
bearophile


Notice that, ideally, I would like my list of top-nodes to have a 
fixed size during the whole algorithm (99.9 % of time) as soon it 
has reached the length of N.


Re: Is there websocket client implementation for D

2015-03-25 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 07:12:56 UTC, thedeemon wrote:
It's for server side, but probably contains stuff you need for 
client too.


Yeah, I've been meaning to write a client for a while but haven't 
gotten around to it yet. What you do is make a HTTP request with 
a particular header, and if the server likes it, you're OK and 
can send messages. If not, the failure should be gracefully 
reported.


Could probably write it up in a couple hours if I had a 
couple hours :(


Re: Novel list

2015-03-25 Thread via Digitalmars-d
On Wednesday, 25 March 2015 at 09:47:57 UTC, Rikki Cattermole 
wrote:

On 25/03/2015 10:29 p.m., Russel Winder via Digitalmars-d wrote:


http://hammerprinciple.com/therighttool/statements/this-language-is-best-for-very-large-projects


Huh, we come off pretty good. Makes me kinda question their 
research techniques.


Self-selection is never a good idea. Only 64 respondents have 
rated both D and C++...


Re: Novel list

2015-03-25 Thread weaselcat via Digitalmars-d

On Wednesday, 25 March 2015 at 09:29:40 UTC, Russel Winder wrote:


http://hammerprinciple.com/therighttool/statements/this-language-is-best-for-very-large-projects


The D comparison with C++ is interesting, it sums up why I use D.


Re: Novel list

2015-03-25 Thread Alex Parrill via Digitalmars-d
On Wednesday, 25 March 2015 at 12:21:32 UTC, Martin Krejcirik 
wrote:

doeas poorly at annoying syntax = not annoying syntax


Yea, these charts are confusing, with the double negatives and 
the green up arrows next to negative aspects. A pro/con list 
would be much more clear.


Re: old download link broken

2015-03-25 Thread Andrei Alexandrescu via Digitalmars-d
extrawurst step...@extrawurst.org wrote:
 On Wednesday, 25 March 2015 at 10:12:01 UTC, extrawurst wrote:
 the changelog on our main page links the releases to the  download -
 this does not work for 2.065 anymore.
 
 clicking on 2.065 links to:
 http://downloads.dlang.org/releases/2.x/2.065
 
 which is a 404 right now. that looks kinda unprofessional
 
 it seems the link needs to be:
 http://downloads.dlang.org/releases/2.x/2.065.0/
 which works..

Are we good to announce? -- Andrei


Re: DTanks Alpha

2015-03-25 Thread Russel Winder via Digitalmars-d-announce
On Tue, 2015-03-24 at 23:37 +, Kingsley via Digitalmars-d-announce wrote:
 On Saturday, 21 March 2015 at 15:57:54 UTC, Dan Olson wrote:
  Kingsley kingsley.hendric...@gmail.com writes:
  
   In preparation for the London D meetup I have got the DTanks 
   robot
   battle framework into the first alpha release state - good 
   enough to
   use at the meetup anyway.
   
   https://github.com/masterthought/dtanks

And an excellent framework it is too. I hope to be able to put some 
programming effort towards this to help make it even better. Actually I
am wondering if we can put the framework skeleton to a constructive 
rather than destructive purpose.

   --K
  
  DTanks looks cool!  I am going to have to try it.  Brings back
  memories.
  
  I got hooked on the Apple ][ version 
  (http://corewar.co.uk/robotwar/)
  back in the 80's and started a version for the Amiga called 
  Tonks but
  it never got off the drawing board.  I've always loved this game
  concept.  Even did a version to run each tank on a node of an 
  Intel
  Hypercube as a school project.
 
 Cool - feel free to give me any feedback. At the London D 
 programmers meetup we had a tank tournament which was great fun. 
 Some of the guys who came had not done D before - they were Scala 
 / Java guys - but really enjoyed playing with D by way of the 
 tanks game.

Great fun was had by all there. Thanks to Kingsley for organizing 
this, and perhaps more importantly, getting the framework together.

An interesting point was made by some there: this looks very like Java 
coding. Laeeth and I both agreed, saying that we felt Kingsley 
background in Java was being reflected a little in the look and feel 
of the D code, that if a C++ programmer had written it most likely the 
code would have had a C++ feel to it. Much of this is about spacing, 
identifier structure and things like that – relatively trivial stuff 
in the main. The question us then is this fine ( that D code can have a
Java or C++ feel) or should there always be a D feel to all D code?  

 There should be a video of the tournament emerging at some point 
 from SkillsMatter who sponsor the meetup as they filmed it.

The video may not reflect quite as much of the fun that was had!
-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


signature.asc
Description: This is a digitally signed message part


Re: old download link broken

2015-03-25 Thread Andrei Alexandrescu via Digitalmars-d

On 3/25/15 8:08 AM, Andrei Alexandrescu wrote:

extrawurst step...@extrawurst.org wrote:

On Wednesday, 25 March 2015 at 10:12:01 UTC, extrawurst wrote:

the changelog on our main page links the releases to the  download -
this does not work for 2.065 anymore.

clicking on 2.065 links to:
http://downloads.dlang.org/releases/2.x/2.065

which is a 404 right now. that looks kinda unprofessional


it seems the link needs to be:
http://downloads.dlang.org/releases/2.x/2.065.0/
which works..


Are we good to announce? -- Andrei


Apparently not - the download page is a mess: 
http://downloads.dlang.org/releases/2.x/2.067.0/ -- Andrei




Re: old download link broken

2015-03-25 Thread Andrei Alexandrescu via Digitalmars-d

On 3/25/15 8:08 AM, Andrei Alexandrescu wrote:

extrawurst step...@extrawurst.org wrote:

On Wednesday, 25 March 2015 at 10:12:01 UTC, extrawurst wrote:

the changelog on our main page links the releases to the  download -
this does not work for 2.065 anymore.

clicking on 2.065 links to:
http://downloads.dlang.org/releases/2.x/2.065

which is a 404 right now. that looks kinda unprofessional


it seems the link needs to be:
http://downloads.dlang.org/releases/2.x/2.065.0/
which works..


Are we good to announce? -- Andrei


Also why the overly complicated link? 
http://downloads.dlang.org/releases/2.x/2.067.0/ should really be 
http://downloads.dlang.org/2.067.0/ -- Andrei


Re: old download link broken

2015-03-25 Thread Andrei Alexandrescu via Digitalmars-d

On 3/25/15 8:37 AM, wobbles wrote:

On Wednesday, 25 March 2015 at 15:36:32 UTC, Andrei Alexandrescu wrote:

On 3/25/15 8:08 AM, Andrei Alexandrescu wrote:

extrawurst step...@extrawurst.org wrote:

On Wednesday, 25 March 2015 at 10:12:01 UTC, extrawurst wrote:

the changelog on our main page links the releases to the  download -
this does not work for 2.065 anymore.

clicking on 2.065 links to:
http://downloads.dlang.org/releases/2.x/2.065

which is a 404 right now. that looks kinda unprofessional


it seems the link needs to be:
http://downloads.dlang.org/releases/2.x/2.065.0/
which works..


Are we good to announce? -- Andrei


Apparently not - the download page is a mess:
http://downloads.dlang.org/releases/2.x/2.067.0/ -- Andrei


http://dlang.org/download.html is good though?


That's good but we should make the other better, too. -- Andrei


Re: A reason to choose D over Go

2015-03-25 Thread Idan Arye via Digitalmars-d

On Wednesday, 25 March 2015 at 10:17:01 UTC, Bienlein wrote:
I recently made a pull request for a go tool and spent about 
half an
hour trying to find some function to test whether an array 
contains a

particular element.


There are libraries for this like gen: 
http://clipperhouse.github.io/gen. But it also suffers from the 
absence of generics.



trust me, from an undecided but experienced developer's
perspective there are so many reasons to choose D over Go. on 
the
otherhand same person has a lot more reasons to choose Go over 
D.


I earn my pay with Java development. In my spare time I learn 
some Scala hoping there might be some work for me with Scala in 
the future. Then I need to become familiar with all kinds of 
new frameworks, tools, libraries and systems that continue to 
pop up every year in the JVM eco system.


In the end there is not much time left for playing with a 
systems language. As Go is very effortless it could be a good 
compromise here. I have thrown it away and refetched it due to 
lack of alternatives several times. I would like to play with 
D, but it has as step a learning curve as Scala. If you don't 
have a background in C or C++ the learning curve is even 
steeper. So it depends a lot from where you are coming.



My case is the opposite - Go's easy learning curve is the exact 
thing that drove me away from it. While Go's simplicity makes it 
easy to learn - it also makes it uninteresting to learn. I like 
to learn new languages that introduce interesting concepts, 
because interesting concepts are interesting, and because they 
can change the way you program even in languages that don't 
support them directly. I'm currently trying to learn Rust, and 
while it's far from trivial to wrap your mind around it's concept 
of ownership, I feel that once I do it I can emerge a better 
programmer - so learning Rust will benefit me even if I never use 
Rust in actual projects.


Go, on the other hand, doesn't introduce any interesting 
concepts(more-elegant-C is far from being interesting). I don't 
care for just learning another set of syntax and another standard 
library - that knowledge won't have any effect on the way I'm 
thinking. As long as I don't have a specific project I need to 
use Go for - learning it is just a waste of time.


Re: old download link broken

2015-03-25 Thread wobbles via Digitalmars-d
On Wednesday, 25 March 2015 at 15:36:32 UTC, Andrei Alexandrescu 
wrote:

On 3/25/15 8:08 AM, Andrei Alexandrescu wrote:

extrawurst step...@extrawurst.org wrote:

On Wednesday, 25 March 2015 at 10:12:01 UTC, extrawurst wrote:
the changelog on our main page links the releases to the  
download -

this does not work for 2.065 anymore.

clicking on 2.065 links to:
http://downloads.dlang.org/releases/2.x/2.065

which is a 404 right now. that looks kinda unprofessional


it seems the link needs to be:
http://downloads.dlang.org/releases/2.x/2.065.0/
which works..


Are we good to announce? -- Andrei


Apparently not - the download page is a mess: 
http://downloads.dlang.org/releases/2.x/2.067.0/ -- Andrei


http://dlang.org/download.html is good though?


Re: Where's This week in D?

2015-03-25 Thread Adam D. Ruppe via Digitalmars-d

On Wednesday, 25 March 2015 at 05:46:34 UTC, tcak wrote:

I do not see any content that cannot be automated at all.


This one was mostly automated though the summary of the threads 
and the decision of which ones to summarize isn't, there I go a 
bit beyond the content and editoralize a bit sometimes too, 
giving my impression of the likelyhood of changed based on my 
experience in the community over the years.


(reading the threads is what probably eats the most time, though 
usualyl I spread it out over the week, reading posts as they come 
in, some weeks I ignore the forum until the weekend then have to 
quickly get caught up and try to figure out what the real subject 
is)


There's other manual features too that are added as time and 
length permits.


[Issue 14336] New: Invalid memory access in struct destructor in std.uni

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14336

  Issue ID: 14336
   Summary: Invalid memory access in struct destructor in std.uni
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: Phobos
  Assignee: nob...@puremagic.com
  Reporter: thecybersha...@gmail.com
CC: blah38...@gmail.com, dmitry.o...@gmail.com

Created attachment 1495
  -- https://issues.dlang.org/attachment.cgi?id=1495action=edit
Valgrind log

Valgrind (with my Valgrind branch [1]) reports an incorrect memory access in
std.uni.CowArray destructors (see attachment).

It looks like the following happens:

- The destructor is finalizing a heap-allocated array of InversionList!GcPolicy
structs.
- InversionList doesn't have a destructor, but it has a CowArray field
(data). CowArray has a destructor, so one is automatically generated for
InversionList.
- CowArray!GcPolicy.~this calls the refCount @property.
- The refCount @property attempts to refer to the heap-allocated (via GcPolicy)
uint[] data field, which has already been destroyed by the GC. As I understand,
this is an invalid memory access.

[1]:
https://github.com/CyberShadow/druntime/compare/pull-20150323-233811-gc-debug...valgrind

--


Re: Novel list

2015-03-25 Thread wobbles via Digitalmars-d
On Wednesday, 25 March 2015 at 12:21:32 UTC, Martin Krejcirik 
wrote:

On Wednesday, 25 March 2015 at 12:01:15 UTC, wobbles wrote:
The DOES POORLY AT... column is good reading here for how D 
could improve ( though some of the comments are stupid. D has 
an annoying syntax!?)


doeas poorly at annoying syntax = not annoying syntax


This list isn't not confusing!


Re: Release D 2.067.0

2015-03-25 Thread via Digitalmars-d-announce

On Tuesday, 24 March 2015 at 17:08:03 UTC, Martin Nowak wrote:

Glad to announce D 2.067.0.

This release comes with many improvements.
The GC is a lot faster for most use-cases, we have improved C++
interoperability and fixed plenty of bugs.


-Martin


Congratulations!!!


Re: A reason to choose D over Go

2015-03-25 Thread Laeeth Isharc via Digitalmars-d


I earn my pay with Java development. In my spare time I learn 
some Scala hoping there might be some work for me with Scala in 
the future. Then I need to become familiar with all kinds of 
new frameworks, tools, libraries and systems that continue to 
pop up every year in the JVM eco system.


In the end there is not much time left for playing with a 
systems language. As Go is very effortless it could be a good 
compromise here. I have thrown it away and refetched it due to 
lack of alternatives several times. I would like to play with 
D, but it has as step a learning curve as Scala. If you don't 
have a background in C or C++ the learning curve is even 
steeper. So it depends a lot from where you are coming.


I have never used Scala, never written in C++, and haven't done 
much C programming in about twenty years (and only occasional VBA 
for Excel programming in between).  I don't learn as quickly 
today as when a child.  But I was able to learn enough D to be 
productive in my domain in a few months, and found it easier to 
learn than Python.  So I haven't personally found the learning 
curve to be steep in the sense of learning enough to be 
reasonably productive.  The metaprogramming perhaps, but you can 
do a lot without being a ninja there if your orientation is just 
being able to solve the problems you have in a small to medium 
project.



Laeeth


How to properly Thread.sleep?

2015-03-25 Thread Israel via Digitalmars-d-learn
Ive tried using google but no matter what code i find it either 
doesnt work, compiler gives me errors or maybe the code is 
deprecated.


What is the proper way of adding sleep time to a program?
Ive tried..

import std.stdio;
import core.thread;

void main()
{
 writeln(Sleep..);
 sleep(200);
 writeln(done);
}

but all i get is a compiler error unidentified identifier sleep.

The documentation examples dont make sense. Why would it work 
this way?


Thread.sleep( dur!(msecs)( 50 ) );  // sleep for 50 milliseconds
Thread.sleep( dur!(seconds)( 5 ) ); // sleep for 5 seconds


Re: Keep Track of the Best N Nodes in a Graph Traversal Algorithm

2015-03-25 Thread Tobias Pankrath via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 14:40:28 UTC, Per Nordlöw wrote:

On Wednesday, 25 March 2015 at 13:55:29 UTC, bearophile wrote:

Nordlöw:

I have graph traversal algorithm that needs to keep track of 
the N best node visit.


std.algorithm.topNCopy?

Bye,
bearophile


Notice that, ideally, I would like my list of top-nodes to have 
a fixed size during the whole algorithm (99.9 % of time) as 
soon it has reached the length of N.


What's wrong with binary heaps?


[Issue 13388] accept '@' before 'nothrow' and 'pure'

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13388

--- Comment #35 from Jonathan M Davis issues.dl...@jmdavisprog.com ---
(In reply to Sobirari Muhomori from comment #34)
 https://github.com/D-Programming-Language/dmd/pull/4349
 The discussion was inconclusive?

The change was reverted, though I don't know how conclusive the discussion that
resulted was. Walter seemed to want to discuss it primarily so that we could
close this as won't fix and move on (though I'm not sure that he was entirely
against the idea), and Andrei definitely seemed to think that messing around
with @ was a waste of time, but I don't think that it was ever definitively
said what we'd do about it other than the fact that we'd revert the change
until we were sure that we wanted to make it. Certainly, there was no consensus
that this change should be made, and if anything, I think that the discussion
leaned towards not making it, even aside from what Walter and Andrei thought,
but I'd have to reread the thread to be sure of the details at this point.

So, I'd say that this is almost certainly a won't fix, but to be 100% sure,
Walter or Andrei would have to say that that was the case.

The discussion was here:
http://forum.dlang.org/post/rtwbtxigfeupvykpb...@forum.dlang.org

--


Re: Solution to problems:

2015-03-25 Thread Jake The Baker via Digitalmars-d

On Wednesday, 25 March 2015 at 04:20:03 UTC, Paul O'Neil wrote:

On 03/23/2015 05:34 PM, Jake The Baker wrote:
If D had an ide that could do the following I think 
development and

testing could be better managed.

1. IDE that works with a centralized server to be able to 
change D
versions at a drop of a time. e.g., click Master and it 
checks to see
if you have the latest, if not it downloads it, configures it, 
and sets
it up hands free to be used. (If it requires any interaction 
to work

then it is a bug)

2. Patches, bugs, and everything else can be accessed through 
this IDE.
Collaboration can be made between groups of people and 
individuals.
Announcements could be made by head honchos. (In fact, this 
software

could be more generic and used by anyone for any purpose of
collaboration in programming... e.g. with php).

One can see open bugs, issues, workarounds, etc at a click.

3. Projects could be collaborated on easily with people being 
able to
watch(RD) another persons session(say for debugging help or 
whatever).


4. The ability to connect resources to projects. e.g. insert a 
note over

a function that links to the D documentation about a bug.


Are there IDE's that do this?  As far as I know, Xcode does 
not, Qt

Creator does not.


I think you're getting a lot of push back because these ideas 
don't seem
reasonable, especially in comparison to the infrastructure of 
other

large-ish open source projects.


And this is exactly why things won't change. There was one time
we didn't have a space shuttle. There was a lot of people saying
the world was flat, At some point the computer you are working on
was just a concept that many people said couldn't be done.

Do *you know what progress is?

Seriously, do you believe that just because Qt, Xcode, VS, etc do
not have such features that such features are useless or simply
not possible? Because that is what you are effectively saying
with your argument.

This is not a BW game. It is Gray. The question isn't if these
features exist already or should be implemented. We know they
will improve performance and enhance collaboration. The question
is how much will it matter. But if you think it's BW then we
can't ever get to that question and nothing will ever change.
(Because you are either a black or a white. (avoids change or
embraces it))

If you want to go with the BW game then we can't even begin to
solve the problem because there is no open discussion that will
lead to true solutions. (I only posted stuff that is suppose to
be a jumping off point)

The Catholic Church has that mentality... as do most
Catholics(not a coincidence). Thousands of years of keeping
progress to a minimum will do that.
(I'm not getting into a religious discussion here. This is not
bashing Catholics. It is simply a well known fact that most(all?)
modern religions are anti-technological-progress because when you
are dealing with the supernatural it's kinda a moot point)










Re: The DMD Download page looks strange

2015-03-25 Thread Namespace via Digitalmars-d

On Wednesday, 25 March 2015 at 12:14:46 UTC, wobbles wrote:

http://dlang.org/download.html

Each of the download links are semi-overlaid on each other.

Tested on the latest Chrome and Firefox on Ubuntu 14.04.

With a new release out, I suspect these pages will be used a 
lot!


Oh, I've overlooked this thread. I've opened a bug report just 
now:

https://issues.dlang.org/show_bug.cgi?id=14337


Re: A reason to choose D over Go

2015-03-25 Thread Laeeth Isharc via Digitalmars-d

On Wednesday, 25 March 2015 at 17:21:43 UTC, Laeeth Isharc wrote:


I earn my pay with Java development. In my spare time I learn 
some Scala hoping there might be some work for me with Scala 
in the future. Then I need to become familiar with all kinds 
of new frameworks, tools, libraries and systems that continue 
to pop up every year in the JVM eco system.


In the end there is not much time left for playing with a 
systems language. As Go is very effortless it could be a 
good compromise here. I have thrown it away and refetched it 
due to lack of alternatives several times. I would like to 
play with D, but it has as step a learning curve as Scala. If 
you don't have a background in C or C++ the learning curve is 
even steeper. So it depends a lot from where you are coming.


I have never used Scala, never written in C++, and haven't done 
much C programming in about twenty years (and only occasional 
VBA for Excel programming in between).  I don't learn as 
quickly today as when a child.  But I was able to learn enough 
D to be productive in my domain in a few months, and found it 
easier to learn than Python.  So I haven't personally found the 
learning curve to be steep in the sense of learning enough to 
be reasonably productive.  The metaprogramming perhaps, but you 
can do a lot without being a ninja there if your orientation is 
just being able to solve the problems you have in a small to 
medium project.



Laeeth


There is something about languages that is very personal, though. 
 D just seemed right aesthetically.  One is going to find it 
easier to become an expert on a composer - say Beethoven, if he 
speaks to something in your soul, than if you simply can't stand 
his music.  (And there are many gradations in between).  It is an 
unfashionable perspective, but I think this is true of 
programmimg languages too.  People have different aesthetic and 
emotional organisations, and the appeal of different languages 
will not be the same to every person, holding ability constant.


[Issue 14337] New: The buttons are misplaced on the download page

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14337

  Issue ID: 14337
   Summary: The buttons are misplaced on the download page
   Product: D
   Version: unspecified
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: normal
  Priority: P1
 Component: websites
  Assignee: nob...@puremagic.com
  Reporter: rswhi...@gmail.com

Created attachment 1496
  -- https://issues.dlang.org/attachment.cgi?id=1496action=edit
Misplaced Buttons

Direct link: http://fs2.directupload.net/images/150325/zv4smblr.png
Google Chrome Version 41.0.2272.101 m

--


Re: problems with std.bitmanip.append

2015-03-25 Thread John Colvin via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 15:44:50 UTC, Hugo wrote:

Hi,

I need to append an uint as an array of ubytes (in little 
endian) to an existing array of ubytes. I tried to compile this 
code (with dmd 2.066.1 under Windows 7 x86-64):


void main() {
   ubyte[] buffer = [0x1f, 0x8b, 0x08, 0x00];
   import std.system;
   import std.datetime : Clock, stdTimeToUnixTime;
   import std.bitmanip : append;
   
buffer.append!ubyte(cast(uint)stdTimeToUnixTime(Clock.currStdTime), 
Endian.littleEndian);

}

But it gives me this error: template std.bitmanip.append cannot 
deduce function from argument types !(ubyte)(ubyte[], uint, 
Endian)


Supposedly append Takes an integral value, converts it to the 
given endianness, and appends it to the given range of ubytes 
(using put) as a sequence of T.sizeof ubytes, so I thought I 
could use it, but after reading the documentation page for the 
function and the examples, I honestly can't understand where is 
the problem is.


Please, help!

Regards, Hugo


As per the signature in the docs:

void append(T, Endian endianness = Endian.bigEndian, R)(R range, 
T value)


The endianness is the second template argument. What you need to 
write is


buffer.append!(uint, 
Endian.littleEndian)(cast(uint)stdTimeToUnixTime(Clock.currStdTime));


or

append!(uint, Endian.littleEndian)(buffer, 
cast(uint)stdTimeToUnixTime(Clock.currStdTime));


Note that you don't need to specify the third template argument, 
that will be inferred automatically from the type of `buffer`


Re: OPTLINK Error 45 Too Much DEBUG Data for Old CodeView format

2015-03-25 Thread Koi via Digitalmars-d-learn

On Monday, 23 March 2015 at 13:29:15 UTC, wobbles wrote:

Maybe this should be distributed in the DMD installer?


i don't know :)


Re: How to properly Thread.sleep?

2015-03-25 Thread Adam D. Ruppe via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 17:23:40 UTC, Israel wrote:

What is the proper way of adding sleep time to a program?


The documentation examples are exactly how you can do it:

Thread.sleep( dur!(msecs)( 50 ) );  // sleep for 50 milliseconds
Thread.sleep( dur!(seconds)( 5 ) ); // sleep for 5 seconds


Try one of those lines in your program and you'll see it work.

You can also call the various C functions to do it but the 
Thread.sleep is often a bit easier.


The documentation examples dont make sense. Why would it work 
this way?


sleep is a static method on the Thread class, so you need to call 
it Thread.sleep instead of plain sleep, and the argument uses a 
different type to make the units a bit more clear.


I believe

Thread.sleep(3.seconds);

shoudl also work.


Re: How to properly Thread.sleep?

2015-03-25 Thread Ali Çehreli via Digitalmars-d-learn

On 03/25/2015 10:23 AM, Israel wrote:

 Ive tried using google but no matter what code i find it either doesnt
 work, compiler gives me errors or maybe the code is deprecated.

 What is the proper way of adding sleep time to a program?
 Ive tried..

 import std.stdio;
 import core.thread;

 void main()
 {
   writeln(Sleep..);
   sleep(200);

Replace that with

 Thread.sleep(200.msecs);

   writeln(done);
 }

 but all i get is a compiler error unidentified identifier sleep.

 The documentation examples dont make sense.

Here is alternative documentation:

  http://ddili.org/ders/d.en/parallelism.html#ix_parallelism.Thread.sleep

 hy would it work this way?

 Thread.sleep( dur!(msecs)( 50 ) );  // sleep for 50 milliseconds
 Thread.sleep( dur!(seconds)( 5 ) ); // sleep for 5 seconds

UFCS makes it easier by making those 50.msecs and 5.seconds.

Ali



Re: problems with std.bitmanip.append

2015-03-25 Thread Hugo via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 17:09:05 UTC, John Colvin wrote:

As per the signature in the docs:

void append(T, Endian endianness = Endian.bigEndian, R)(R 
range, T value)


The endianness is the second template argument. What you need 
to write is


buffer.append!(uint, 
Endian.littleEndian)(cast(uint)stdTimeToUnixTime(Clock.currStdTime));


or

append!(uint, Endian.littleEndian)(buffer, 
cast(uint)stdTimeToUnixTime(Clock.currStdTime));


Note that you don't need to specify the third template 
argument, that will be inferred automatically from the type of 
`buffer`


Hmm... the examples for append in the documentation look very 
different from the syntax you have suggested. No wonder.


In any case, I have tried the code with the first way you 
suggested, and append actually does not append to the buffer, 
but... rewrites the buffer!


Since the buffer is not static, shouldn't append actually do that?



Re: How to properly Thread.sleep?

2015-03-25 Thread Sad panda via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 17:23:40 UTC, Israel wrote:
Ive tried using google but no matter what code i find it either 
doesnt work, compiler gives me errors or maybe the code is 
deprecated.


What is the proper way of adding sleep time to a program?
Ive tried..

import std.stdio;
import core.thread;

void main()
{
 writeln(Sleep..);
 sleep(200);
 writeln(done);
}

but all i get is a compiler error unidentified identifier sleep.

The documentation examples dont make sense. Why would it work 
this way?


Thread.sleep( dur!(msecs)( 50 ) );  // sleep for 50 
milliseconds

Thread.sleep( dur!(seconds)( 5 ) ); // sleep for 5 seconds


Thread.sleep(200.msecs);
Thread.sleep(12.seconds);
Thread.sleep(1.minutes);


Re: The DMD Download page looks strange

2015-03-25 Thread H. S. Teoh via Digitalmars-d
On Wed, Mar 25, 2015 at 12:14:45PM +, wobbles via Digitalmars-d wrote:
 http://dlang.org/download.html
 
 Each of the download links are semi-overlaid on each other.
 
 Tested on the latest Chrome and Firefox on Ubuntu 14.04.
 
 With a new release out, I suspect these pages will be used a lot!

Looks fine to me, tested on Firefox 31.0-3.


T

-- 
Маленькие детки - маленькие бедки.


[Issue 14337] The buttons are misplaced on the download page

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14337

rswhi...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


Re: How to properly Thread.sleep?

2015-03-25 Thread Israel via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 17:25:50 UTC, Sad panda wrote:

Thread.sleep(200.msecs);
Thread.sleep(12.seconds);
Thread.sleep(1.minutes);


There we go, thank you so much.


[Issue 14329] [2.067] offline doc - menu broken due to missing jquery-1.7.2.min.js

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14329

--- Comment #5 from Vladimir Panteleev thecybersha...@gmail.com ---
You should be able to use the CHM in the meanwhile.

--


Re: C# to D

2015-03-25 Thread bearophile via Digitalmars-d-learn

Dennis Ritchie:

int[] arr = { 7, 5, 7, 3, 3, 5, 3, 3, 0, 3, 1, 1, 5, 1, 
1, 1, 2, 2, 8, 5, 8, 8 };
Console.WriteLine(string.Join( , 
arr.OrderByDescending(x = arr.Count(y = y == x)).ThenBy(x = 
x)));

// prints 1 1 1 1 1 3 3 3 3 3 5 5 5 5 8 8 8 2 2 7 7 0


One solution:


void main() {
import std.stdio, std.algorithm, std.typecons;

auto arr = [7, 5, 7, 3, 3, 5, 3, 3, 0, 3, 1, 1, 5, 1, 1, 1, 
2, 2, 8, 5, 8, 8];


arr
.schwartzSort!(x = tuple(-arr.count!(y = y == x), x))
.writeln;
}


Bye,
bearophile


Re: C# to D

2015-03-25 Thread bearophile via Digitalmars-d-learn

.schwartzSort!(x = tuple(-arr.count!(y = y == x), x))


But calling count for each item is not efficient (in both C# 
and D). If your array is largish, then you need a more efficient 
solution.


Bye,
bearophile


Re: C# to D

2015-03-25 Thread Dennis Ritchie via Digitalmars-d-learn

On Wednesday, 25 March 2015 at 19:01:43 UTC, bearophile wrote:

One solution:


Thanks.

On Wednesday, 25 March 2015 at 19:03:27 UTC, bearophile wrote:
But calling count for each item is not efficient (in both C# 
and D). If your array is largish, then you need a more 
efficient solution.


A more effective solution for C ++:

#include iostream
#include vector
#include range/v3/all.hpp

int main() {
  using namespace ranges;

  auto rng = istreamint( std::cin )
   | to_vector
   | action::sort
   | view::group_by( std::equal_toint() )
   | copy
   | action::stable_sort( []( const auto e1, const auto 
e2 ) { return distance( e1 )  distance( e2 ); } );

  std::cout  ( rng );
}


Did D will try to get the vulkan opportunity?

2015-03-25 Thread bioinfornatics via Digitalmars-d

Dear,

I would like to know if D dev have a plan with vulkan : 
https://www.khronos.org/vulkan/ ?


D lang will be at same level than others language, nothing exists 
!


D could try to provide API and an environment around vulkan. To 
become a language  need to be used in this field.


Regards


Re: The DMD Download page looks strange

2015-03-25 Thread Walter Bright via Digitalmars-d

On 3/25/2015 6:16 AM, Jacob Carlborg wrote:

Looks fine to me. Although this page [1] is broken.

[1] http://downloads.dlang.org


Should be corrected now.


[Issue 14329] [2.067] offline doc - menu broken due to missing jquery-1.7.2.min.js

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14329

Vladimir Panteleev thecybersha...@gmail.com changed:

   What|Removed |Added

   Keywords||pull

--- Comment #4 from Vladimir Panteleev thecybersha...@gmail.com ---
https://github.com/D-Programming-Language/dlang.org/pull/942

--


[Issue 14329] [2.067] offline doc - menu broken due to missing jquery-1.7.2.min.js

2015-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14329

--- Comment #3 from bb.t...@gmx.com ---
And seriously how useful are the offline HTML docs?

example: my employee work on a ultra-secure intra network without internet
access and i don't want to upload the script on each terminal after each
release.

More seriously, just put it. There is another BR by a chinese guy who complains
about that, because the internet source of jquery is blocked over there...

--


Re: C# to D

2015-03-25 Thread Ali Çehreli via Digitalmars-d-learn

On 03/25/2015 12:01 PM, bearophile wrote:


bearophile


Do you know the story about groupBy? I see it in the documentation but 
my git head does not have it:


  http://dlang.org/phobos/std_algorithm_iteration.html#.groupBy

Ali



Re: C# to D

2015-03-25 Thread bearophile via Digitalmars-d-learn

Ali Çehreli:


Do you know the story about groupBy?


It's a long messy story. Look for it with another name, like 
chunkBy or something like that.


Bye,
bearophile


Re: Best D pitch

2015-03-25 Thread Joakim via Digitalmars-d

On Wednesday, 25 March 2015 at 18:35:37 UTC, Jonathan wrote:

Hey folks,

What's the best article/resource that I could give to a C++/C# 
developer to convince them on D? Ideally, I'm looking for 
something concise on the benefits with several examples.


I use Walter's article on component programming:

http://www.drdobbs.com/architecture-and-design/component-programming-in-d/240008321


Re: Release D 2.067.0

2015-03-25 Thread Andrej Mitrovic via Digitalmars-d-announce
On 3/24/15, Martin Nowak via Digitalmars-d-announce
digitalmars-d-announce@puremagic.com wrote:
 Glad to announce D 2.067.0.

Great work! It's amazing seeing how much work you guys are putting in
and making D better with each new release.


C# to D

2015-03-25 Thread Dennis Ritchie via Digitalmars-d-learn

Hi,
Can you please tell how to rewrite this code to D?

using System;
using System.Linq;
class Sort
{
static void Main()
{
int[] arr = { 7, 5, 7, 3, 3, 5, 3, 3, 0, 3, 1, 1, 5, 1, 
1, 1, 2, 2, 8, 5, 8, 8 };
Console.WriteLine(string.Join( , 
arr.OrderByDescending(x = arr.Count(y = y == x)).ThenBy(x = 
x)));

// prints 1 1 1 1 1 3 3 3 3 3 5 5 5 5 8 8 8 2 2 7 7 0
}
}

I want to sort the array in descending order of the number of 
elements in ascending order of elements.


  1   2   3   >